- Add google-cloud-storage dependency to requirements.txt - Add GCS configuration settings to config.py - Create storage.py utility module with upload/download/delete operations and temp file context managers for video generation - Update submissions.py to upload photos to GCS and return full GCS URLs - Update results.py to return full GCS URLs for video and record image - Update workers.py to use GCS for audio download, video creation, and cleanup - Update result.js to use audio_url directly from API response - Update docker-compose.yml with GCS credentials mount Storage now uses GCS bucket vday2026 in project holiday-project-india. Database stores blob paths; URLs constructed at API response time. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
109 lines
3.4 KiB
YAML
109 lines
3.4 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}
|
|
- GOOGLE_APPLICATION_CREDENTIALS=/app/google_cloud_storage.json
|
|
volumes:
|
|
- ./google_cloud_storage.json:/app/google_cloud_storage.json:ro
|
|
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}
|
|
- GOOGLE_APPLICATION_CREDENTIALS=/app/google_cloud_storage.json
|
|
volumes:
|
|
- ./google_cloud_storage.json:/app/google_cloud_storage.json:ro
|
|
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}
|
|
- GOOGLE_APPLICATION_CREDENTIALS=/app/google_cloud_storage.json
|
|
volumes:
|
|
- ./google_cloud_storage.json:/app/google_cloud_storage.json:ro
|
|
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}
|
|
- GOOGLE_APPLICATION_CREDENTIALS=/app/google_cloud_storage.json
|
|
volumes:
|
|
- ./google_cloud_storage.json:/app/google_cloud_storage.json:ro
|
|
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:
|