services: # Django Backend django: env_file: .env image: keannu125/drf-template:latest ports: - "${BACKEND_PORT}:8000" environment: - PYTHONBUFFERED=1 - RUN_TYPE=web depends_on: - postgres - pgbouncer # Django Celery Worker celery: env_file: .env environment: - RUN_TYPE=worker image: keannu125/drf-template:latest depends_on: - django - postgres - pgbouncer - redis # Run multiple worker instances scale: 4 # Django Celery Beat celery_beat: env_file: .env environment: - RUN_TYPE=beat image: keannu125/drf-template:latest depends_on: - celery - django - postgres - pgbouncer - redis # SQL Database postgres: env_file: .env image: postgres environment: - POSTGRES_DB=${DB_DATABASE} - POSTGRES_USER=${DB_USERNAME} - POSTGRES_PASSWORD=${DB_PASSWORD} volumes: - db-data:/var/lib/postgresql/data command: postgres -c max_connections=200 # DB Bouncer pgbouncer: image: bitnami/pgbouncer:latest environment: - POSTGRESQL_HOST=postgres - PGBOUNCER_DATABASE=${DB_DATABASE} - POSTGRESQL_USERNAME=${DB_USERNAME} - POSTGRESQL_PASSWORD=${DB_PASSWORD} - PGBOUNCER_MAX_DB_CONNECTIONS=200 depends_on: - postgres # Redis Server redis: image: redis:latest # Stripe CLI Webhook Listener stripe-listener: env_file: .env image: stripe/stripe-cli:latest environment: - STRIPE_WEBHOOK_SECRET=${STRIPE_SECRET_WEBHOOK} - STRIPE_API_KEY=${STRIPE_SECRET_KEY} command: listen --forward-to django:8000/api/v1/stripe/webhook/ volumes: db-data: