From 42d69cef4e397149f1d1b2cbb0ae37466af3dcb1 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 11 Jan 2022 14:40:16 +0100 Subject: [PATCH] Uniform dktk and c4 docker-compose files --- c4/docker-compose.yml | 12 ++++++------ dktk/docker-compose.yml | 8 ++++---- install-bridgehead.sh | 15 ++++++--------- update-bridgehead.sh | 16 ++++++---------- 4 files changed, 22 insertions(+), 29 deletions(-) diff --git a/c4/docker-compose.yml b/c4/docker-compose.yml index 43a3169..584dfb5 100644 --- a/c4/docker-compose.yml +++ b/c4/docker-compose.yml @@ -61,7 +61,7 @@ services: - "connector-db" connector_db: - container_name: bridgehead_connector_db + container_name: bridgehead_c4_connector_db image: postgres:10.17 environment: POSTGRES_HOST: ${CONNECTOR_DB_HOST} @@ -79,7 +79,7 @@ services: idmanager: - container_name: bridgehead-idmanager + container_name: bridgehead_c4_idmanager image: docker.verbis.dkfz.de/pseudonymisierung/magicpl:0.2.0-RC23 environment: MAGICPL_MAINZELLISTE_URL: ${MAGICPL_MAINZELLISTE_URL} @@ -111,7 +111,7 @@ services: - "samply" patientlist: - container_name: bridgehead-patientlist + container_name: bridgehead_c4_patientlist image: medicalinformatics/mainzelliste:develop environment: ML_DB_DRIVER: org.postgresql.Driver @@ -140,7 +140,7 @@ services: - "samply" patientlist_db: - container_name: bridgehead_patientlist_db + container_name: bridgehead_c4_patientlist_db image: postgres:13.1-alpine environment: POSTGRES_DB: ${ML_DB_NAME} @@ -153,7 +153,7 @@ services: - "samply" store: - container_name: bridgeheadstore + container_name: bridgehead_c4_store image: docker.verbis.dkfz.de/ccp/samply.store:release-5.1.2 environment: MDR_URL: ${CCP_MDR_URL} @@ -176,7 +176,7 @@ services: - "samply" store_db: - container_name: bridgehead_store_db + container_name: bridgehead_c4_store_db image: postgres:9.5-alpine command: postgres -c datestyle='iso, dmy' environment: diff --git a/dktk/docker-compose.yml b/dktk/docker-compose.yml index b26c6b2..c8ef8fd 100644 --- a/dktk/docker-compose.yml +++ b/dktk/docker-compose.yml @@ -60,7 +60,7 @@ services: - "connector-db" connector_db: - container_name: bridgehead_connector_db + container_name: bridgehead_dktk_connector_db image: postgres:10.17 environment: POSTGRES_HOST: ${CONNECTOR_DB_HOST} @@ -76,7 +76,7 @@ services: idmanager: - container_name: bridgehead-idmanager + container_name: bridgehead_dktk_idmanager image: docker.verbis.dkfz.de/pseudonymisierung/magicpl:0.2.0-RC23 environment: MAGICPL_MAINZELLISTE_URL: ${MAGICPL_MAINZELLISTE_URL} @@ -108,7 +108,7 @@ services: - "samply" patientlist: - container_name: bridgehead-patientlist + container_name: bridgehead_dktk_patientlist image: medicalinformatics/mainzelliste:develop environment: ML_DB_DRIVER: org.postgresql.Driver @@ -137,7 +137,7 @@ services: - "samply" patientlist_db: - container_name: bridgehead_patientlist_db + container_name: bridgehead_dktk_patientlist_db image: postgres:13.1-alpine environment: POSTGRES_DB: ${ML_DB_NAME} diff --git a/install-bridgehead.sh b/install-bridgehead.sh index 24c86cf..d360453 100755 --- a/install-bridgehead.sh +++ b/install-bridgehead.sh @@ -6,32 +6,29 @@ source lib/functions.sh exitIfNotRoot if ! ./lib/prerequisites.sh; then - echo "Prerequisites failed, exiting" + log "Prerequisites failed, exiting" exit 1 fi source site.conf -_systemd_path=/etc/systemd/system/ - - -echo -e "\nInstalling systemd units ..." +log -e "\nInstalling systemd units ..." cp -v \ lib/systemd/bridgehead\@.service \ lib/systemd/bridgehead-update\@.service \ lib/systemd/bridgehead-update\@.timer \ - $_systemd_path + /etc/systemd/system/ systemctl daemon-reload echo if ! systemctl is-active --quiet bridgehead@"${project}"; then - echo "Enabling autostart of bridgehead@${project}.service" + log "Enabling autostart of bridgehead@${project}.service" systemctl enable bridgehead@"${project}" - echo "Enabling nightly updates for bridgehead@${project}.service ..." + log "Enabling nightly updates for bridgehead@${project}.service ..." systemctl enable --now bridgehead-update@"${project}".timer fi -echo -e "\nDone - now start your bridgehead by running\n\tsystemctl start bridgehead@${project}.service\nor by rebooting your machine." +log -e "\nDone - now start your bridgehead by running\n\tsystemctl start bridgehead@${project}.service\nor by rebooting your machine." # TODO: Configuration of the different modules diff --git a/update-bridgehead.sh b/update-bridgehead.sh index 2af6156..b00e376 100755 --- a/update-bridgehead.sh +++ b/update-bridgehead.sh @@ -3,18 +3,14 @@ service="bridgehead" source lib/functions.sh +if ! ./prerequisites.sh; then + log "Prerequisites failed, exiting" + exit +fi + log "INFO" "Checking for updates of $service" # check prerequisites -##TODO: Move to lib/prereq.sh -prerequisites="git docker docker-compose" -for prerequisite in $prerequisites; do - $prerequisite --version 2>&1 - is_available=$? - if [ $is_available -gt 0 ]; then - log "ERROR" "Prerequisite not fulfilled - $prerequisite is not available!" - exit 79 - fi -done + # check if updates are available old_git_hash="$(git rev-parse --verify HEAD)" git fetch 2>&1