DRF_Template/docker-compose.demo.yml

81 lines
1.7 KiB
YAML
Raw Normal View History

2024-01-06 12:13:39 +08:00
services:
# Django Backend
django:
env_file: .env
2024-09-15 00:32:01 +08:00
image: keannu125/drf-template:latest
2024-01-06 12:13:39 +08:00
ports:
2024-08-30 21:57:49 +08:00
- "${BACKEND_PORT}:8000"
2024-01-06 12:13:39 +08:00
environment:
- PYTHONBUFFERED=1
- RUN_TYPE=web
depends_on:
- postgres
- pgbouncer
# Django Celery Worker
celery:
env_file: .env
environment:
- RUN_TYPE=worker
2024-09-15 00:32:01 +08:00
image: keannu125/drf-template:latest
depends_on:
- django
- postgres
- pgbouncer
- redis
2024-08-30 21:57:49 +08:00
# Run multiple worker instances
scale: 4
# Django Celery Beat
celery_beat:
env_file: .env
environment:
- RUN_TYPE=beat
2024-09-15 00:32:01 +08:00
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
2024-09-05 15:00:00 +08:00
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}
2024-09-05 15:00:00 +08:00
- 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/
2024-01-06 12:13:39 +08:00
volumes:
db-data: