Skip to content

Commit

Permalink
Merged in r2-2916-fix-ansible-deploy (pull request #6847)
Browse files Browse the repository at this point in the history
R2-2916 - Implementing docker compose profiles
  • Loading branch information
aespinoza-quoin authored and pnabutovsky committed Jun 27, 2024
2 parents 6f3e4f9 + 9f638a2 commit 9424105
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docker/compose.configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion docker/compose.local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" "${@}"
8 changes: 4 additions & 4 deletions docker/compose.prod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" "${@}"
2 changes: 1 addition & 1 deletion docker/compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" "${@}"
6 changes: 6 additions & 0 deletions docker/docker-compose.configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ services:
env_file:
- docker/defaults.env
- docker/local.env
profiles:
- configure
depends_on:
postgres:
condition: 'service_started'
required: false
22 changes: 18 additions & 4 deletions docker/docker-compose.db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions docker/docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
6 changes: 6 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}'
Expand All @@ -19,6 +21,8 @@ services:
- storage:/srv/primero/application/storage
env_file:
- docker/defaults.env
profiles:
- app
stdin_open: true
tty: true
restart: always
Expand All @@ -31,6 +35,8 @@ services:
env_file:
- docker/defaults.env
command: ["primero-worker"]
profiles:
- app
restart: always
volumes:
database:
Expand Down

0 comments on commit 9424105

Please sign in to comment.