89 lines
3.1 KiB
YAML
89 lines
3.1 KiB
YAML
# =============================================================================
|
|
# Control Center — Full-Stack Docker Compose
|
|
# =============================================================================
|
|
# Boot the entire stack: PostgreSQL + Go backend + React frontend.
|
|
#
|
|
# Usage:
|
|
# cp .env.example .env # fill in values
|
|
# docker compose up --build # first run (builds images)
|
|
# docker compose up # subsequent runs
|
|
# docker compose down -v # teardown including DB volume
|
|
# =============================================================================
|
|
|
|
name: control-center
|
|
|
|
services:
|
|
# ── PostgreSQL ──────────────────────────────────────────────────────────────
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
container_name: cc-postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB:-controlcenter}
|
|
POSTGRES_USER: ${POSTGRES_USER:-controlcenter}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme}
|
|
ports:
|
|
- "${POSTGRES_PORT:-5432}:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./go-backend/migrations:/docker-entrypoint-initdb.d:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-controlcenter} -d ${POSTGRES_DB:-controlcenter}"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
networks:
|
|
- cc-network
|
|
|
|
# ── Go Backend ──────────────────────────────────────────────────────────────
|
|
backend:
|
|
build:
|
|
context: ./go-backend
|
|
dockerfile: Dockerfile
|
|
container_name: cc-backend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${BACKEND_PORT:-8080}:8080"
|
|
environment:
|
|
PORT: "8080"
|
|
DATABASE_URL: postgres://${POSTGRES_USER:-controlcenter}:${POSTGRES_PASSWORD:-changeme}@postgres:5432/${POSTGRES_DB:-controlcenter}?sslmode=disable
|
|
CORS_ORIGIN: "${CORS_ORIGIN:-http://localhost:3000}"
|
|
LOG_LEVEL: ${LOG_LEVEL:-info}
|
|
ENVIRONMENT: ${ENVIRONMENT:-development}
|
|
GATEWAY_URL: ${GATEWAY_URL:-http://openclaw-gateway:18789/api/agents}
|
|
GATEWAY_POLL_INTERVAL: ${GATEWAY_POLL_INTERVAL:-5s}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://localhost:8080/health"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 3
|
|
start_period: 5s
|
|
networks:
|
|
- cc-network
|
|
|
|
# ── React Frontend (nginx) ──────────────────────────────────────────────────
|
|
frontend:
|
|
build:
|
|
context: ./frontend
|
|
dockerfile: Dockerfile
|
|
container_name: cc-frontend
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${FRONTEND_PORT:-3000}:80"
|
|
depends_on:
|
|
backend:
|
|
condition: service_healthy
|
|
networks:
|
|
- cc-network
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
|
|
networks:
|
|
cc-network:
|
|
driver: bridge
|