services: # Django Backend django: env_file: .env build: context: . dockerfile: Dockerfile image: drf_template ports: - "${BACKEND_PORT}:${BACKEND_PORT}" environment: - PYTHONBUFFERED=1 - RUN_TYPE=web 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 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/ # 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 volumes: db-data: