From 69b33941c4db72217407508be484e12396d2e373 Mon Sep 17 00:00:00 2001 From: Martin Lablans Date: Fri, 30 Sep 2022 16:05:36 +0200 Subject: [PATCH] Derive spot variables --- bridgehead | 12 +++++++++--- ccp/docker-compose.yml | 16 ++++++++-------- ccp/vars | 7 +++++++ 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 ccp/vars diff --git a/bridgehead b/bridgehead index 20616e6..35442c9 100755 --- a/bridgehead +++ b/bridgehead @@ -41,14 +41,20 @@ case "$PROJECT" in ;; esac +# Load variables from /etc/bridgehead and /srv/docker/bridgehead +set -a +source /etc/bridgehead/$PROJECT.conf +fetchVarsFromVaultByFile /etc/bridgehead/$PROJECT.conf || exit 1 +[ -e ./$PROJECT/vars ] && source ./$PROJECT/vars +set +a + case "$ACTION" in start) checkRequirements - fetchVarsFromVaultByFile /etc/bridgehead/$PROJECT.conf || exit 1 - exec docker-compose -f ./$PROJECT/docker-compose.yml --env-file /etc/bridgehead/$PROJECT.conf up + exec docker-compose -f ./$PROJECT/docker-compose.yml up ;; stop) - exec docker-compose -f ./$PROJECT/docker-compose.yml --env-file /etc/bridgehead/$PROJECT.conf down + exec docker-compose -f ./$PROJECT/docker-compose.yml down ;; update) exec ./lib/update-bridgehead.sh $PROJECT diff --git a/ccp/docker-compose.yml b/ccp/docker-compose.yml index 2b05083..161e495 100644 --- a/ccp/docker-compose.yml +++ b/ccp/docker-compose.yml @@ -73,10 +73,10 @@ services: spot: image: samply/spot:latest environment: - SECRET: ${SECRET} - APPID: ${APP_0_ID_SHORT} + SECRET: ${SPOT_BEAM_SECRET_LONG} + APPID: spot PROXY_ID: ${PROXY_ID} - LDM_URL: ${LDM_URL} + LDM_URL: http://bridgehead-ccp-blaze:8080/fhir BEAM_PROXY: http://beam-proxy:8081 depends_on: - "beam-proxy" @@ -90,10 +90,10 @@ services: environment: BROKER_URL: ${BROKER_URL} PROXY_ID: ${PROXY_ID} - APP_0_ID: ${APP_0_ID_SHORT} - APP_0_KEY: ${APP_0_KEY} - APP_1_ID: ${APP_1_ID_SHORT} - APP_1_KEY: ${APP_1_KEY} + APP_0_ID: spot + APP_0_KEY: ${SPOT_BEAM_SECRET_SHORT} + APP_1_ID: report-hub + APP_1_KEY: ${REPORTHUB_BEAM_SECRET_SHORT} PRIVKEY_FILE: /run/secrets/proxy.pem RUST_LOG: debug ALL_PROXY: http://forward_proxy:3128 @@ -111,4 +111,4 @@ volumes: secrets: proxy.pem: - file: /etc/bridgehead/pki/${PROXY_ID_SHORT}.priv.pem + file: /etc/bridgehead/pki/${SITE_ID}.priv.pem diff --git a/ccp/vars b/ccp/vars new file mode 100644 index 0000000..4152fa4 --- /dev/null +++ b/ccp/vars @@ -0,0 +1,7 @@ +BROKER_ID=broker.dev.ccp-it.dktk.dkfz.de +BROKER_URL=https://${BROKER_ID} +PROXY_ID=${SITE_ID}.${BROKER_ID} +SPOT_BEAM_SECRET_SHORT="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)" +SPOT_BEAM_SECRET_LONG="ApiKey spot.${PROXY_ID} ${SPOT_BEAM_SECRET_SHORT}" +REPORTHUB_BEAM_SECRET_SHORT="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)" +REPORTHUB_BEAM_SECRET_LONG="ApiKey report-hub.${PROXY_ID} ${REPORTHUB_BEAM_SECRET_SHORT}"