infra(docker): add Docker Compose with PostgreSQL and Keycloak

- Add docker-compose.yml (v3.9) with postgres:16-alpine and keycloak:26.1 services
- Configure PostgreSQL with separate workclub and keycloak databases
- Setup Keycloak with database backend, admin user, and realm import capability
- Create PostgreSQL init script to provision development databases and users
- Add placeholder realm-export.json for Keycloak realm configuration
- Configure healthchecks and app-network bridge for service discovery
- Document configuration and patterns in learnings.md
This commit is contained in:
OpenCode Assistant
2026-03-03 14:07:29 +01:00
parent c7dd3299d7
commit cf7b47cb69
6 changed files with 712 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
TASK 2: Docker Compose Configuration Verification
================================================
Generated: 2026-03-03
## Configuration Files Created
✓ /docker-compose.yml - Main Docker Compose configuration
✓ /infra/keycloak/realm-export.json - Placeholder realm export
✓ /infra/postgres/init.sql - PostgreSQL initialization script
## YAML Syntax Validation
✓ docker-compose.yml structure verified:
- services: postgres, keycloak
- volumes: postgres-data
- networks: app-network
## Configuration Details
### PostgreSQL Service (postgres)
- Image: postgres:16-alpine
- Port: 5432
- Databases:
* postgres (system)
* workclub (application, user: app, password: devpass)
* keycloak (Keycloak metadata, user: keycloak, password: keycloakpass)
- Volume: postgres-data (/var/lib/postgresql/data)
- Healthcheck: pg_isready -U postgres
- Network: app-network
### Keycloak Service (keycloak)
- Image: quay.io/keycloak/keycloak:26.1
- Port: 8080
- Admin: admin/admin
- Database: keycloak (PostgreSQL)
- Command: start-dev --import-realm
- Realm Import: /opt/keycloak/data/import mounted to ./infra/keycloak
- Healthcheck: /health/ready endpoint
- Network: app-network
- Depends on: postgres (healthy)
## Environment Notes
Docker Engine: 29.2.1
Docker Compose: Not available (would require docker compose CLI plugin)
NOTE: Full integration test (docker compose up -d) cannot run in this environment.
However, configuration is syntactically valid and follows Docker Compose v3.9 specification.
## Service Dependencies
keycloak → depends_on postgres (service_healthy condition)
Both services connected via app-network bridge network
## Verification Summary
✓ YAML Syntax: Valid
✓ Service Definition: Both postgres and keycloak properly configured
✓ Environment Variables: All required vars present
✓ Volumes: postgres-data volume declared, keycloak realm import mount configured
✓ Networks: app-network bridge network declared
✓ Healthchecks: Configured for both services
✓ Database Setup: init.sql script creates workclub and keycloak databases with proper users
## Known Limitations
- docker compose CLI plugin not available in this environment
- Cannot perform runtime health verification (docker compose up)
- Cannot test OIDC discovery endpoint connectivity
- Manual Docker deployment would require: docker run commands or alternative orchestration
## File Structure
/Users/mastermito/Dev/opencode/
├── docker-compose.yml
├── infra/
│ ├── postgres/
│ │ └── init.sql
│ └── keycloak/
│ └── realm-export.json
All files are in place and ready for Docker deployment.