# Backend development configuration # Usage: docker-compose up -d services: app: build: context: ./backend dockerfile: Dockerfile image: ai_agent_backend:dev container_name: ai_agent_backend ports: - "8033:8033" volumes: - ./backend/app:/app/app:ro - ./backend/cli:/app/cli:ro - media_data:/app/media env_file: - ./backend/.env environment: - DEBUG=true - ENVIRONMENT=local - POSTGRES_HOST=db - REDIS_HOST=redis - MILVUS_HOST=milvus - MILVUS_PORT=19530 - TASKIQ_BROKER_URL=redis://redis:6379/1 - TASKIQ_RESULT_BACKEND=redis://redis:6379/1 command: uvicorn app.main:app --host 0.0.0.0 --port 8033 --reload networks: - backend depends_on: db: condition: service_healthy redis: condition: service_healthy milvus: condition: service_healthy restart: unless-stopped db: image: postgres:16-alpine container_name: ai_agent_db environment: - POSTGRES_USER=${POSTGRES_USER:-postgres} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres} - POSTGRES_DB=${POSTGRES_DB:-ai_agent} volumes: - postgres_data:/var/lib/postgresql/data # Port exposed only for local development - remove in production ports: - "5432:5432" networks: - backend healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres}"] interval: 10s timeout: 5s retries: 5 restart: unless-stopped redis: image: redis:7-alpine container_name: ai_agent_redis # Port exposed only for local development - remove in production ports: - "6379:6379" volumes: - redis_data:/data networks: - backend healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 restart: unless-stopped etcd: image: quay.io/coreos/etcd:v3.6.11 container_name: ai_agent_etcd command: > etcd --advertise-client-urls http://etcd:2379 --listen-client-urls http://0.0.0.0:2379 --data-dir /var/lib/etcd volumes: - etcd_data:/var/lib/etcd networks: - backend healthcheck: test: ["CMD", "etcdctl", "endpoint", "health"] interval: 10s timeout: 5s retries: 5 restart: unless-stopped minio: image: minio/minio:RELEASE.2024-09-22T00-33-43Z container_name: ai_agent_minio ports: - "9010:9000" - "9011:9001" volumes: - minio_data:/data environment: - MINIO_ROOT_USER=minioadmin - MINIO_ROOT_PASSWORD=minioadmin command: server /data --console-address ":9001" networks: - backend healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] interval: 30s timeout: 10s retries: 5 restart: unless-stopped milvus: image: milvusdb/milvus:v2.6.17 container_name: ai_agent_milvus command: ["milvus", "run", "standalone"] ports: - "19530:19530" - "9091:9091" volumes: - milvus_data:/var/lib/milvus environment: - ETCD_ENDPOINTS=etcd:2379 - MINIO_ADDRESS=minio:9000 depends_on: etcd: condition: service_healthy minio: condition: service_healthy networks: - backend healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"] # Milvus standalone needs querycoord/datacoord/proxy to converge before # /healthz returns 200. On Apple Silicon Macs first boot can take 60-180s. # start_period suppresses failures during warm-up; 10 retries × 30s gives # 5 more minutes after that before compose gives up. start_period: 90s interval: 30s timeout: 10s retries: 10 restart: unless-stopped taskiq_worker: image: ai_agent_backend:dev pull_policy: never container_name: ai_agent_taskiq_worker volumes: - ./backend/app:/app/app:ro - media_data:/app/media command: taskiq worker app.worker.taskiq_app:broker --workers 1 --reload env_file: - ./backend/.env environment: - DEBUG=true - POSTGRES_HOST=db - REDIS_HOST=redis - MILVUS_HOST=milvus - MILVUS_PORT=19530 - TASKIQ_BROKER_URL=redis://redis:6379/1 - TASKIQ_RESULT_BACKEND=redis://redis:6379/1 networks: - backend depends_on: app: condition: service_started redis: condition: service_healthy db: condition: service_healthy milvus: condition: service_healthy restart: unless-stopped taskiq_scheduler: image: ai_agent_backend:dev pull_policy: never container_name: ai_agent_taskiq_scheduler volumes: - ./backend/app:/app/app:ro command: taskiq scheduler app.worker.taskiq_app:scheduler env_file: - ./backend/.env environment: - DEBUG=true - REDIS_HOST=redis - MILVUS_HOST=milvus - MILVUS_PORT=19530 - TASKIQ_BROKER_URL=redis://redis:6379/1 - TASKIQ_RESULT_BACKEND=redis://redis:6379/1 networks: - backend depends_on: app: condition: service_started redis: condition: service_healthy restart: unless-stopped networks: backend: driver: bridge volumes: media_data: postgres_data: redis_data: etcd_data: minio_data: milvus_data: