113 lines
3.7 KiB
YAML
113 lines
3.7 KiB
YAML
# GallerySubscriber - Development Docker Compose
|
|
#
|
|
# This builds from source with hot-reloading and debug mode.
|
|
# Usage: docker compose -f docker-compose.dev.yml up --build
|
|
#
|
|
# Features:
|
|
# - Builds from local Dockerfile
|
|
# - Volume mounts for live code reloading
|
|
# - Debug logging enabled
|
|
# - Database and Redis ports exposed for local tools
|
|
# - Separate scheduler and worker services (matches production)
|
|
|
|
services:
|
|
# Combined backend API + frontend static files
|
|
app:
|
|
build: .
|
|
ports:
|
|
- "${PORT:-8080}:8080"
|
|
environment:
|
|
- TZ=${TZ:-America/New_York}
|
|
- DATABASE_URL=postgresql://${DB_USER:-gdl}:${DB_PASSWORD:-devpassword}@${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-gallery_subscriber}
|
|
- REDIS_URL=redis://${REDIS_HOST:-redis}:${REDIS_PORT:-6379}/${REDIS_DB:-0}
|
|
- SECRET_KEY=${SECRET_KEY:-dev-secret-key-not-for-production}
|
|
- DOWNLOAD_PARALLEL_LIMIT=${DOWNLOAD_PARALLEL_LIMIT:-3}
|
|
- DOWNLOAD_RATE_LIMIT=${DOWNLOAD_RATE_LIMIT:-3.0}
|
|
- LOG_LEVEL=DEBUG
|
|
- DEBUG=true
|
|
volumes:
|
|
- ./backend/app:/app/app:ro
|
|
- ${DATA_DOWNLOADS:-downloads}:/data/downloads
|
|
- ${DATA_CONFIG:-config}:/data/config
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_started
|
|
restart: unless-stopped
|
|
|
|
# Celery download workers - only process download tasks (heavy work)
|
|
worker:
|
|
build: .
|
|
command: celery -A app.tasks.celery_app worker --queues=downloads --loglevel=debug
|
|
environment:
|
|
- TZ=${TZ:-America/New_York}
|
|
- DATABASE_URL=postgresql://${DB_USER:-gdl}:${DB_PASSWORD:-devpassword}@${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-gallery_subscriber}
|
|
- REDIS_URL=redis://${REDIS_HOST:-redis}:${REDIS_PORT:-6379}/${REDIS_DB:-0}
|
|
- SECRET_KEY=${SECRET_KEY:-dev-secret-key-not-for-production}
|
|
- DOWNLOAD_PARALLEL_LIMIT=${DOWNLOAD_PARALLEL_LIMIT:-3}
|
|
- DOWNLOAD_RATE_LIMIT=${DOWNLOAD_RATE_LIMIT:-3.0}
|
|
- LOG_LEVEL=DEBUG
|
|
- DEBUG=true
|
|
volumes:
|
|
- ./backend/app:/app/app:ro
|
|
- ${DATA_DOWNLOADS:-downloads}:/data/downloads
|
|
- ${DATA_CONFIG:-config}:/data/config
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_started
|
|
restart: unless-stopped
|
|
|
|
# Celery scheduler - runs beat + handles lightweight scheduling tasks
|
|
scheduler:
|
|
build: .
|
|
command: celery -A app.tasks.celery_app worker --queues=scheduling --beat --loglevel=debug --concurrency=1
|
|
environment:
|
|
- TZ=${TZ:-America/New_York}
|
|
- DATABASE_URL=postgresql://${DB_USER:-gdl}:${DB_PASSWORD:-devpassword}@${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-gallery_subscriber}
|
|
- REDIS_URL=redis://${REDIS_HOST:-redis}:${REDIS_PORT:-6379}/${REDIS_DB:-0}
|
|
- SECRET_KEY=${SECRET_KEY:-dev-secret-key-not-for-production}
|
|
- LOG_LEVEL=DEBUG
|
|
- DEBUG=true
|
|
volumes:
|
|
- ./backend/app:/app/app:ro
|
|
depends_on:
|
|
db:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_started
|
|
restart: unless-stopped
|
|
|
|
# PostgreSQL database
|
|
db:
|
|
image: postgres:15-alpine
|
|
ports:
|
|
- "${DB_PORT:-5432}:5432"
|
|
environment:
|
|
- TZ=${TZ:-America/New_York}
|
|
- POSTGRES_USER=${DB_USER:-gdl}
|
|
- POSTGRES_PASSWORD=${DB_PASSWORD:-devpassword}
|
|
- POSTGRES_DB=${DB_NAME:-gallery_subscriber}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-gdl} -d ${DB_NAME:-gallery_subscriber}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
restart: unless-stopped
|
|
|
|
# Redis for Celery task queue
|
|
redis:
|
|
image: redis:7-alpine
|
|
ports:
|
|
- "${REDIS_PORT:-6379}:6379"
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
postgres_data:
|
|
downloads:
|
|
config:
|