Added files for running a gbn project

This commit is contained in:
root 2021-12-21 13:48:28 +01:00
parent c683bb76bc
commit ed2f2ad590
8 changed files with 170 additions and 121 deletions

10
.gitignore vendored Normal file
View File

@ -0,0 +1,10 @@
##Ignore site configuration
.gitsubmodules
site-config
## Ignore site configuration
config/**/*
!config/**/*.default
docker-compose.override.yml
site-specific.conf

View File

@ -1,23 +1,16 @@
[Unit]
Description=Bridgehead (%i) Service
Requires=traefik.service
After=traefik.service
[Service]
Restart=always
RestartSec=30
WorkingDirectory=/srv/docker/bridgehead
WorkingDirectory=/srv/docker/bridgehead/%i
ExecStartPre=/usr/local/bin/docker-compose --env-file site-config/%i.env down
ExecStartPre=/usr/local/bin/docker-compose --env-file site-config/%i.env rm
ExecStartPre=CONNECTOR_POSTGRES_PASSWORD=%i_CONNECTOR_POSTGRES_PASSWORD
ExecStartPre=export CONNECTOR_POSTGRES_PASSWORD
ExecStart=/usr/local/bin/docker-compose --env-file site-config/%i.env up
ExecStart=CONNECTOR_POSTGRES_PASSWORD=
ExecStart=export CONNECTOR_POSTGRES_PASSWORD
ExecStartPre=/usr/local/bin/docker-compose --env-file ../site-config/%i.env down
ExecStart=/usr/local/bin/docker-compose --env-file ../site-config/%i.env up
ExecStop=/usr/local/bin/docker-compose --env-file site-config/%i.env down
ExecStop=/usr/local/bin/docker-compose --env-file ../site-config/%i.env down
[Install]
WantedBy=multi-user.target

View File

@ -1,19 +0,0 @@
[Unit]
Description=Traefik Service
Requires=docker.service
After=docker.service
[Service]
Restart=always
RestartSec=30
WorkingDirectory=/srv/docker/bridgehead
ExecStartPre=/usr/local/bin/docker-compose --env-file site-config/start.env down
ExecStartPre=/usr/local/bin/docker-compose --env-file site-config/start.env rm
ExecStart=/usr/local/bin/docker-compose --env-file site-config/start.env up
ExecStop=/usr/local/bin/docker-compose --env-file site-config/start.env down
[Install]
WantedBy=multi-user.target

View File

@ -22,7 +22,7 @@ services:
POSTGRES_HOST: "connector-db"
POSTGRES_DB: "samply.connector"
POSTGRES_USER: "samply"
POSTGRES_PASS: "samply"
POSTGRES_PASS: ${GBN_CONNECTOR_POSTGRES_PASS}
STORE_URL: "http://store:8080/fhir"
QUERY_LANGUAGE: "CQL"
MDR_URL: "https://mdr.germanbiobanknode.de/v3/api/mdr"
@ -37,7 +37,7 @@ services:
connector-db:
container_name: "connector-db"
image: "postgres:9.6"
image: "postgres:10.17"
environment:
POSTGRES_USER: "samply"
POSTGRES_PASSWORD: "samply"

2
gbn/gbn.env.dev Normal file
View File

@ -0,0 +1,2 @@
GBN_CONNECTOR_POSTGRES_PASS=samply

79
install-bridgehead.sh Normal file → Executable file
View File

@ -1,40 +1,39 @@
#!/bin/bash
### Note: Currently not complete, needs some features before useable for production
./prerequisites.sh
source site.conf
echo "Installing bridgehead"
cd /etc/systemd/system/
echo "Installing bridgehead\@.service in systemd ..."
sudo cp /srv/docker/bridgehead/convenience/bridgehead\@.service ./
echo "Installing bridgehead\@.update.service in systemd ..."
sudo cp /srv/docker/bridgehead/convenience/bridgehead-update\@.service ./
sudo cp /srv/docker/bridgehead/convenience/bridgehead-update\@.timer ./
echo "Loading the bridgehead and traefik service definitions in systemd"
sudo systemctl daemon-reload
echo "Starting Project ${project} "
if [ ! -f "/etc/systemd/system/bridgehead@${project}.service.d/bridgehead.conf" ]; then
echo "Can't find local configuration file for bridgehead@${project} service. Please ensure that the file /etc/systemd/system/bridgehead@${project}.service.d/bridgehead.conf exists"
continue
fi
sudo systemctl is-active --quiet bridgehead@"${project}"
if [ ! $? -eq 0 ]; then
echo "Starting bridgehead@${project} service ..."
sudo systemctl start bridgehead@"${project}"
echo "Enabling autostart of bridgehead@${project}.service"
sudo systemctl enable bridgehead@"${project}"
echo "Enabling nightly updates for bridgehead@${project}.service ..."
sudo systemctl enable --now bridgehead-update@"${project}".timer
fi
done
# Switch back to execution directory;
cd -
# TODO: Configuration of the different modules
#!/bin/bash
### Note: Currently not complete, needs some features before useable for production
./prerequisites.sh
source site.conf
echo "Installing bridgehead"
cd /etc/systemd/system/
echo "Installing bridgehead\@.service in systemd ..."
sudo cp /srv/docker/bridgehead/convenience/bridgehead\@.service ./
echo "Installing bridgehead\@.update.service in systemd ..."
sudo cp /srv/docker/bridgehead/convenience/bridgehead-update\@.service ./
sudo cp /srv/docker/bridgehead/convenience/bridgehead-update\@.timer ./
echo "Loading the bridgehead and traefik service definitions in systemd"
sudo systemctl daemon-reload
echo "Starting Project ${project} "
if [ ! -f "/etc/systemd/system/bridgehead@${project}.service.d/bridgehead.conf" ]; then
echo "Can't find local configuration file for bridgehead@${project} service. Please ensure that the file /etc/systemd/system/bridgehead@${project}.service.d/bridgehead.conf exists"
continue
fi
sudo systemctl is-active --quiet bridgehead@"${project}"
if [ ! $? -eq 0 ]; then
echo "Starting bridgehead@${project} service ..."
sudo systemctl start bridgehead@"${project}"
echo "Enabling autostart of bridgehead@${project}.service"
sudo systemctl enable bridgehead@"${project}"
echo "Enabling nightly updates for bridgehead@${project}.service ..."
sudo systemctl enable --now bridgehead-update@"${project}".timer
fi
# Switch back to execution directory;
cd -
# TODO: Configuration of the different modules

103
prerequisites.sh Normal file → Executable file
View File

@ -1,49 +1,54 @@
#!/bin/bash
## Check if user is a su
echo "Welcome to the starting a bridgehead. We will get your instance up and running in no time"
echo "First we will check if all prerequisites are met ..."
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
# TODO: Check for specific version
done
echo "All prerequisites are installed. Now we can download the bridgehead from https://code.mitro.dkfz.de/scm/docker/c4.bk.docker.git."
#check if site.conf is created
if [ ! -f site.conf ]; then
echo "Please create your specific site.conf file from the site.dev.conf"
exit
fi
#Load site specific variables
source site.conf
if [ -z "$site_name" ]; then
echo "Site name is empty,please enter site name:"
read -r site_name
site_name_lowercase=$(echo "$site_name" | tr '[:upper:]' '[:lower:]')
fi
## Download submodule
if [ ! -d "site-config" ]; then
echo "Please set up the site-config folder. Instruction are in the readme."
exit
else
echo "Site configuration is already loaded"
fi
#Check if a project is selected
if [ -z "$project" ]; then
echo "No project selected! Please add a Project in your local site.conf."
exit
fi
# Check for each project
echo "All prerequisites meet! All systems are ready to go!"
#!/bin/bash
## Check if user is a su
echo "Welcome to the starting a bridgehead. We will get your instance up and running in no time"
echo "First we will check if all prerequisites are met ..."
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
# TODO: Check for specific version
done
echo "Checking site.conf"
#check if site.conf is created
if [ ! -f site.conf ]; then
echo "Please create your specific site.conf file from the site.dev.conf"
exit
fi
#Load site specific variables
source site.conf
if [ -z "$site_name" ]; then
echo "Please set site_name"
fi
echo "Checking site-config module"
## Download submodule
if [ ! -d "site-config" ]; then
echo "Please set up the site-config folder. Instruction are in the readme."
exit
else
echo "Site configuration is already loaded"
fi
#Check if a project is selected
if [ -z "$project" ]; then
echo "No project selected! Please add a Project in your local site.conf."
exit
fi
#check if project env is present
if [ -d "site-config/${project}.env" ]; then
echo "Please copy the tempalte from ${project} and put it in the site-config folder"
fi
echo "All prerequisites meet! All systems are ready to go!"

59
site.dev.conf Normal file
View File

@ -0,0 +1,59 @@
#!/bin/bash
### This is the configuration file for secrets, only your site should know
### Because the deployment via systemd is not possible in the current wsl environment,
### developers need to export the necessary variables.
### You can copy this file to site-specific.conf and run source site-specific.conf.
### After this docker-compose up should use the environment variables defined in this file.
### Connector configuration
## The password the for your connector database
export dktk_CONNECTOR_POSTGRES_PASSWORD=
export c4_CONNECTOR_POSTGRES_PASSWORD=
export gbn_CONNECTOR_POSTGRES_PASSWORD=
### Local Datamanagenment configuration if necessary
## Supply this, if you use samplystore
# export LDM_DATABASE_PASSWORD=this-should-only-be-used-by-developers-ldm-database-password;
### ID-Management configuration
## provided by DKFZ with cooperation in Mainz
export CCP_PATIENTLISTE_APIKEY=
## provided by DKFZ with cooperation in Frankfurt
export CCP_CONTROLLNUMBERGENERATOR_APIKEY=
export LOCAL_IDMANAGER_LDM_APIKEY=
## Additional new ID-Manager Configuration
export LOCAL_IDMANAGER_MAINZELLISTE_APIKEY=
export LOCAL_IDMANAGER_CONNECTOR_APIKEY=
export LOCAL_PATIENTLIST_DBPASS=
export dktk_CCP_OIDC_CLIENT_SECRET=
export c4_CCP_OIDC_CLIENT_SECRET=
### Mail Server username and password
# export MAIL_USER=
# export MAIL_PASSWORD=
### Monitoring
## by default, the bridgehead will report it's state to DKFZ monitoring. Change here to opt-out.
# export MONITOR_OPTOUT=true
### nNGM Configuration, only necessary if your site takes part in nNGM
## The cts login data, that healex provided you
# export NNGM_CTS_USER=<provided-by-healex>
# export NNGM_CTS_PASSWORD=<provided-by-healex>
## The idmanagement authentication data, that is provided by dkfz dataprotection office
# export NNGM_MAGICPL_APIKEY=<provided-by-dkfz>
# export NNGM_MAINZELLISTE_APIKEY=<provided-by-dkfz>
### Workaround for local developers network environment
## Note: MSYS_NO_PATHCONV is needed, because git bash and msys2 will otherwise convert /etc/hosts to a windows path
#export HOSTIP=$(MSYS_NO_PATHCONV=1 docker run --rm --add-host=host.docker.internal:host-gateway ubuntu cat /etc/hosts | grep 'host.docker.internal' | awk '{print $1}');
#export HOST=$(hostname)
export HOSTIP=
export HOST=
export site_name=
### Write the Project you want to start with the brigdehead
##Exmaple project=gbn
project=