services: postgres: image: postgres:16 environment: POSTGRES_DB: mf POSTGRES_USER: mf POSTGRES_PASSWORD: mf ports: - "5432:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U mf -d mf"] interval: 5s timeout: 5s retries: 20 deploy: resources: limits: cpus: "1.0" memory: 512M restart: unless-stopped redis: image: redis:7 ports: - "6379:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 20 deploy: resources: limits: cpus: "0.5" memory: 256M restart: unless-stopped migration: build: . env_file: .env.example command: ["alembic", "upgrade", "head"] depends_on: postgres: condition: service_healthy api: build: . env_file: .env.example command: ["uvicorn", "contrib_guard.main:app", "--host", "0.0.0.0", "--port", "8000"] ports: - "8000:8000" depends_on: postgres: condition: service_healthy redis: condition: service_healthy migration: condition: service_completed_successfully healthcheck: test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health/live')"] interval: 10s timeout: 5s retries: 10 deploy: resources: limits: cpus: "1.0" memory: 512M restart: unless-stopped worker: build: . env_file: .env.example command: ["taskiq", "worker", "contrib_guard.workers.broker:broker", "contrib_guard.workers.tasks"] depends_on: postgres: condition: service_healthy redis: condition: service_healthy migration: condition: service_completed_successfully deploy: resources: limits: cpus: "1.0" memory: 512M restart: unless-stopped scheduler: build: . env_file: .env.example command: ["taskiq", "scheduler", "contrib_guard.workers.broker:scheduler", "contrib_guard.workers.tasks"] depends_on: postgres: condition: service_healthy redis: condition: service_healthy migration: condition: service_completed_successfully deploy: resources: limits: cpus: "0.5" memory: 256M restart: unless-stopped