Skip to content

Commit 5f73636

Browse files
committed
feat(docker): Depends_on based on initializer
1 parent 469ca7b commit 5f73636

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

docker-compose.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ services:
1313
dockerfile: "Dockerfile.nginx-${DEFECT_DOJO_OS:-debian}"
1414
image: "defectdojo/defectdojo-nginx:${NGINX_VERSION:-latest}"
1515
depends_on:
16-
- uwsgi
16+
uwsgi:
17+
condition: service_started
1718
environment:
1819
NGINX_METRICS_ENABLED: "${NGINX_METRICS_ENABLED:-false}"
1920
DD_UWSGI_HOST: "${DD_UWSGI_HOST:-uwsgi}"
@@ -36,7 +37,12 @@ services:
3637
target: django
3738
image: "defectdojo/defectdojo-django:${DJANGO_VERSION:-latest}"
3839
depends_on:
39-
- postgres
40+
# initializer:
41+
# condition: service_completed_successfully
42+
postgres:
43+
condition: service_started
44+
redis:
45+
condition: service_started
4046
entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST:-postgres}:${DD_DATABASE_PORT:-5432}', '-t', '30', '--', '/entrypoint-uwsgi.sh']
4147
environment:
4248
DD_DEBUG: 'False'
@@ -55,8 +61,12 @@ services:
5561
celerybeat:
5662
image: "defectdojo/defectdojo-django:${DJANGO_VERSION:-latest}"
5763
depends_on:
58-
- postgres
59-
- redis
64+
initializer:
65+
condition: service_completed_successfully
66+
postgres:
67+
condition: service_started
68+
redis:
69+
condition: service_started
6070
entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST:-postgres}:${DD_DATABASE_PORT:-5432}', '-t', '30', '--', '/entrypoint-celery-beat.sh']
6171
environment:
6272
DD_DATABASE_URL: ${DD_DATABASE_URL:-postgresql://defectdojo:defectdojo@postgres:5432/defectdojo}
@@ -71,8 +81,12 @@ services:
7181
celeryworker:
7282
image: "defectdojo/defectdojo-django:${DJANGO_VERSION:-latest}"
7383
depends_on:
74-
- postgres
75-
- redis
84+
initializer:
85+
condition: service_completed_successfully
86+
postgres:
87+
condition: service_started
88+
redis:
89+
condition: service_started
7690
entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST:-postgres}:${DD_DATABASE_PORT:-5432}', '-t', '30', '--', '/entrypoint-celery-worker.sh']
7791
environment:
7892
DD_DATABASE_URL: ${DD_DATABASE_URL:-postgresql://defectdojo:defectdojo@postgres:5432/defectdojo}
@@ -88,7 +102,8 @@ services:
88102
initializer:
89103
image: "defectdojo/defectdojo-django:${DJANGO_VERSION:-latest}"
90104
depends_on:
91-
- postgres
105+
postgres:
106+
condition: service_started
92107
entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST:-postgres}:${DD_DATABASE_PORT:-5432}', '--', '/entrypoint-initializer.sh']
93108
environment:
94109
DD_DATABASE_URL: ${DD_DATABASE_URL:-postgresql://defectdojo:defectdojo@postgres:5432/defectdojo}
@@ -112,6 +127,7 @@ services:
112127
POSTGRES_PASSWORD: ${DD_DATABASE_PASSWORD:-defectdojo}
113128
volumes:
114129
- defectdojo_postgres:/var/lib/postgresql/data
130+
- ./psql_bck:/psql_bck
115131
redis:
116132
# Pinning to this version due to licensing constraints
117133
image: redis:7.2.9-alpine@sha256:fce236b99c58ef7196c4e243e43f533b404d5c17239cae4e6e262b729a1952b3

psql_bck/db.dump

697 KB
Binary file not shown.

0 commit comments

Comments
 (0)