beautiful config

This commit is contained in:
p.delpy@dkfz-heidelberg.de 2023-02-14 10:20:19 +01:00
parent 82f6f886db
commit 969469db04
8 changed files with 61 additions and 82 deletions

View File

@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
function exliquidSetup() { case ${SITE_ID} in
case ${SITE_ID} in
berlin|dresden|essen|frankfurt|freiburg|luebeck|mainz|muenchen-lmu|muenchen-tu|mannheim|tuebingen) berlin|dresden|essen|frankfurt|freiburg|luebeck|mainz|muenchen-lmu|muenchen-tu|mannheim|tuebingen)
EXLIQUID=1 EXLIQUID=1
;; ;;
@ -11,9 +10,8 @@ function exliquidSetup() {
*) *)
EXLIQUID=0 EXLIQUID=0
;; ;;
esac esac
if [[ $EXLIQUID -eq 1 ]]; then if [[ $EXLIQUID -eq 1 ]]; then
log INFO "EXLIQUID setup detected -- will start Report-Hub." log INFO "EXLIQUID setup detected -- will start Report-Hub."
OVERRIDE+=" -f ./$PROJECT/modules/exliquid-compose.yml" OVERRIDE+=" -f ./$PROJECT/modules/exliquid-compose.yml"
fi fi
}

View File

@ -1,10 +1,8 @@
#!/bin/bash #!/bin/bash
function exporterSetup() { if [ -n "$ENABLE_EXPORTER" ];then
if [ -n "$ENABLE_EXPORTER" ];then
log INFO "Exporter setup detected -- will start Exporter service." log INFO "Exporter setup detected -- will start Exporter service."
OVERRIDE+=" -f ./$PROJECT/modules/exporter-compose.yml" OVERRIDE+=" -f ./$PROJECT/modules/exporter-compose.yml"
fi fi
# TODO: Generate password in another way so that not all passwords are the same? # 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)" 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)"
}

View File

@ -1,21 +1,5 @@
#!/bin/bash #!/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' # Transform into single string array, e.g. 'dktk-test' to 'dktk test'
# Usage: transformToSingleStringArray 'dktk-test' -> 'dktk test' # Usage: transformToSingleStringArray 'dktk-test' -> 'dktk test'
@ -50,3 +34,18 @@ function legacyIdMapping() {
normalized_string=$(applySpecialCases "$uppercase_string"); normalized_string=$(applySpecialCases "$uppercase_string");
echo "$normalized_string" | tr -d ' ' 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

View File

@ -1,13 +1,10 @@
#!/bin/bash #!/bin/bash
function mtbaSetup() { if [ -n "$ENABLE_MTBA" ];then
# TODO: Check if ID-Management Module is activated!
if [ -n "$ENABLE_MTBA" ];then
log INFO "MTBA setup detected -- will start MTBA Service and CBioPortal." log INFO "MTBA setup detected -- will start MTBA Service and CBioPortal."
if [ ! -n "$IDMANAGER_UPLOAD_APIKEY" ]; then if [ ! -n "$IDMANAGER_UPLOAD_APIKEY" ]; then
log ERROR "Detected MTBA Module configuration but ID-Management Module seems not to be configured!" log ERROR "Detected MTBA Module configuration but ID-Management Module seems not to be configured!"
exit 1; exit 1;
fi fi
OVERRIDE+=" -f ./$PROJECT/modules/mtba-compose.yml" OVERRIDE+=" -f ./$PROJECT/modules/mtba-compose.yml"
fi fi
}

View File

@ -2,7 +2,7 @@ version: "3.7"
services: services:
connector: connector:
container_name: bridgehead-connector container_name: bridgehead-nngm-connector
image: docker.verbis.dkfz.de/ccp/connector:bk2 image: docker.verbis.dkfz.de/ccp/connector:bk2
environment: environment:
POSTGRES_PASSWORD: ${CONNECTOR_POSTGRES_PASSWORD} POSTGRES_PASSWORD: ${CONNECTOR_POSTGRES_PASSWORD}
@ -19,7 +19,7 @@ services:
connector_db: connector_db:
image: postgres:9.5-alpine image: postgres:9.5-alpine
container_name: bridgehead-ccp-connector-db container_name: bridgehead-nngm-connector-db
volumes: volumes:
- "connector_db_data:/var/lib/postgresql/data" - "connector_db_data:/var/lib/postgresql/data"
environment: environment:

View File

@ -1,9 +1,7 @@
#!/bin/bash #!/bin/bash
function nngmSetup() { if [ -n "$NNGM_CTS_APIKEY" ]; then
if [ -n "$NNGM_CTS_APIKEY" ]; then
log INFO "nNGM setup detected -- will start nNGM Connector." log INFO "nNGM setup detected -- will start nNGM Connector."
OVERRIDE+=" -f ./$PROJECT/modules/nngm-compose.yml" OVERRIDE+=" -f ./$PROJECT/modules/nngm-compose.yml"
fi 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)" 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)"
}

View File

@ -1,9 +1,7 @@
#!/bin/bash #!/bin/bash
function teilerUiSetup() { if [ "$ENABLE_TEILER" == true ];then
if [ -n "$ENABLE_TEILER" ];then
log INFO "Teiler-UI setup detected -- will start Teiler-UI services." log INFO "Teiler-UI setup detected -- will start Teiler-UI services."
OVERRIDE+=" -f ./$PROJECT/modules/teiler-ui-compose.yml" OVERRIDE+=" -f ./$PROJECT/modules/teiler-ui-compose.yml"
fi 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)" 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)"
}

View File

@ -8,17 +8,8 @@ REPORTHUB_BEAM_SECRET_LONG="ApiKey report-hub.${PROXY_ID} ${REPORTHUB_BEAM_SECRE
SUPPORT_EMAIL=support-ccp@dkfz-heidelberg.de SUPPORT_EMAIL=support-ccp@dkfz-heidelberg.de
PRIVATEKEYFILENAME=/etc/bridgehead/pki/${SITE_ID}.priv.pem PRIVATEKEYFILENAME=/etc/bridgehead/pki/${SITE_ID}.priv.pem
# This will load id-management setup. Effective only if id-management configuration is defined. for module in $PROJECT/modules/*.sh
source $PROJECT/modules/id-management-setup.sh do
idManagementSetup log INFO "sourcing $module"
# This will load nngm setup. Effective only if nngm configuration is defined. source $module
source $PROJECT/modules/nngm-setup.sh done
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