# Docker Compose configuration for BtToxin Pipeline with Traefik # This configuration removes the internal Nginx and lets Traefik handle routing # The container exposes port 8000 where FastAPI serves both API and frontend services: postgres: image: docker.m.daocloud.io/library/postgres:15-alpine container_name: bttoxin-postgres restart: unless-stopped environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=password - POSTGRES_DB=bttoxin 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 networks: - frontend bttoxin: 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: - JOBS_DIR=/app/jobs - DATABASE_URL=postgresql://postgres:password@postgres:5432/bttoxin - REDIS_URL=redis://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" networks: frontend: external: true volumes: postgres_data: # Example Traefik configuration (traefik.yml): # # services: # traefik: # image: traefik:v2.10 # command: # - "--api.insecure=true" # - "--providers.docker=true" # - "--providers.docker.exposedbydefault=false" # - "--entrypoints.web.address=:80" # - "--entrypoints.websecure.address=:443" # ports: # - "80:80" # - "443:443" # - "8080:8080" # Traefik dashboard # volumes: # - "/var/run/docker.sock:/var/run/docker.sock:ro" # networks: # - frontend # # networks: # frontend: