Added files for running a gbn project
This commit is contained in:
		
							
								
								
									
										10
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
				
			|||||||
 | 
					##Ignore site configuration
 | 
				
			||||||
 | 
					.gitsubmodules
 | 
				
			||||||
 | 
					site-config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Ignore site configuration
 | 
				
			||||||
 | 
					config/**/*
 | 
				
			||||||
 | 
					!config/**/*.default
 | 
				
			||||||
 | 
					docker-compose.override.yml
 | 
				
			||||||
 | 
					site-specific.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,23 +1,16 @@
 | 
				
			|||||||
[Unit]
 | 
					[Unit]
 | 
				
			||||||
Description=Bridgehead (%i) Service
 | 
					Description=Bridgehead (%i) Service
 | 
				
			||||||
Requires=traefik.service
 | 
					 | 
				
			||||||
After=traefik.service
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Service]
 | 
					[Service]
 | 
				
			||||||
Restart=always
 | 
					Restart=always
 | 
				
			||||||
RestartSec=30
 | 
					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 down
 | 
				
			||||||
ExecStartPre=/usr/local/bin/docker-compose --env-file site-config/%i.env rm
 | 
					ExecStart=/usr/local/bin/docker-compose --env-file ../site-config/%i.env up
 | 
				
			||||||
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
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
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]
 | 
					[Install]
 | 
				
			||||||
WantedBy=multi-user.target
 | 
					WantedBy=multi-user.target
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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
 | 
					 | 
				
			||||||
@@ -22,7 +22,7 @@ services:
 | 
				
			|||||||
      POSTGRES_HOST: "connector-db"
 | 
					      POSTGRES_HOST: "connector-db"
 | 
				
			||||||
      POSTGRES_DB: "samply.connector"
 | 
					      POSTGRES_DB: "samply.connector"
 | 
				
			||||||
      POSTGRES_USER: "samply"
 | 
					      POSTGRES_USER: "samply"
 | 
				
			||||||
      POSTGRES_PASS: "samply"
 | 
					      POSTGRES_PASS: ${GBN_CONNECTOR_POSTGRES_PASS}
 | 
				
			||||||
      STORE_URL: "http://store:8080/fhir"
 | 
					      STORE_URL: "http://store:8080/fhir"
 | 
				
			||||||
      QUERY_LANGUAGE: "CQL"
 | 
					      QUERY_LANGUAGE: "CQL"
 | 
				
			||||||
      MDR_URL: "https://mdr.germanbiobanknode.de/v3/api/mdr"
 | 
					      MDR_URL: "https://mdr.germanbiobanknode.de/v3/api/mdr"
 | 
				
			||||||
@@ -37,7 +37,7 @@ services:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  connector-db:
 | 
					  connector-db:
 | 
				
			||||||
    container_name: "connector-db"
 | 
					    container_name: "connector-db"
 | 
				
			||||||
    image: "postgres:9.6"
 | 
					    image: "postgres:10.17"
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
      POSTGRES_USER: "samply"
 | 
					      POSTGRES_USER: "samply"
 | 
				
			||||||
      POSTGRES_PASSWORD: "samply"
 | 
					      POSTGRES_PASSWORD: "samply"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								gbn/gbn.env.dev
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								gbn/gbn.env.dev
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					GBN_CONNECTOR_POSTGRES_PASS=samply
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										79
									
								
								install-bridgehead.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										79
									
								
								install-bridgehead.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@@ -1,40 +1,39 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
### Note: Currently not complete, needs some features before useable for production
 | 
					### Note: Currently not complete, needs some features before useable for production
 | 
				
			||||||
 | 
					
 | 
				
			||||||
./prerequisites.sh
 | 
					./prerequisites.sh
 | 
				
			||||||
source site.conf
 | 
					source site.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Installing bridgehead"
 | 
					echo "Installing bridgehead"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd /etc/systemd/system/
 | 
					cd /etc/systemd/system/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Installing bridgehead\@.service in systemd ..."
 | 
					echo "Installing bridgehead\@.service in systemd ..."
 | 
				
			||||||
sudo cp /srv/docker/bridgehead/convenience/bridgehead\@.service ./
 | 
					sudo cp /srv/docker/bridgehead/convenience/bridgehead\@.service ./
 | 
				
			||||||
echo "Installing bridgehead\@.update.service in systemd ..."
 | 
					echo "Installing bridgehead\@.update.service in systemd ..."
 | 
				
			||||||
sudo cp /srv/docker/bridgehead/convenience/bridgehead-update\@.service ./
 | 
					sudo cp /srv/docker/bridgehead/convenience/bridgehead-update\@.service ./
 | 
				
			||||||
sudo cp /srv/docker/bridgehead/convenience/bridgehead-update\@.timer ./
 | 
					sudo cp /srv/docker/bridgehead/convenience/bridgehead-update\@.timer ./
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Loading the bridgehead and traefik service definitions in systemd"
 | 
					echo "Loading the bridgehead and traefik service definitions in systemd"
 | 
				
			||||||
sudo systemctl daemon-reload
 | 
					sudo systemctl daemon-reload
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Starting Project ${project} "
 | 
					echo "Starting Project ${project} "
 | 
				
			||||||
  if [ ! -f "/etc/systemd/system/bridgehead@${project}.service.d/bridgehead.conf" ]; then
 | 
					  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"
 | 
					    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
 | 
					    continue
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  sudo systemctl is-active --quiet bridgehead@"${project}"
 | 
					  sudo systemctl is-active --quiet bridgehead@"${project}"
 | 
				
			||||||
  if [ ! $? -eq 0 ]; then
 | 
					  if [ ! $? -eq 0 ]; then
 | 
				
			||||||
    echo "Starting bridgehead@${project} service ..."
 | 
					    echo "Starting bridgehead@${project} service ..."
 | 
				
			||||||
    sudo systemctl start bridgehead@"${project}"
 | 
					    sudo systemctl start bridgehead@"${project}"
 | 
				
			||||||
    echo "Enabling autostart of bridgehead@${project}.service"
 | 
					    echo "Enabling autostart of bridgehead@${project}.service"
 | 
				
			||||||
    sudo systemctl enable bridgehead@"${project}"
 | 
					    sudo systemctl enable bridgehead@"${project}"
 | 
				
			||||||
    echo "Enabling nightly updates for bridgehead@${project}.service ..."
 | 
					    echo "Enabling nightly updates for bridgehead@${project}.service ..."
 | 
				
			||||||
    sudo systemctl enable --now bridgehead-update@"${project}".timer
 | 
					    sudo systemctl enable --now bridgehead-update@"${project}".timer
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
done
 | 
					
 | 
				
			||||||
 | 
					# Switch back to execution directory;
 | 
				
			||||||
# Switch back to execution directory;
 | 
					cd -
 | 
				
			||||||
cd -
 | 
					# TODO: Configuration of the different modules
 | 
				
			||||||
# TODO: Configuration of the different modules
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										103
									
								
								prerequisites.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										103
									
								
								prerequisites.sh
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							@@ -1,49 +1,54 @@
 | 
				
			|||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Check if user is a su
 | 
					## 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 "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 ..."
 | 
					echo "First we will check if all prerequisites are met ..."
 | 
				
			||||||
prerequisites="git docker docker-compose"
 | 
					prerequisites="git docker docker-compose"
 | 
				
			||||||
for prerequisite in $prerequisites; do
 | 
					for prerequisite in $prerequisites; do
 | 
				
			||||||
  $prerequisite --version 2>&1
 | 
					  $prerequisite --version 2>&1
 | 
				
			||||||
  is_available=$?
 | 
					  is_available=$?
 | 
				
			||||||
  if [ $is_available -gt 0 ]; then
 | 
					  if [ $is_available -gt 0 ]; then
 | 
				
			||||||
    log "ERROR" "Prerequisite not fulfilled - $prerequisite is not available!"
 | 
					    log "ERROR" "Prerequisite not fulfilled - $prerequisite is not available!"
 | 
				
			||||||
    exit 79
 | 
					    exit 79
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  # TODO: Check for specific version
 | 
					  # TODO: Check for specific version
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
echo "All prerequisites are installed. Now we can download the bridgehead from https://code.mitro.dkfz.de/scm/docker/c4.bk.docker.git."
 | 
					
 | 
				
			||||||
 | 
					echo "Checking site.conf"
 | 
				
			||||||
#check if site.conf is created
 | 
					
 | 
				
			||||||
if [ ! -f site.conf ]; then
 | 
					#check if site.conf is created
 | 
				
			||||||
  echo "Please create your specific site.conf file from the site.dev.conf"
 | 
					if [ ! -f site.conf ]; then
 | 
				
			||||||
  exit
 | 
					  echo "Please create your specific site.conf file from the site.dev.conf"
 | 
				
			||||||
fi
 | 
					  exit
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
#Load site specific variables
 | 
					
 | 
				
			||||||
source site.conf
 | 
					#Load site specific variables
 | 
				
			||||||
 | 
					source site.conf
 | 
				
			||||||
if [ -z "$site_name" ]; then
 | 
					
 | 
				
			||||||
  echo "Site name is empty,please enter site name:"
 | 
					if [ -z "$site_name" ]; then
 | 
				
			||||||
  read -r site_name
 | 
					  echo "Please set site_name"
 | 
				
			||||||
  site_name_lowercase=$(echo "$site_name" | tr '[:upper:]' '[:lower:]')
 | 
					fi
 | 
				
			||||||
fi
 | 
					
 | 
				
			||||||
 | 
					echo "Checking site-config module"
 | 
				
			||||||
## Download submodule
 | 
					
 | 
				
			||||||
if [ ! -d "site-config" ]; then
 | 
					## Download submodule
 | 
				
			||||||
  echo "Please set up the site-config folder. Instruction are in the readme."
 | 
					if [ ! -d "site-config" ]; then
 | 
				
			||||||
  exit
 | 
					  echo "Please set up the site-config folder. Instruction are in the readme."
 | 
				
			||||||
else
 | 
					  exit
 | 
				
			||||||
  echo "Site configuration is already loaded"
 | 
					else
 | 
				
			||||||
fi
 | 
					  echo "Site configuration is already loaded"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
#Check if a project is selected
 | 
					
 | 
				
			||||||
if [ -z "$project"  ]; then
 | 
					#Check if a project is selected
 | 
				
			||||||
  echo "No project selected! Please add a Project in your local site.conf."
 | 
					if [ -z "$project"  ]; then
 | 
				
			||||||
  exit
 | 
					  echo "No project selected! Please add a Project in your local site.conf."
 | 
				
			||||||
fi
 | 
					  exit
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
# Check for each project
 | 
					
 | 
				
			||||||
echo "All prerequisites meet! All systems are ready to go!"
 | 
					#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
									
								
							
							
						
						
									
										59
									
								
								site.dev.conf
									
									
									
									
									
										Normal 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=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Reference in New Issue
	
	Block a user