DRF_Template/docker-compose.dev.yml

127 lines
2.6 KiB
YAML
Raw Permalink Normal View History

2024-01-06 12:13:39 +08:00
services:
# Django Backend
django:
env_file: .env
2024-01-06 12:13:39 +08:00
build:
context: .
dockerfile: Dockerfile
image: drf_template
2024-01-06 12:13:39 +08:00
ports:
- "${BACKEND_PORT}:${BACKEND_PORT}"
2024-01-06 12:13:39 +08:00
environment:
- PYTHONBUFFERED=1
- RUN_TYPE=web
2024-01-06 12:13:39 +08:00
volumes:
- .:/code
depends_on:
- postgres
- pgbouncer
- redis
# Django Celery Worker
celery:
env_file: .env
environment:
- RUN_TYPE=worker
image: drf_template
volumes:
- .:/code
- ./chrome:/chrome
- ./firefox:/firefox
- ./dumps:/dumps
depends_on:
- django
- postgres
- pgbouncer
- redis
# Runs multiple worker instances
scale: 4
# Django Celery Beat
celery_beat:
env_file: .env
environment:
- RUN_TYPE=beat
image: drf_template
volumes:
- .:/code
depends_on:
- django
- celery
- postgres
- pgbouncer
- redis
# Django Celery Monitor
# http://localhost:5000
celery_monitor:
env_file: .env
environment:
- RUN_TYPE=monitor
image: drf_template
ports:
- "${CELERY_FLOWER_PORT}:5555"
volumes:
- .:/code
depends_on:
- django
- celery
- 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 16:28:13 +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 16:28:13 +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/
# Email Testing Server
# http://localhost:8025
inbucket:
image: inbucket/inbucket:latest
ports:
- "8025:8025"
environment:
- INBUCKET_LOGLEVEL=error
- INBUCKET_MAILBOXNAMING=domain
- INBUCKET_SMTP_ADDR=0.0.0.0:1025
- INBUCKET_SMTP_MAXRECIPIENTS=1000
- INBUCKET_WEB_ADDR=0.0.0.0:8025
- INBUCKET_STORAGE_TYPE=memory
- INBUCKET_STORAGE_MAILBOXMSGCAP=2000
2024-01-06 12:13:39 +08:00
volumes:
db-data: