services: db: image: postgres:16-alpine environment: POSTGRES_USER: ${POSTGRES_USER:-company_ai} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required} POSTGRES_DB: ${POSTGRES_DB:-company_ai} volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] interval: 10s timeout: 5s retries: 5 redis: image: redis:7-alpine volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 migrate: build: . env_file: - .env environment: DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-company_ai}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}@db:5432/${POSTGRES_DB:-company_ai} REDIS_URL: redis://redis:6379/0 command: ["alembic", "upgrade", "head"] depends_on: db: condition: service_healthy restart: "no" api: build: . env_file: - .env environment: DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-company_ai}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}@db:5432/${POSTGRES_DB:-company_ai} REDIS_URL: redis://redis:6379/0 SCHEDULER_ENABLED: "false" ports: - "8010:8010" depends_on: db: condition: service_healthy redis: condition: service_healthy migrate: condition: service_completed_successfully healthcheck: test: [ "CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8010/api/v1/health/live', timeout=3).read()", ] interval: 10s timeout: 5s retries: 5 worker: build: . env_file: - .env environment: DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-company_ai}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}@db:5432/${POSTGRES_DB:-company_ai} REDIS_URL: redis://redis:6379/0 TASK_QUEUE_ENABLED: "true" SCHEDULER_ENABLED: "false" command: ["celery", "-A", "app.tasks.celery_app", "worker", "--loglevel=info"] depends_on: db: condition: service_healthy redis: condition: service_healthy migrate: condition: service_completed_successfully scheduler: build: . env_file: - .env environment: DATABASE_URL: postgresql+psycopg://${POSTGRES_USER:-company_ai}:${POSTGRES_PASSWORD:?POSTGRES_PASSWORD is required}@db:5432/${POSTGRES_DB:-company_ai} REDIS_URL: redis://redis:6379/0 SCHEDULER_ENABLED: "true" TASK_QUEUE_ENABLED: "true" command: ["python", "-m", "app.tools.run_scheduler"] depends_on: db: condition: service_healthy redis: condition: service_healthy migrate: condition: service_completed_successfully volumes: postgres_data: redis_data: