# ══════════════════════════════════════════════════════ # Edict 三省六部 — 事件驱动架构 Docker Compose # ══════════════════════════════════════════════════════ services: # ── 基础设施 ── postgres: image: postgres:16-alpine environment: POSTGRES_DB: edict POSTGRES_USER: edict POSTGRES_PASSWORD: edict_dev_2024 ports: - "5432:5432" volumes: - pg_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U edict"] interval: 5s timeout: 3s retries: 5 restart: unless-stopped redis: image: redis:7-alpine ports: - "6379:6379" volumes: - redis_data:/data command: redis-server --appendonly yes --maxmemory 256mb --maxmemory-policy allkeys-lru healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 5 restart: unless-stopped # ── 后端服务 ── backend: build: context: .. dockerfile: edict/Dockerfile ports: - "8000:8000" environment: DATABASE_URL: postgresql+asyncpg://edict:edict_dev_2024@postgres:5432/edict REDIS_URL: redis://redis:6379/0 PORT: 8000 DEBUG: "true" depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - ../agents:/app/agents:ro - ../data:/app/data command: > sh -c " python -m alembic upgrade head && uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload " restart: unless-stopped # ── Worker 进程 ── orchestrator: build: context: .. dockerfile: edict/Dockerfile environment: DATABASE_URL: postgresql+asyncpg://edict:edict_dev_2024@postgres:5432/edict REDIS_URL: redis://redis:6379/0 depends_on: postgres: condition: service_healthy redis: condition: service_healthy command: python -m app.workers.orchestrator_worker restart: unless-stopped dispatcher: build: context: .. dockerfile: edict/Dockerfile environment: DATABASE_URL: postgresql+asyncpg://edict:edict_dev_2024@postgres:5432/edict REDIS_URL: redis://redis:6379/0 OPENCLAW_PROJECT_DIR: /app depends_on: postgres: condition: service_healthy redis: condition: service_healthy volumes: - ../agents:/app/agents:ro - ../scripts:/app/scripts - ../data:/app/data command: python -m app.workers.dispatch_worker restart: unless-stopped # ── 前端 ── frontend: build: context: ./frontend dockerfile: Dockerfile ports: - "3000:3000" environment: VITE_API_URL: http://localhost:8000 VITE_WS_URL: ws://localhost:8000/ws depends_on: - backend restart: unless-stopped volumes: pg_data: redis_data: