# Docker Compose configuration for BtToxin Pipeline # This is the unified production configuration. # Key features: # 1. Uses Traefik for routing (no exposed ports on host) # 2. Mounts existing data volumes from the original 'docker' project # 3. Fixes PYTHONPATH issues for Celery workers services: postgres: image: docker.m.daocloud.io/library/postgres:15-alpine container_name: bttoxin-postgres restart: unless-stopped environment: # Unified credentials matching the original 'docker' project - POSTGRES_USER=bttoxin - POSTGRES_PASSWORD=bttoxin_password - POSTGRES_DB=bttoxin_db volumes: - postgres_data:/var/lib/postgresql/data networks: - frontend redis: image: docker.m.daocloud.io/library/redis:7-alpine container_name: bttoxin-redis restart: unless-stopped volumes: - redis_data:/data networks: - frontend bttoxin: image: hotwa/bttoxin-app:latest build: context: . dockerfile: docker/dockerfiles/Dockerfile.traefik container_name: bttoxin-pipeline # No ports section - Traefik will handle routing via the container network volumes: - ./jobs:/app/jobs environment: - PYTHONPATH=/app:/app/backend - JOBS_DIR=/app/jobs - UPLOAD_DIR=/app/jobs/uploads - RESULTS_DIR=/app/jobs/results - DATABASE_URL=postgresql://bttoxin:bttoxin_password@bttoxin-postgres:5432/bttoxin_db - REDIS_URL=redis://bttoxin-redis:6379/0 - CELERY_BROKER_URL=redis://redis:6379/0 - CELERY_RESULT_BACKEND=redis://redis:6379/0 restart: unless-stopped depends_on: - postgres - redis networks: - frontend labels: # Enable Traefik for this container - "traefik.enable=true" - "traefik.docker.network=frontend" # HTTP Router (redirect to HTTPS) - "traefik.http.routers.bttoxin.rule=Host(`bttiaw.hzau.edu.cn`)" - "traefik.http.routers.bttoxin.entrypoints=web" - "traefik.http.routers.bttoxin.middlewares=redirect-to-https" # HTTPS Router - "traefik.http.routers.bttoxin-secure.rule=Host(`bttiaw.hzau.edu.cn`)" - "traefik.http.routers.bttoxin-secure.entrypoints=websecure" - "traefik.http.routers.bttoxin-secure.tls=true" - "traefik.http.routers.bttoxin-secure.tls.certresolver=myresolver" # Service configuration - "traefik.http.services.bttoxin.loadbalancer.server.port=8000" # TLS redirect middleware - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https" - "traefik.http.middlewares.redirect-to-https.redirectscheme.permanent=true" worker: image: hotwa/bttoxin-app:latest build: context: . dockerfile: docker/dockerfiles/Dockerfile.traefik container_name: bttoxin-worker volumes: - ./jobs:/app/jobs environment: - PYTHONPATH=/app:/app/backend - JOBS_DIR=/app/jobs - UPLOAD_DIR=/app/jobs/uploads - RESULTS_DIR=/app/jobs/results - DATABASE_URL=postgresql://bttoxin:bttoxin_password@bttoxin-postgres:5432/bttoxin_db - REDIS_URL=redis://bttoxin-redis:6379/0 - CELERY_BROKER_URL=redis://redis:6379/0 - CELERY_RESULT_BACKEND=redis://redis:6379/0 restart: unless-stopped depends_on: - postgres - redis networks: - frontend command: celery -A backend.app.core.celery_app worker --loglevel=info networks: frontend: external: true volumes: # Mount the existing volumes from the 'docker' project postgres_data: external: false name: bttoxin_postgres_data_v2 redis_data: external: true name: docker_redis_data