From 969469db04c556c96c259e5eeeff5e526b71188b Mon Sep 17 00:00:00 2001
From: "p.delpy@dkfz-heidelberg.de"
Date: Tue, 14 Feb 2023 10:20:19 +0100
Subject: [PATCH] beautiful config
---
ccp/modules/exliquid-setup.sh | 32 ++++++++++++++----------------
ccp/modules/exporter-setup.sh | 14 ++++++-------
ccp/modules/id-management-setup.sh | 31 ++++++++++++++---------------
ccp/modules/mtba-setup.sh | 19 ++++++++----------
ccp/modules/nngm-compose.yml | 4 ++--
ccp/modules/nngm-setup.sh | 12 +++++------
ccp/modules/teiler-ui-setup.sh | 12 +++++------
ccp/vars | 19 +++++-------------
8 files changed, 61 insertions(+), 82 deletions(-)
diff --git a/ccp/modules/exliquid-setup.sh b/ccp/modules/exliquid-setup.sh
index e8a8425..039d26d 100644
--- a/ccp/modules/exliquid-setup.sh
+++ b/ccp/modules/exliquid-setup.sh
@@ -1,19 +1,17 @@
#!/bin/bash
-function exliquidSetup() {
- case ${SITE_ID} in
- berlin|dresden|essen|frankfurt|freiburg|luebeck|mainz|muenchen-lmu|muenchen-tu|mannheim|tuebingen)
- EXLIQUID=1
- ;;
- dktk-test)
- EXLIQUID=1
- ;;
- *)
- EXLIQUID=0
- ;;
- esac
- if [[ $EXLIQUID -eq 1 ]]; then
- log INFO "EXLIQUID setup detected -- will start Report-Hub."
- OVERRIDE+=" -f ./$PROJECT/modules/exliquid-compose.yml"
- fi
-}
+case ${SITE_ID} in
+ berlin|dresden|essen|frankfurt|freiburg|luebeck|mainz|muenchen-lmu|muenchen-tu|mannheim|tuebingen)
+ EXLIQUID=1
+ ;;
+ dktk-test)
+ EXLIQUID=1
+ ;;
+ *)
+ EXLIQUID=0
+ ;;
+esac
+if [[ $EXLIQUID -eq 1 ]]; then
+ log INFO "EXLIQUID setup detected -- will start Report-Hub."
+ OVERRIDE+=" -f ./$PROJECT/modules/exliquid-compose.yml"
+fi
diff --git a/ccp/modules/exporter-setup.sh b/ccp/modules/exporter-setup.sh
index 090d23c..044116b 100644
--- a/ccp/modules/exporter-setup.sh
+++ b/ccp/modules/exporter-setup.sh
@@ -1,10 +1,8 @@
#!/bin/bash
-function exporterSetup() {
- if [ -n "$ENABLE_EXPORTER" ];then
- log INFO "Exporter setup detected -- will start Exporter service."
- OVERRIDE+=" -f ./$PROJECT/modules/exporter-compose.yml"
- fi
- # TODO: Generate password in another way so that not all passwords are the same?
- EXPORTER_DB_PASSWORD="$(echo \"This is a salt string to generate one consistent password. It is not required to be secret.\" | openssl rsautl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)"
-}
+if [ -n "$ENABLE_EXPORTER" ];then
+ log INFO "Exporter setup detected -- will start Exporter service."
+ OVERRIDE+=" -f ./$PROJECT/modules/exporter-compose.yml"
+fi
+# TODO: Generate password in another way so that not all passwords are the same?
+EXPORTER_DB_PASSWORD="$(echo \"This is a salt string to generate one consistent password. It is not required to be secret.\" | openssl rsautl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)"
diff --git a/ccp/modules/id-management-setup.sh b/ccp/modules/id-management-setup.sh
index ba8ad45..5556b21 100644
--- a/ccp/modules/id-management-setup.sh
+++ b/ccp/modules/id-management-setup.sh
@@ -1,21 +1,5 @@
#!/bin/bash
-function idManagementSetup() {
- if [ -n "$IDMANAGER_UPLOAD_APIKEY" ]; then
- log INFO "id-management setup detected -- will start id-management (mainzelliste & magicpl)."
- OVERRIDE+=" -f ./$PROJECT/modules/id-management-compose.yml"
-
- # Auto Generate local Passwords
- PATIENTLIST_POSTGRES_PASSWORD="$(echo \"id-management-module-db-password-salt\" | openssl rsautl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)"
- IDMANAGER_LOCAL_PATIENTLIST_APIKEY="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
-
- # Transform Seeds Configuration to pass it to the Mainzelliste Container
- PATIENTLIST_SEEDS_TRANSFORMED="$(declare -p PATIENTLIST_SEEDS | tr -d '\"' | sed 's/\[/\[\"/g' | sed 's/\]/\"\]/g')"
-
- # Ensure old ids are working !!!
- export IDMANAGEMENT_FRIENDLY_ID=$(legacyIdMapping "$SITE_ID")
- fi
-}
# Transform into single string array, e.g. 'dktk-test' to 'dktk test'
# Usage: transformToSingleStringArray 'dktk-test' -> 'dktk test'
@@ -50,3 +34,18 @@ function legacyIdMapping() {
normalized_string=$(applySpecialCases "$uppercase_string");
echo "$normalized_string" | tr -d ' '
}
+
+if [ -n "$IDMANAGER_UPLOAD_APIKEY" ]; then
+ log INFO "id-management setup detected -- will start id-management (mainzelliste & magicpl)."
+ OVERRIDE+=" -f ./$PROJECT/modules/id-management-compose.yml"
+
+ # Auto Generate local Passwords
+ PATIENTLIST_POSTGRES_PASSWORD="$(echo \"id-management-module-db-password-salt\" | openssl rsautl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)"
+ IDMANAGER_LOCAL_PATIENTLIST_APIKEY="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
+
+ # Transform Seeds Configuration to pass it to the Mainzelliste Container
+ PATIENTLIST_SEEDS_TRANSFORMED="$(declare -p PATIENTLIST_SEEDS | tr -d '\"' | sed 's/\[/\[\"/g' | sed 's/\]/\"\]/g')"
+
+ # Ensure old ids are working !!!
+ export IDMANAGEMENT_FRIENDLY_ID=$(legacyIdMapping "$SITE_ID")
+fi
diff --git a/ccp/modules/mtba-setup.sh b/ccp/modules/mtba-setup.sh
index 756f5ff..17e67c9 100644
--- a/ccp/modules/mtba-setup.sh
+++ b/ccp/modules/mtba-setup.sh
@@ -1,13 +1,10 @@
#!/bin/bash
-function mtbaSetup() {
- # TODO: Check if ID-Management Module is activated!
- if [ -n "$ENABLE_MTBA" ];then
- log INFO "MTBA setup detected -- will start MTBA Service and CBioPortal."
- if [ ! -n "$IDMANAGER_UPLOAD_APIKEY" ]; then
- log ERROR "Detected MTBA Module configuration but ID-Management Module seems not to be configured!"
- exit 1;
- fi
- OVERRIDE+=" -f ./$PROJECT/modules/mtba-compose.yml"
- fi
-}
+if [ -n "$ENABLE_MTBA" ];then
+ log INFO "MTBA setup detected -- will start MTBA Service and CBioPortal."
+ if [ ! -n "$IDMANAGER_UPLOAD_APIKEY" ]; then
+ log ERROR "Detected MTBA Module configuration but ID-Management Module seems not to be configured!"
+ exit 1;
+ fi
+ OVERRIDE+=" -f ./$PROJECT/modules/mtba-compose.yml"
+fi
diff --git a/ccp/modules/nngm-compose.yml b/ccp/modules/nngm-compose.yml
index c212fed..3e3ab96 100644
--- a/ccp/modules/nngm-compose.yml
+++ b/ccp/modules/nngm-compose.yml
@@ -2,7 +2,7 @@ version: "3.7"
services:
connector:
- container_name: bridgehead-connector
+ container_name: bridgehead-nngm-connector
image: docker.verbis.dkfz.de/ccp/connector:bk2
environment:
POSTGRES_PASSWORD: ${CONNECTOR_POSTGRES_PASSWORD}
@@ -19,7 +19,7 @@ services:
connector_db:
image: postgres:9.5-alpine
- container_name: bridgehead-ccp-connector-db
+ container_name: bridgehead-nngm-connector-db
volumes:
- "connector_db_data:/var/lib/postgresql/data"
environment:
diff --git a/ccp/modules/nngm-setup.sh b/ccp/modules/nngm-setup.sh
index f9bbc1b..d7784a6 100644
--- a/ccp/modules/nngm-setup.sh
+++ b/ccp/modules/nngm-setup.sh
@@ -1,9 +1,7 @@
#!/bin/bash
-function nngmSetup() {
- if [ -n "$NNGM_CTS_APIKEY" ]; then
- log INFO "nNGM setup detected -- will start nNGM Connector."
- OVERRIDE+=" -f ./$PROJECT/modules/nngm-compose.yml"
- fi
- CONNECTOR_POSTGRES_PASSWORD="$(echo \"This is a salt string to generate one consistent password. It is not required to be secret.\" | openssl rsautl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)"
-}
+if [ -n "$NNGM_CTS_APIKEY" ]; then
+ log INFO "nNGM setup detected -- will start nNGM Connector."
+ OVERRIDE+=" -f ./$PROJECT/modules/nngm-compose.yml"
+fi
+CONNECTOR_POSTGRES_PASSWORD="$(echo \"This is a salt string to generate one consistent password. It is not required to be secret.\" | openssl rsautl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)"
diff --git a/ccp/modules/teiler-ui-setup.sh b/ccp/modules/teiler-ui-setup.sh
index 1ff6f3b..dc755ba 100644
--- a/ccp/modules/teiler-ui-setup.sh
+++ b/ccp/modules/teiler-ui-setup.sh
@@ -1,9 +1,7 @@
#!/bin/bash
-function teilerUiSetup() {
- if [ -n "$ENABLE_TEILER" ];then
- log INFO "Teiler-UI setup detected -- will start Teiler-UI services."
- OVERRIDE+=" -f ./$PROJECT/modules/teiler-ui-compose.yml"
- fi
- KEYCLOAK_DB_PASSWORD="$(echo \"This is a salt string to generate one consistent password. It is not required to be secret.\" | openssl rsautl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)"
-}
+if [ "$ENABLE_TEILER" == true ];then
+ log INFO "Teiler-UI setup detected -- will start Teiler-UI services."
+ OVERRIDE+=" -f ./$PROJECT/modules/teiler-ui-compose.yml"
+fi
+KEYCLOAK_DB_PASSWORD="$(echo \"This is a salt string to generate one consistent password. It is not required to be secret.\" | openssl rsautl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)"
diff --git a/ccp/vars b/ccp/vars
index 9fb7570..3cdc10a 100644
--- a/ccp/vars
+++ b/ccp/vars
@@ -8,17 +8,8 @@ REPORTHUB_BEAM_SECRET_LONG="ApiKey report-hub.${PROXY_ID} ${REPORTHUB_BEAM_SECRE
SUPPORT_EMAIL=support-ccp@dkfz-heidelberg.de
PRIVATEKEYFILENAME=/etc/bridgehead/pki/${SITE_ID}.priv.pem
-# This will load id-management setup. Effective only if id-management configuration is defined.
-source $PROJECT/modules/id-management-setup.sh
-idManagementSetup
-# This will load nngm setup. Effective only if nngm configuration is defined.
-source $PROJECT/modules/nngm-setup.sh
-nngmSetup
-source $PROJECT/modules/exliquid-setup.sh
-exliquidSetup
-source $PROJECT/modules/mtba-setup.sh
-mtbaSetup
-source $PROJECT/modules/exporter-setup.sh
-exporterSetup
-source $PROJECT/modules/teiler-ui-setup.sh
-teilerUiSetup
+for module in $PROJECT/modules/*.sh
+do
+ log INFO "sourcing $module"
+ source $module
+done