2024-01-06 12:13:39 +08:00
|
|
|
version: "3.9"
|
|
|
|
|
|
|
|
services:
|
2024-05-10 23:15:29 +08:00
|
|
|
# Django Backend
|
|
|
|
django:
|
|
|
|
env_file: .env
|
2024-09-15 00:21:02 +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
|
2024-05-10 23:15:29 +08:00
|
|
|
- RUN_TYPE=web
|
2024-01-06 12:13:39 +08:00
|
|
|
volumes:
|
2024-09-15 00:27:40 +08:00
|
|
|
- ./backend/static:/code/backend/static
|
2024-05-10 23:15:29 +08:00
|
|
|
depends_on:
|
|
|
|
- postgres
|
|
|
|
|
|
|
|
# Django Celery Worker
|
|
|
|
celery:
|
|
|
|
env_file: .env
|
|
|
|
environment:
|
|
|
|
- RUN_TYPE=worker
|
2024-09-15 00:21:02 +08:00
|
|
|
image: keannu125/drf_template:latest
|
2024-05-10 23:15:29 +08:00
|
|
|
depends_on:
|
|
|
|
- django
|
|
|
|
- postgres
|
|
|
|
- redis
|
2024-08-30 21:57:49 +08:00
|
|
|
# Run multiple worker instances
|
2024-05-10 23:15:29 +08:00
|
|
|
scale: 4
|
|
|
|
|
|
|
|
# Django Celery Beat
|
|
|
|
celery_beat:
|
|
|
|
env_file: .env
|
|
|
|
environment:
|
|
|
|
- RUN_TYPE=beat
|
2024-09-15 00:21:02 +08:00
|
|
|
image: keannu125/drf_template:latest
|
2024-05-10 23:15:29 +08:00
|
|
|
depends_on:
|
|
|
|
- celery
|
|
|
|
- django
|
|
|
|
- postgres
|
|
|
|
- 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
|
2024-05-10 23:15:29 +08:00
|
|
|
|
2024-09-05 13:16:23 +08:00
|
|
|
# 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
|
2024-09-05 13:16:23 +08:00
|
|
|
depends_on:
|
|
|
|
- postgres
|
|
|
|
|
2024-05-10 23:15:29 +08:00
|
|
|
# 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:
|
2024-05-10 23:15:29 +08:00
|
|
|
db-data:
|