From e23d2b6372ac03f0c0293f6cbb1c1cad59b0bc35 Mon Sep 17 00:00:00 2001 From: kiblik Date: Mon, 11 Sep 2023 11:46:06 +0200 Subject: [PATCH] Docker-compose: use variables for depends_on (#8598) --- docker-compose.yml | 17 ++++++----------- docker/environments/mysql-rabbitmq.env | 3 +++ docker/environments/mysql-redis.env | 3 +++ docker/environments/postgres-rabbitmq.env | 3 +++ docker/environments/postgres-redis.env | 3 +++ 5 files changed, 18 insertions(+), 11 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 6f3a5f57f96..dc198450e0e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,8 +45,7 @@ services: - postgres-rabbitmq - postgres-redis depends_on: - - mysql - - postgres + - ${DD_DOCKERCOMPOSE_DATABASE} entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST}:${DD_DATABASE_PORT}', '-t', '30', '--', '/entrypoint-uwsgi.sh'] environment: DD_DEBUG: 'False' @@ -69,9 +68,8 @@ services: - postgres-rabbitmq - postgres-redis depends_on: - - mysql - - postgres - - rabbitmq + - ${DD_DOCKERCOMPOSE_DATABASE} + - ${DD_DOCKERCOMPOSE_BROKER} entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST}:${DD_DATABASE_PORT}', '-t', '30', '--', '/entrypoint-celery-beat.sh'] environment: DD_DATABASE_URL: ${DD_DATABASE_URL} @@ -90,10 +88,8 @@ services: - postgres-rabbitmq - postgres-redis depends_on: - - mysql - - postgres - - rabbitmq - - redis + - ${DD_DOCKERCOMPOSE_DATABASE} + - ${DD_DOCKERCOMPOSE_BROKER} entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST}:${DD_DATABASE_PORT}', '-t', '30', '--', '/entrypoint-celery-worker.sh'] environment: DD_DATABASE_URL: ${DD_DATABASE_URL} @@ -113,8 +109,7 @@ services: - postgres-rabbitmq - postgres-redis depends_on: - - mysql - - postgres + - ${DD_DOCKERCOMPOSE_DATABASE} entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST}:${DD_DATABASE_PORT}', '--', '/entrypoint-initializer.sh'] environment: DD_DATABASE_URL: ${DD_DATABASE_URL} diff --git a/docker/environments/mysql-rabbitmq.env b/docker/environments/mysql-rabbitmq.env index 5d166d0a197..0b41a9a5d3d 100644 --- a/docker/environments/mysql-rabbitmq.env +++ b/docker/environments/mysql-rabbitmq.env @@ -12,3 +12,6 @@ DD_TEST_DATABASE_NAME=test_defectdojo DD_TEST_DATABASE_URL=mysql://defectdojo:defectdojo@mysql:3306/test_defectdojo?charset=utf8mb4 DD_CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672// + +DD_DOCKERCOMPOSE_DATABASE=mysql +DD_DOCKERCOMPOSE_BROKER=rabbitmq diff --git a/docker/environments/mysql-redis.env b/docker/environments/mysql-redis.env index 4ea8ab92edd..0d1ee431b37 100644 --- a/docker/environments/mysql-redis.env +++ b/docker/environments/mysql-redis.env @@ -11,3 +11,6 @@ DD_TEST_DATABASE_NAME=test_defectdojo DD_TEST_DATABASE_URL=mysql://defectdojo:defectdojo@mysql:3306/test_defectdojo?charset=utf8mb4 DD_CELERY_BROKER_URL=redis://redis:6379/0 + +DD_DOCKERCOMPOSE_DATABASE=mysql +DD_DOCKERCOMPOSE_BROKER=redis diff --git a/docker/environments/postgres-rabbitmq.env b/docker/environments/postgres-rabbitmq.env index 77922a1e087..28e0c16b91b 100644 --- a/docker/environments/postgres-rabbitmq.env +++ b/docker/environments/postgres-rabbitmq.env @@ -11,3 +11,6 @@ DD_TEST_DATABASE_NAME=test_defectdojo DD_TEST_DATABASE_URL=postgresql://defectdojo:defectdojo@postgres:5432/test_defectdojo DD_CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672// + +DD_DOCKERCOMPOSE_DATABASE=postgres +DD_DOCKERCOMPOSE_BROKER=rabbitmq diff --git a/docker/environments/postgres-redis.env b/docker/environments/postgres-redis.env index 0fe157ea00d..defb62374bf 100644 --- a/docker/environments/postgres-redis.env +++ b/docker/environments/postgres-redis.env @@ -11,3 +11,6 @@ DD_TEST_DATABASE_NAME=test_defectdojo DD_TEST_DATABASE_URL=postgresql://defectdojo:defectdojo@postgres:5432/test_defectdojo DD_CELERY_BROKER_URL=redis://redis:6379/0 + +DD_DOCKERCOMPOSE_DATABASE=postgres +DD_DOCKERCOMPOSE_BROKER=redis