Derive spot variables

This commit is contained in:
Martin Lablans 2022-09-30 16:05:36 +02:00
parent d89c08702c
commit 69b33941c4
3 changed files with 24 additions and 11 deletions

View File

@ -41,14 +41,20 @@ case "$PROJECT" in
;; ;;
esac 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 case "$ACTION" in
start) start)
checkRequirements checkRequirements
fetchVarsFromVaultByFile /etc/bridgehead/$PROJECT.conf || exit 1 exec docker-compose -f ./$PROJECT/docker-compose.yml up
exec docker-compose -f ./$PROJECT/docker-compose.yml --env-file /etc/bridgehead/$PROJECT.conf up
;; ;;
stop) 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) update)
exec ./lib/update-bridgehead.sh $PROJECT exec ./lib/update-bridgehead.sh $PROJECT

View File

@ -73,10 +73,10 @@ services:
spot: spot:
image: samply/spot:latest image: samply/spot:latest
environment: environment:
SECRET: ${SECRET} SECRET: ${SPOT_BEAM_SECRET_LONG}
APPID: ${APP_0_ID_SHORT} APPID: spot
PROXY_ID: ${PROXY_ID} PROXY_ID: ${PROXY_ID}
LDM_URL: ${LDM_URL} LDM_URL: http://bridgehead-ccp-blaze:8080/fhir
BEAM_PROXY: http://beam-proxy:8081 BEAM_PROXY: http://beam-proxy:8081
depends_on: depends_on:
- "beam-proxy" - "beam-proxy"
@ -90,10 +90,10 @@ services:
environment: environment:
BROKER_URL: ${BROKER_URL} BROKER_URL: ${BROKER_URL}
PROXY_ID: ${PROXY_ID} PROXY_ID: ${PROXY_ID}
APP_0_ID: ${APP_0_ID_SHORT} APP_0_ID: spot
APP_0_KEY: ${APP_0_KEY} APP_0_KEY: ${SPOT_BEAM_SECRET_SHORT}
APP_1_ID: ${APP_1_ID_SHORT} APP_1_ID: report-hub
APP_1_KEY: ${APP_1_KEY} APP_1_KEY: ${REPORTHUB_BEAM_SECRET_SHORT}
PRIVKEY_FILE: /run/secrets/proxy.pem PRIVKEY_FILE: /run/secrets/proxy.pem
RUST_LOG: debug RUST_LOG: debug
ALL_PROXY: http://forward_proxy:3128 ALL_PROXY: http://forward_proxy:3128
@ -111,4 +111,4 @@ volumes:
secrets: secrets:
proxy.pem: proxy.pem:
file: /etc/bridgehead/pki/${PROXY_ID_SHORT}.priv.pem file: /etc/bridgehead/pki/${SITE_ID}.priv.pem

7
ccp/vars Normal file
View File

@ -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}"