added database healthcheck, removed old test profile, implemented network segregation for containers.

This commit is contained in:
WGAVermeer
2026-04-09 10:29:53 +02:00
parent c4785455eb
commit 5490593b94

View File

@@ -3,11 +3,11 @@ services:
build: .
command: gunicorn website.wsgi:application
depends_on:
- db
db:
condition: service_healthy
environment:
ALLOWED_HOSTS: ${NGINX_HOSTNAME}
PYTHONDONTWRITEBYTECODE: 1
PYTHONUNBUFFERED: 1
DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE}
VIRTUAL_HOST: localhost
#VIRTUAL_PORT: 8000
@@ -15,6 +15,9 @@ services:
volumes:
- static_volume:/app/static
- media_volume:/app/media
networks:
- frontend
- backend
db:
@@ -26,6 +29,12 @@ services:
volumes:
- postgres_data:/var/lib/postgresql
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DBNAME}"]
interval: 5s
retries: 5
networks:
- backend
adminer:
image: adminer
@@ -33,7 +42,9 @@ services:
- db
restart: always
ports:
- 8080:8080
- 127.0.0.1:8080:8080
networks:
- backend
proxy:
image: nginx:stable
@@ -51,15 +62,12 @@ services:
- NGINX_SSL_PORT=443
depends_on:
- web
networks:
- frontend
test:
build: .
command: python manage.py test
depends_on:
- db
profiles:
- test
networks:
frontend:
backend:
volumes:
postgres_data: