mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2024-11-17 04:09:25 +08:00
81 lines
1.7 KiB
YAML
81 lines
1.7 KiB
YAML
version: "3.9"
|
|
|
|
services:
|
|
# Django Backend
|
|
django:
|
|
env_file: .env
|
|
image: keannu125/drf_template:latest
|
|
ports:
|
|
- "${BACKEND_PORT}:8000"
|
|
environment:
|
|
- PYTHONBUFFERED=1
|
|
- RUN_TYPE=web
|
|
volumes:
|
|
- ./backend/static:/code/backend/static
|
|
depends_on:
|
|
- postgres
|
|
|
|
# Django Celery Worker
|
|
celery:
|
|
env_file: .env
|
|
environment:
|
|
- RUN_TYPE=worker
|
|
image: keannu125/drf_template:latest
|
|
depends_on:
|
|
- django
|
|
- postgres
|
|
- 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
|
|
- 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:
|