diff --git a/docker/compose.configure.sh b/docker/compose.configure.sh index c12123fbe3..1d6da82aa4 100755 --- a/docker/compose.configure.sh +++ b/docker/compose.configure.sh @@ -17,4 +17,4 @@ then ENV_PRIMERO_CONFIGURATION_FILE="-e PRIMERO_CONFIGURATION_FILE=/primero-configuration/${PRIMERO_CONFIGURATION_FILE}" fi -./compose.prod.sh -f docker-compose.configure.yml run --rm ${CONFIGURATION_MOUNT} ${ENV_PRIMERO_CONFIGURATION_FILE} configure primero-bootstrap +./compose.prod.sh --profile configure -f docker-compose.configure.yml run --rm ${CONFIGURATION_MOUNT} ${ENV_PRIMERO_CONFIGURATION_FILE} configure primero-bootstrap diff --git a/docker/compose.local.sh b/docker/compose.local.sh index 37793e791d..1b8240f8bd 100755 --- a/docker/compose.local.sh +++ b/docker/compose.local.sh @@ -2,4 +2,4 @@ # Copyright (c) 2014 - 2023 UNICEF. All rights reserved. set -euox -exec "./compose.sh" -f "docker-compose.db.yml" -f "docker-compose.local.yml" "${@}" +exec "./compose.sh" --profile db -f "docker-compose.db.yml" -f "docker-compose.local.yml" "${@}" diff --git a/docker/compose.prod.sh b/docker/compose.prod.sh index 81d32794d9..8fd22ca11a 100755 --- a/docker/compose.prod.sh +++ b/docker/compose.prod.sh @@ -2,11 +2,11 @@ # Copyright (c) 2014 - 2023 UNICEF. All rights reserved. : "${PRIMERO_DEPLOY_NODB:=false}" - +DB_PROFILE="" set -euox if [[ "${PRIMERO_DEPLOY_NODB}" == 'false' ]] ; then - exec "./compose.sh" -f "docker-compose.prod.yml" -f "docker-compose.db.yml" "${@}" -else - exec "./compose.sh" -f "docker-compose.prod.yml" "${@}" + DB_PROFILE="--profile db" fi + +exec "./compose.sh" ${DB_PROFILE} -f "docker-compose.prod.yml" -f "docker-compose.db.yml" "${@}" \ No newline at end of file diff --git a/docker/compose.sh b/docker/compose.sh index 8627332b0f..8887c4df04 100755 --- a/docker/compose.sh +++ b/docker/compose.sh @@ -4,4 +4,4 @@ : "${PROJECT_NAME:=primero}" set -euox -exec docker compose -p "${PROJECT_NAME}" --project-directory "../" -f "docker-compose.yml" "${@}" +exec docker compose -p "${PROJECT_NAME}" --project-directory "../" --profile app -f "docker-compose.yml" "${@}" diff --git a/docker/docker-compose.configure.yml b/docker/docker-compose.configure.yml index dec8a1dc57..7e9867c993 100644 --- a/docker/docker-compose.configure.yml +++ b/docker/docker-compose.configure.yml @@ -10,3 +10,9 @@ services: env_file: - docker/defaults.env - docker/local.env + profiles: + - configure + depends_on: + postgres: + condition: 'service_started' + required: false diff --git a/docker/docker-compose.db.yml b/docker/docker-compose.db.yml index 1fe4c6a522..db66d20e3f 100644 --- a/docker/docker-compose.db.yml +++ b/docker/docker-compose.db.yml @@ -11,11 +11,25 @@ services: - docker/defaults.env - docker/local.env restart: always + profiles: + - db application: + profiles: + - app depends_on: - - solr - - postgres + solr: + condition: 'service_started' + required: true + postgres: + condition: 'service_started' + required: false worker: + profiles: + - app depends_on: - - solr - - postgres + solr: + condition: 'service_started' + required: true + postgres: + condition: 'service_started' + required: false diff --git a/docker/docker-compose.prod.yml b/docker/docker-compose.prod.yml index 37e11694fe..31927879dc 100644 --- a/docker/docker-compose.prod.yml +++ b/docker/docker-compose.prod.yml @@ -8,6 +8,8 @@ services: ports: - "80:80" - "443:443" + profiles: + - app volumes: - 'certbot_certificates:/etc/letsencrypt' - 'certbot_challenges:/usr/share/nginx/html/.well-known/acme-challenge' diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 247acaf2b1..73fc60b17b 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -9,6 +9,8 @@ services: - docker/defaults.env volumes: - solr_cores:/var/solr + profiles: + - app restart: always application: image: '${PRIMERO_IMAGE_REPOSITORY:-primeroims}/application:${PRIMERO_TAG:-latest}' @@ -19,6 +21,8 @@ services: - storage:/srv/primero/application/storage env_file: - docker/defaults.env + profiles: + - app stdin_open: true tty: true restart: always @@ -31,6 +35,8 @@ services: env_file: - docker/defaults.env command: ["primero-worker"] + profiles: + - app restart: always volumes: database: