pahvalentines/backend/docker-compose.yml
michael 621a0ae097 feat: add dedicated Celery queue for video generation
Route create_video task to dedicated 'video' queue with concurrency=2.
Default worker now has concurrency=10 for all other tasks.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 00:11:37 -06:00

106 lines
3.1 KiB
YAML

version: '3.8'
services:
web:
build: .
ports:
- "8000:8000"
environment:
- DATABASE_URL=postgresql://pah:pah_password@db:5432/pah
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- SONAUTO_API_KEY=${SONAUTO_API_KEY}
- SONAUTO_API_URL=https://api.sonauto.ai/v1
- WEBHOOK_BASE_URL=${WEBHOOK_BASE_URL}
- STORAGE_BASE=/app/storage
volumes:
- ${STORAGE_HOST_PATH:-../storage}:/app/storage
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
# Default worker: all tasks except video generation
celery_worker_default:
build: .
command: celery -A tasks.celery_app worker --loglevel=info --concurrency=10 --queues=celery --hostname=worker-default@%h
environment:
- DATABASE_URL=postgresql://pah:pah_password@db:5432/pah
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- SONAUTO_API_KEY=${SONAUTO_API_KEY}
- SONAUTO_API_URL=https://api.sonauto.ai/v1
- WEBHOOK_BASE_URL=${WEBHOOK_BASE_URL}
- STORAGE_BASE=/app/storage
volumes:
- ${STORAGE_HOST_PATH:-../storage}:/app/storage
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
# Video worker: dedicated to video generation (limited concurrency)
celery_worker_video:
build: .
command: celery -A tasks.celery_app worker --loglevel=info --concurrency=2 --queues=video --hostname=worker-video@%h
environment:
- DATABASE_URL=postgresql://pah:pah_password@db:5432/pah
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- SONAUTO_API_KEY=${SONAUTO_API_KEY}
- SONAUTO_API_URL=https://api.sonauto.ai/v1
- WEBHOOK_BASE_URL=${WEBHOOK_BASE_URL}
- STORAGE_BASE=/app/storage
volumes:
- ${STORAGE_HOST_PATH:-../storage}:/app/storage
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
celery_beat:
build: .
command: celery -A tasks.celery_app beat --loglevel=info
environment:
- DATABASE_URL=postgresql://pah:pah_password@db:5432/pah
- REDIS_URL=redis://redis:6379/0
- CELERY_BROKER_URL=redis://redis:6379/0
- CELERY_RESULT_BACKEND=redis://redis:6379/0
- SONAUTO_API_KEY=${SONAUTO_API_KEY}
- SONAUTO_API_URL=https://api.sonauto.ai/v1
- WEBHOOK_BASE_URL=${WEBHOOK_BASE_URL}
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
db:
image: postgres:15
environment:
- POSTGRES_USER=pah
- POSTGRES_PASSWORD=pah_password
- POSTGRES_DB=pah
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U pah -d pah"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
postgres_data: