added database healthcheck, removed old test profile, implemented network segregation for containers.
This commit is contained in:
32
compose.yaml
32
compose.yaml
@@ -3,11 +3,11 @@ services:
|
|||||||
build: .
|
build: .
|
||||||
command: gunicorn website.wsgi:application
|
command: gunicorn website.wsgi:application
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
ALLOWED_HOSTS: ${NGINX_HOSTNAME}
|
ALLOWED_HOSTS: ${NGINX_HOSTNAME}
|
||||||
PYTHONDONTWRITEBYTECODE: 1
|
|
||||||
PYTHONUNBUFFERED: 1
|
|
||||||
DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE}
|
DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE}
|
||||||
VIRTUAL_HOST: localhost
|
VIRTUAL_HOST: localhost
|
||||||
#VIRTUAL_PORT: 8000
|
#VIRTUAL_PORT: 8000
|
||||||
@@ -15,6 +15,9 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- static_volume:/app/static
|
- static_volume:/app/static
|
||||||
- media_volume:/app/media
|
- media_volume:/app/media
|
||||||
|
networks:
|
||||||
|
- frontend
|
||||||
|
- backend
|
||||||
|
|
||||||
|
|
||||||
db:
|
db:
|
||||||
@@ -26,6 +29,12 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql
|
- postgres_data:/var/lib/postgresql
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DBNAME}"]
|
||||||
|
interval: 5s
|
||||||
|
retries: 5
|
||||||
|
networks:
|
||||||
|
- backend
|
||||||
|
|
||||||
adminer:
|
adminer:
|
||||||
image: adminer
|
image: adminer
|
||||||
@@ -33,7 +42,9 @@ services:
|
|||||||
- db
|
- db
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080
|
- 127.0.0.1:8080:8080
|
||||||
|
networks:
|
||||||
|
- backend
|
||||||
|
|
||||||
proxy:
|
proxy:
|
||||||
image: nginx:stable
|
image: nginx:stable
|
||||||
@@ -51,15 +62,12 @@ services:
|
|||||||
- NGINX_SSL_PORT=443
|
- NGINX_SSL_PORT=443
|
||||||
depends_on:
|
depends_on:
|
||||||
- web
|
- web
|
||||||
|
networks:
|
||||||
|
- frontend
|
||||||
|
|
||||||
test:
|
networks:
|
||||||
build: .
|
frontend:
|
||||||
command: python manage.py test
|
backend:
|
||||||
depends_on:
|
|
||||||
- db
|
|
||||||
profiles:
|
|
||||||
- test
|
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|||||||
Reference in New Issue
Block a user