Split production dependecies & update production configuration

This commit is contained in:
Sonny Bakker 2023-06-28 19:38:44 +02:00
parent 0f66c5eb9b
commit 5a73707d61
12 changed files with 68 additions and 111 deletions

View file

@ -4,6 +4,7 @@ volumes:
logs:
media:
postgres-data:
static-files:
services:
db:
@ -13,6 +14,7 @@ services:
interval: 5s
timeout: 10s
retries: 10
env_file: ./.env
volumes:
- postgres-data:/var/lib/postgresql/data
@ -29,6 +31,15 @@ services:
build:
context: .
dockerfile: ./docker/django
target: production
args:
POSTGRES_HOST:
POSTGRES_PORT:
POSTGRES_DB:
POSTGRES_USER:
POSTGRES_PASSWORD:
DJANGO_SECRET_KEY:
DJANGO_SETTINGS_MODULE: "newsreader.conf.production"
command: |
celery worker -n worker1@%h
-n worker2@%h
@ -57,16 +68,26 @@ services:
context: .
dockerfile: ./docker/django
target: production
args:
POSTGRES_HOST:
POSTGRES_PORT:
POSTGRES_DB:
POSTGRES_USER:
POSTGRES_PASSWORD:
DJANGO_SECRET_KEY:
DJANGO_SETTINGS_MODULE: "newsreader.conf.production"
entrypoint: /app/bin/docker-entrypoint.sh
command: |
gunicorn --bind 0.0.0.0:8000
--workers 3
--chdir /app/src/
newsreader.wsgi:application
healthcheck:
test: /usr/bin/curl --fail http://django:8000 || exit 1
interval: 30s
timeout: 10s
retries: 10
env_file: ./.env
environment:
- DJANGO_SETTINGS_MODULE=newsreader.conf.production
depends_on:
@ -77,3 +98,4 @@ services:
volumes:
- logs:/app/logs
- media:/app/media
- static-files:/app/static