mirror of
https://github.com/lemeow125/DRF_Template.git
synced 2025-08-02 17:23:16 +08:00
Update deployment
This commit is contained in:
parent
2770ac035d
commit
aa9d67fdba
5 changed files with 59 additions and 40 deletions
80
docker-compose.yml
Normal file
80
docker-compose.yml
Normal file
|
@ -0,0 +1,80 @@
|
|||
services:
|
||||
# Django Backend
|
||||
django:
|
||||
env_file: .env
|
||||
image: git.06222001.xyz/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: git.06222001.xyz/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: git.06222001.xyz/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:
|
Loading…
Add table
Add a link
Reference in a new issue