mirror of
https://github.com/samply/bridgehead.git
synced 2025-06-16 00:00:14 +02:00
Compare commits
47 Commits
cbb73ab9b5
...
ehds2
Author | SHA1 | Date | |
---|---|---|---|
4f9b662223 | |||
e323c2765f | |||
8c1c0de927 | |||
56cdd0dcc4 | |||
1b9af45991 | |||
353fc010cb | |||
c15c3962a7 | |||
e0fe39ab83 | |||
cce76bab84 | |||
013d6d219b | |||
cc228e20d9 | |||
153f654397 | |||
70aca8e99c | |||
f925c27791 | |||
350a4c84af | |||
b52931e46c | |||
eb0f392e3c | |||
a738f1468f | |||
aa122d0bff | |||
ec4e91fade | |||
c5f82bf93c | |||
eb563113e0 | |||
a10d0f9605 | |||
994b0a4124 | |||
593f93fffc | |||
b2b9865e8c | |||
4588960e19 | |||
1b82207934 | |||
4880c5cc9b | |||
b9b44d2530 | |||
0d1f425df0 | |||
7a33b54416 | |||
40e15f4d84 | |||
99956f3477 | |||
d73e6ee7a3 | |||
b6bfaba855 | |||
5bd9baaff7 | |||
a629d87a5f | |||
4abe193c58 | |||
5e8db39e2a | |||
b28a48da0a | |||
7c2e9af947 | |||
81e5a6ea3f | |||
a364a4b3f8 | |||
9459e1a979 | |||
d5760ed3d0 | |||
8af5cf3f01 |
101
README.md
101
README.md
@ -9,6 +9,7 @@ This repository is the starting point for any information and tools you will nee
|
||||
- [Software](#software)
|
||||
- [Network](#network)
|
||||
2. [Deployment](#deployment)
|
||||
- [EHDS2/ECDC](#ehds2-ecdc)
|
||||
- [Site name](#site-name)
|
||||
- [Projects](#projects)
|
||||
- [GitLab repository](#gitlab-repository)
|
||||
@ -87,6 +88,8 @@ The following URLs need to be accessible (prefix with `https://`):
|
||||
* gitlab.bbmri-eric.eu
|
||||
* only for German Biobank Node
|
||||
* broker.bbmri.de
|
||||
* only for EHDS2/ECDC
|
||||
* ecdc-vm-ehds-test1.swedencentral.cloudapp.azure.com
|
||||
|
||||
> 📝 This URL list is subject to change. Instead of the individual names, we highly recommend whitelisting wildcard domains: *.dkfz.de, github.com, *.docker.com, *.docker.io, *.samply.de, *.bbmri.de.
|
||||
|
||||
@ -94,6 +97,34 @@ The following URLs need to be accessible (prefix with `https://`):
|
||||
|
||||
## Deployment
|
||||
|
||||
### EHDS2/ECDC
|
||||
|
||||
The ECDC Bridgehead allows you to connect your site/node to the [AMR Explorer](http://ehds2-lens.swedencentral.cloudapp.azure.com/), a non-public central web site that allow certified researchers to search for information relating to antiobiotic resistance, Europe-wide. You can supply the Bridgehead with data from your site in the form of CSV files, which will then be made available to the Explorer for searching purposes.
|
||||
|
||||
You will need to set up some configuration before you can start a Bridgehead. This can be done as follows:
|
||||
|
||||
```shell
|
||||
sudo mkdir -p /etc/bridgehead
|
||||
sudo cp /srv/docker/bridgehead/bbmri/modules/bbmri.conf /etc/bridgehead
|
||||
```
|
||||
|
||||
Now edit ```/etc/bridgehead/bbmri.conf``` and customize the following variables for your site:
|
||||
|
||||
- SITE_NAME
|
||||
- SITE_ID
|
||||
- OPERATOR_FIRST_NAME
|
||||
- OPERATOR_LAST_NAME
|
||||
- OPERATOR_EMAIL
|
||||
|
||||
If you run a proxy at your site, you will also need to give values to the ```HTTP*_PROXY*``` variables.
|
||||
|
||||
When you first start the Bridgehead, it will clone two extra repositories into /srv/docker, namely, ```focus``` and ```transfair```. It will automatically build local images of these repositories for you. These components have the following functionality that has been customized for ECDC:
|
||||
|
||||
- *focus.* This component is responsible for completing the CQL that is used for running queries against the Blaze FHIR store. It uses a set of templates for doing this. Extra templates have been written for the ECDC use case. They can be found in /srv/docker/focus/resources/cql/EHDS2*.
|
||||
- *transfair.* This is an ETL component. It takes the CSV data that you provide, converts it to FHIR, and loads it to Blaze. This will be run once, if there is data in /srv/docker/ecdc/data. A lock file in the data directory ensures that it does not get run again. Remove this lock file and restart the Bridgehead if you want to load new data.
|
||||
|
||||
These images will normally be rebuilt every time you restart the Bridgehead. This is a workaround to fix a bug: if you don't rebuild these images for every start, then legacy versions will be used and you will lose the new ECDC functionality. The reason for this is still under investigation.
|
||||
|
||||
### Site name
|
||||
|
||||
You will need to choose a short name for your site. This is not a URL, just a simple identifying string. For the examples below, we will use "your-site-name", but you should obviously choose something that is meaningful to you and which is unique.
|
||||
@ -108,6 +139,8 @@ Site names should adhere to the following conventions:
|
||||
|
||||
### GitLab repository
|
||||
|
||||
You can skip this section if you are doing an ECDC/EHDS2 installation.
|
||||
|
||||
In order to be able to install, you will need to have your own repository in GitLab for your site's configuration settings. This allows automated updates of the Bridgehead software.
|
||||
|
||||
To request a new repository, please contact your research network administration or send an email to one of the project specific addresses:
|
||||
@ -130,7 +163,24 @@ During the installation, your Bridgehead will download your site's configuration
|
||||
|
||||
### Base Installation
|
||||
|
||||
First, download your site specific configuration repository:
|
||||
Clone the bridgehead repository:
|
||||
```shell
|
||||
sudo mkdir -p /srv/docker/
|
||||
sudo git clone https://github.com/samply/bridgehead.git /srv/docker/bridgehead
|
||||
```
|
||||
|
||||
If this is an ECDC/EHDS2 installation, switch to the ```ehds2``` branch and copy the configuration file to the required location:
|
||||
```shell
|
||||
cd /srv/docker/bridgehead
|
||||
sudo git checkout ehds2
|
||||
sudo mkdir -p /etc/bridgehead/
|
||||
sudo cp bbmri/modules/bbmri.conf /etc/bridgehead/
|
||||
sudo vi /etc/bridgehead/bbmri.conf # Modify to include national node name and admin contact details
|
||||
```
|
||||
|
||||
For an ECDC/EHDS2 installation, you will also need to copy your data in a comma-separated value (CSV) formatted file to ```/srv/docker/ecdc/data```. Make sure it is readable by all. Only files with the ending ```.csv``` will be read in, all other files will be ignored.
|
||||
|
||||
If this is not an ECDC/EHDS2 installation, then download your site specific configuration repository:
|
||||
```shell
|
||||
sudo mkdir -p /etc/bridgehead/
|
||||
sudo git clone <REPO_URL_FROM_EMAIL> /etc/bridgehead/
|
||||
@ -149,12 +199,6 @@ Pay special attention to:
|
||||
- OPERATOR_LAST_NAME
|
||||
- OPERATOR_EMAIL
|
||||
|
||||
Clone the bridgehead repository:
|
||||
```shell
|
||||
sudo mkdir -p /srv/docker/
|
||||
sudo git clone https://github.com/samply/bridgehead.git /srv/docker/bridgehead
|
||||
```
|
||||
|
||||
Then, run the installation script:
|
||||
|
||||
```shell
|
||||
@ -173,8 +217,38 @@ sudo ./bridgehead enroll <PROJECT>
|
||||
|
||||
... and follow the instructions on the screen. Please send your default Collection ID and the display name of your site together with the certificate request when you enroll. You should then be prompted to do the next step:
|
||||
|
||||
Note: if you are doing an ECDC/EHDS2 installation, you will need to perform the Beam certificate signing yourself. Do not send an email to either of the email addreesses suggested by the bridgehead enroll procedure. Instead, log on to the VM where Beam is running and perform the following (you will need root permissions):
|
||||
```shell
|
||||
cd /srv/docker/beam-broker
|
||||
sudo mkdir -p csr
|
||||
sudo vi csr/ecdc-bridgehead-<national node name>.csr # Copy and paste the certificate printed during the enroll
|
||||
sudo pki-scripts/managepki sign --csr-file csr/ecdc-bridgehead-<national node name>.csr --common-name=ecdc-bridgehead-<national node name>.broker.bbmri.samply.de
|
||||
```
|
||||
|
||||
You can check that the Bridgehead has connected to Beam with the following command:
|
||||
```shell
|
||||
pki-scripts/managepki list
|
||||
|
||||
```
|
||||
|
||||
### Starting and stopping your Bridgehead
|
||||
|
||||
For an ECDC/EHDS2 installation, this is done with the help of specialized scripts:
|
||||
|
||||
To start:
|
||||
|
||||
```shell
|
||||
sudo /srv/docker/bridgehead/run.sh
|
||||
```
|
||||
|
||||
To stop (you generally won't need to do this):
|
||||
|
||||
```shell
|
||||
sudo /srv/docker/bridgehead/stop.sh
|
||||
```
|
||||
|
||||
For regular installations, read on.
|
||||
|
||||
If you followed the above steps, your Bridgehead should already be configured to autostart (via systemd). If you would like to start/stop manually:
|
||||
|
||||
To start, run
|
||||
@ -320,6 +394,19 @@ There will be a delay before the effects of Directory sync become visible. First
|
||||
|
||||
The data accessed by the federated search is held in the Bridgehead in a FHIR store (we use Blaze).
|
||||
|
||||
For an ECDC/EHDS2 installation, you need to provide your data as a table in a CSV (comma-separated value) files and place it in the directory /srv/docker/ecdc/data. You can provide as many data files as you like, and you can add new files incrementally over time.
|
||||
|
||||
In order for this new data to be loaded, you will need to execute the ```run.sh``` script with the appropriate arguments:
|
||||
|
||||
- To read just the most recently added data files: ```/srv/docker/bridgehead run.sh --upload```.
|
||||
- To read in all data from scratch: ```/srv/docker/bridgehead run.sh --upload-all```.
|
||||
|
||||
These two variants give you the choice between uploading data in an incremental way that preserves the date used for statistics or as a single upload that date stamps everything with the current date.
|
||||
|
||||
The Bridgehead can be started without data, but obviously, any searches run from the Explorer will return zero results for your site if you do that. Note that an empty data directory will automatically be inserted on the first start of the Bridgehead if you don't set one up yourself.
|
||||
|
||||
For non-ECDC setups, read on.
|
||||
|
||||
You can load data into this store by using its FHIR API:
|
||||
|
||||
```
|
||||
|
@ -1,10 +1,13 @@
|
||||
version: "3.7"
|
||||
|
||||
# This includes only the shared persistence for BBMRI-ERIC and GBN. Federation components are included as modules, see vars.
|
||||
# This includes only the shared persistence for BBMRI-ERIC and GBN and EHDS2. Federation components are included as modules, see vars.
|
||||
|
||||
services:
|
||||
blaze:
|
||||
image: docker.verbis.dkfz.de/cache/samply/blaze:latest
|
||||
#image: docker.verbis.dkfz.de/cache/samply/blaze:latest
|
||||
# Blaze versions 0.26 and 0.27 do not return anything when you run a
|
||||
# CQL query, so I am pinning the version at 0.25.
|
||||
image: samply/blaze:0.25
|
||||
container_name: bridgehead-bbmri-blaze
|
||||
environment:
|
||||
BASE_URL: "http://bridgehead-bbmri-blaze:8080"
|
||||
@ -20,6 +23,8 @@ services:
|
||||
- "traefik.http.services.blaze_ccp.loadbalancer.server.port=8080"
|
||||
- "traefik.http.routers.blaze_ccp.middlewares=ccp_b_strip,auth"
|
||||
- "traefik.http.routers.blaze_ccp.tls=true"
|
||||
ports:
|
||||
- "8081:8080"
|
||||
|
||||
volumes:
|
||||
blaze-data:
|
||||
|
81
bbmri/modules/bbmri.conf
Normal file
81
bbmri/modules/bbmri.conf
Normal file
@ -0,0 +1,81 @@
|
||||
### DO NOT EDIT THIS FILE DIRECTLY.
|
||||
###
|
||||
### This file is collaboratively managed by yourself and the CCP-IT team at DKFZ.
|
||||
### The Bridgehead will pull it from git every night and restart if required.
|
||||
### To make any changes (or review changes by CCP-IT), please login here:
|
||||
### [URL_TO_SITE_SPECIFIC_GIT_REPO]
|
||||
###
|
||||
### DO NOT EDIT THIS FILE DIRECTLY.
|
||||
|
||||
### A note on Secrets:
|
||||
###
|
||||
### Variable with a value of <VAULT> will be fetched from a central component
|
||||
### upon each bridgehead startup.
|
||||
### Using the proven Vaultwarden password manager puts you in full control of
|
||||
### who can read the passwords. In particular, as long as you don't declare a
|
||||
### secret as shared ("SITE+DKFZ"), DKFZ cannot read these strings.
|
||||
### We recommend putting credentials such as local passwords into the password
|
||||
### store, not the git repo. Please keep your master password safe (vault.conf).
|
||||
|
||||
|
||||
### Common Configuration of all Components
|
||||
## This is a descriptive human readable name of your site (e.g. Belgium)
|
||||
SITE_NAME=<National node>
|
||||
## This is the id for your site used in machine to machine communication (should be
|
||||
## lower-case, e.g. belgium)
|
||||
SITE_ID=<National node>
|
||||
## This server's hostname, for access from other computers within your institution
|
||||
## (e.g. mybridgehead.intern.myinstitution.org)
|
||||
## Optional. If left empty, this is auto-generated via the `hostname` command.
|
||||
HOST=
|
||||
|
||||
## Proxy Configuration
|
||||
# leave empty if not applicable
|
||||
# eg.: http://my-proxy-host:my-proxy-port
|
||||
HTTP_PROXY_URL=
|
||||
HTTP_PROXY_USERNAME=
|
||||
HTTP_PROXY_PASSWORD=
|
||||
HTTPS_PROXY_URL=$HTTP_PROXY_URL
|
||||
HTTPS_PROXY_USERNAME=$HTTP_PROXY_USERNAME
|
||||
HTTPS_PROXY_PASSWORD=$HTTP_PROXY_PASSWORD
|
||||
|
||||
## Maintenance Configuration
|
||||
# By default, the bridgehead regularly performs certain housekeeping tasks such as pruning of old docker images to not run out of disk space.
|
||||
# Set the following to false to opt-out. (Default: true)
|
||||
#AUTO_HOUSEKEEPING=
|
||||
|
||||
### Connector Configuration
|
||||
## The operator of the specific site.
|
||||
OPERATOR_FIRST_NAME=
|
||||
OPERATOR_LAST_NAME=
|
||||
OPERATOR_EMAIL=
|
||||
OPERATOR_PHONE=
|
||||
## SMTP Server
|
||||
# ex.: mailhost.intern.klinik.de
|
||||
MAIL_HOST=
|
||||
MAIL_PORT=
|
||||
# ex.: no-reply@bridgehead.intern.klinik.de
|
||||
MAIL_FROM_ADDRESS=
|
||||
MAIL_FROM_NAME=
|
||||
|
||||
### Monitoring
|
||||
# The apikey used for reporting to the central DKFZ monitoring. Leave empty to opt out.
|
||||
MONITOR_APIKEY=
|
||||
|
||||
### Biobanking (BBMRI) specifics
|
||||
## We consider BBMRI as BBMRI-ERIC (European) and German Biobank Node (Germany).
|
||||
## Obviously, all German biobanks are by definition also European. Thus,
|
||||
## any Bridgehead will by default connect to the BBMRI-ERIC services but not
|
||||
## the national ones. We aim to proceed similarly for other BBMRI-ERIC National Nodes.
|
||||
##
|
||||
## The default values are correct for biobanks outside Germany.
|
||||
## For a biobank inside Germany, set ENABLE_GBN=true.
|
||||
# Connect to the European services, e.g. BBMRI-ERIC Sample Locator (Default: true)
|
||||
ENABLE_ERIC=false
|
||||
# Connect to the German services, e.g. Biobank Node Sample Locator (Default: false)
|
||||
# Set this to true in German biobanks!
|
||||
ENABLE_GBN=false
|
||||
# Connect to the ECDC services, e.g. ECDC Sample Locator (Default: false)
|
||||
# Set this to true in ECDC national nodes!
|
||||
ENABLE_EHDS2=true
|
||||
|
82
bbmri/modules/ehds2-compose.yml
Normal file
82
bbmri/modules/ehds2-compose.yml
Normal file
@ -0,0 +1,82 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
focus-ehds2:
|
||||
#image: docker.verbis.dkfz.de/cache/samply/focus:${FOCUS_TAG}
|
||||
image: samply/focus
|
||||
container_name: bridgehead-focus-ehds2
|
||||
environment:
|
||||
API_KEY: ${EHDS2_FOCUS_BEAM_SECRET_SHORT}
|
||||
BEAM_APP_ID_LONG: focus.${EHDS2_PROXY_ID}
|
||||
PROXY_ID: ${EHDS2_PROXY_ID}
|
||||
BLAZE_URL: "http://blaze:8080/fhir/"
|
||||
BEAM_PROXY_URL: http://beam-proxy-ehds2:8081
|
||||
RETRY_COUNT: ${FOCUS_RETRY_COUNT}
|
||||
OBFUSCATE: "no"
|
||||
depends_on:
|
||||
- "beam-proxy-ehds2"
|
||||
- "blaze"
|
||||
|
||||
beam-proxy-ehds2:
|
||||
image: docker.verbis.dkfz.de/cache/samply/beam-proxy:develop
|
||||
container_name: bridgehead-beam-proxy-ehds2
|
||||
environment:
|
||||
BROKER_URL: ${EHDS2_BROKER_URL}
|
||||
PROXY_ID: ${EHDS2_PROXY_ID}
|
||||
APP_focus_KEY: ${EHDS2_FOCUS_BEAM_SECRET_SHORT}
|
||||
PRIVKEY_FILE: /run/secrets/proxy.pem
|
||||
ALL_PROXY: http://forward_proxy:3128
|
||||
TLS_CA_CERTIFICATES_DIR: /conf/trusted-ca-certs
|
||||
ROOTCERT_FILE: /conf/root.crt.pem
|
||||
secrets:
|
||||
- proxy.pem
|
||||
depends_on:
|
||||
- "forward_proxy"
|
||||
volumes:
|
||||
- /etc/bridgehead/trusted-ca-certs:/conf/trusted-ca-certs:ro
|
||||
- /srv/docker/bridgehead/bbmri/modules/${EHDS2_ROOT_CERT}.root.crt.pem:/conf/root.crt.pem:ro
|
||||
|
||||
# Convert ECDC CSV file into FHIR and push to Blaze
|
||||
transfair:
|
||||
container_name: transfair
|
||||
image: samply/transfair
|
||||
environment:
|
||||
FHIR_INPUT_URL: "http://source_blaze:8080/fhir"
|
||||
FHIR_OUTPUT_URL: "http://bridgehead-bbmri-blaze:8080/fhir"
|
||||
PROFILE: "amr2fhir"
|
||||
#WRITE_BUNDLES_TO_FILE: "true"
|
||||
AMR_FILE_PATH: "/app/data"
|
||||
restart: on-failure
|
||||
# The start up logic for TransFAIR is kind of complicated for the ECDC/EHDS2
|
||||
# pilot. This is because we only want to run it if 1. there are source data
|
||||
# files to be transformed and 2. if there is no lock file. We also need to
|
||||
# wait for Blaze to start, TransFAIR does not check for this. And finally,
|
||||
# once TransFAIR has finished loading data, a lock file is created, to stop
|
||||
# a time-consuming repeat run.
|
||||
command: bash -c " \
|
||||
echo listing /app/data && \
|
||||
ls -la /app/data && \
|
||||
ls /app/data/*.[cC][sS][vV] 1> /dev/null 2>&1 && \
|
||||
[ ! -f /app/data/lock ] && \
|
||||
( \
|
||||
echo 'Wait for Blaze to finish initializing' ; \
|
||||
sleep 360 ; \
|
||||
echo 'Remove old output files' ; \
|
||||
rm -rf /app/test/* ; \
|
||||
cd /app ; \
|
||||
echo 'Run TransFAIR' ; \
|
||||
java -jar transFAIR.jar ; \
|
||||
echo 'Touching lock file' ; \
|
||||
touch /app/data/lock \
|
||||
) & tail -f /dev/null"
|
||||
# If you put .csv files into ./../ecdc/data, TransFAIR will try to process them.
|
||||
volumes:
|
||||
- ../../ecdc/test:/app/test/
|
||||
- ../../ecdc/data:/app/data/
|
||||
|
||||
# Report on the data pushed to Blaze by TransFAIR
|
||||
test-data-loader:
|
||||
container_name: test-data-loader
|
||||
image: samply/test-data-loader
|
||||
command: sh -c "sleep 420 && echo Listing all resources in FHIR store && blazectl --server http://bridgehead-bbmri-blaze:8080/fhir count-resources && tail -f /dev/null"
|
||||
|
28
bbmri/modules/ehds2-setup.sh
Normal file
28
bbmri/modules/ehds2-setup.sh
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ "${ENABLE_EHDS2}" == "true" ]; then
|
||||
log INFO "EHDS2 setup detected -- will start services for German Biobank Node."
|
||||
OVERRIDE+=" -f ./$PROJECT/modules/ehds2-compose.yml"
|
||||
|
||||
# The environment needs to be defined in /etc/bridgehead
|
||||
case "$ENVIRONMENT" in
|
||||
"production")
|
||||
export EHDS2_BROKER_ID=ecdc-vm-ehds-test1.swedencentral.cloudapp.azure.com
|
||||
export EHDS2_ROOT_CERT=ehds2
|
||||
;;
|
||||
"test")
|
||||
export EHDS2_BROKER_ID=ecdc-vm-ehds-test1.swedencentral.cloudapp.azure.com
|
||||
export EHDS2_ROOT_CERT=ehds2.test
|
||||
;;
|
||||
*)
|
||||
report_error 6 "Environment \"$ENVIRONMENT\" is unknown. Assuming production. FIX THIS!"
|
||||
export EHDS2_BROKER_ID=ecdc-vm-ehds-test1.swedencentral.cloudapp.azure.com
|
||||
export EHDS2_ROOT_CERT=ehds2
|
||||
;;
|
||||
esac
|
||||
|
||||
EHDS2_BROKER_URL=https://${EHDS2_BROKER_ID}
|
||||
EHDS2_PROXY_ID=${SITE_ID}.${EHDS2_BROKER_ID}
|
||||
EHDS2_FOCUS_BEAM_SECRET_SHORT="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 20)"
|
||||
EHDS2_SUPPORT_EMAIL=feedback@germanbiobanknode.de
|
||||
fi
|
22
bbmri/modules/ehds2.root.crt.pem
Normal file
22
bbmri/modules/ehds2.root.crt.pem
Normal file
@ -0,0 +1,22 @@
|
||||
# EHDS2/ECDC certificate
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDNTCCAh2gAwIBAgIUamQJB/Uevzf3+qrDQOqA8mwkwX8wDQYJKoZIhvcNAQEL
|
||||
BQAwFjEUMBIGA1UEAxMLQnJva2VyLVJvb3QwHhcNMjQwMjA3MTQ1MTQxWhcNMzQw
|
||||
MjA0MTQ1MjExWjAWMRQwEgYDVQQDEwtCcm9rZXItUm9vdDCCASIwDQYJKoZIhvcN
|
||||
AQEBBQADggEPADCCAQoCggEBAKvI2XT0os20vG7d8FjRuMq9mALcQgLZvjAbQZbm
|
||||
JyeVxRQP5HsSrBlBwaZWgmXWFfIPlwsEsTAUsCneAl4ZL3gQ6831nbmmpgThOEVy
|
||||
rGBsbL6qlEWWplD/AGpcdEbAuDmuMSO9tKR6iRm+acTHJcXqsDm2HUUS7U+ManWY
|
||||
S0dG10beJE2eVtEv5/fnFlVSn72VgAVgXVl7UA5E77zXK9GUAyQ6Oo7MET9zifZ/
|
||||
EifeSoEvLk+U7HRLgQbKz2ti6ABh0wnK7Ec2DjekMBXyeQz0tR+8dS53s5pqti7c
|
||||
SUQMHmL4jKxvfQr7fr5wbJpFDu37Vif9GdND9WSDRcufuM8CAwEAAaN7MHkwDgYD
|
||||
VR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKMF6QgDV4cV
|
||||
WyQZn3EHKLUumXzuMB8GA1UdIwQYMBaAFKMF6QgDV4cVWyQZn3EHKLUumXzuMBYG
|
||||
A1UdEQQPMA2CC0Jyb2tlci1Sb290MA0GCSqGSIb3DQEBCwUAA4IBAQAhhE0ht7Sp
|
||||
inKLJSVZrdFHbAbRXnYcUz/3oyy/uw0YvF0dJAHz2sgbtCLMHzKU7NwotaEqZedA
|
||||
I7688nI42aHggIkwa1CzmFo9ybQ2afgrYNeF+TcTQI6G+fFpeRT5I+FvA9hUI3r4
|
||||
Kp63Si7cpQS5uiHs90sv2SNMedo2Gf9VyJKB7NOReQJWsrw32ITi4QLNKHcHciKm
|
||||
cpi/OqbR1YTJRoUrcC655G7bSKENzccdTWo8kBJgYLVbe+FohqgheqPqWpdH2zoR
|
||||
OxOwviutfJTNvDyhXu8FrDc5tr9f5VjXv1hK2szYuvggwbybUBB9bLsx+fV79oZe
|
||||
3zR0j5YwB28G
|
||||
-----END CERTIFICATE-----
|
||||
|
22
bbmri/modules/ehds2.test.root.crt.pem
Normal file
22
bbmri/modules/ehds2.test.root.crt.pem
Normal file
@ -0,0 +1,22 @@
|
||||
# EHDS2/ECDC certificate
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDNTCCAh2gAwIBAgIUamQJB/Uevzf3+qrDQOqA8mwkwX8wDQYJKoZIhvcNAQEL
|
||||
BQAwFjEUMBIGA1UEAxMLQnJva2VyLVJvb3QwHhcNMjQwMjA3MTQ1MTQxWhcNMzQw
|
||||
MjA0MTQ1MjExWjAWMRQwEgYDVQQDEwtCcm9rZXItUm9vdDCCASIwDQYJKoZIhvcN
|
||||
AQEBBQADggEPADCCAQoCggEBAKvI2XT0os20vG7d8FjRuMq9mALcQgLZvjAbQZbm
|
||||
JyeVxRQP5HsSrBlBwaZWgmXWFfIPlwsEsTAUsCneAl4ZL3gQ6831nbmmpgThOEVy
|
||||
rGBsbL6qlEWWplD/AGpcdEbAuDmuMSO9tKR6iRm+acTHJcXqsDm2HUUS7U+ManWY
|
||||
S0dG10beJE2eVtEv5/fnFlVSn72VgAVgXVl7UA5E77zXK9GUAyQ6Oo7MET9zifZ/
|
||||
EifeSoEvLk+U7HRLgQbKz2ti6ABh0wnK7Ec2DjekMBXyeQz0tR+8dS53s5pqti7c
|
||||
SUQMHmL4jKxvfQr7fr5wbJpFDu37Vif9GdND9WSDRcufuM8CAwEAAaN7MHkwDgYD
|
||||
VR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFKMF6QgDV4cV
|
||||
WyQZn3EHKLUumXzuMB8GA1UdIwQYMBaAFKMF6QgDV4cVWyQZn3EHKLUumXzuMBYG
|
||||
A1UdEQQPMA2CC0Jyb2tlci1Sb290MA0GCSqGSIb3DQEBCwUAA4IBAQAhhE0ht7Sp
|
||||
inKLJSVZrdFHbAbRXnYcUz/3oyy/uw0YvF0dJAHz2sgbtCLMHzKU7NwotaEqZedA
|
||||
I7688nI42aHggIkwa1CzmFo9ybQ2afgrYNeF+TcTQI6G+fFpeRT5I+FvA9hUI3r4
|
||||
Kp63Si7cpQS5uiHs90sv2SNMedo2Gf9VyJKB7NOReQJWsrw32ITi4QLNKHcHciKm
|
||||
cpi/OqbR1YTJRoUrcC655G7bSKENzccdTWo8kBJgYLVbe+FohqgheqPqWpdH2zoR
|
||||
OxOwviutfJTNvDyhXu8FrDc5tr9f5VjXv1hK2szYuvggwbybUBB9bLsx+fV79oZe
|
||||
3zR0j5YwB28G
|
||||
-----END CERTIFICATE-----
|
||||
|
15
bbmri/vars
15
bbmri/vars
@ -4,7 +4,10 @@
|
||||
# Makes only sense for German Biobanks
|
||||
: ${ENABLE_GBN:=false}
|
||||
|
||||
FOCUS_RETRY_COUNT=32
|
||||
# Makes only sense for EHDS2 project
|
||||
: ${ENABLE_EHDS2:=false}
|
||||
|
||||
FOCUS_RETRY_COUNT=128
|
||||
PRIVATEKEYFILENAME=/etc/bridgehead/pki/${SITE_ID}.priv.pem
|
||||
|
||||
for module in $PROJECT/modules/*.sh
|
||||
@ -14,12 +17,16 @@ do
|
||||
done
|
||||
|
||||
SUPPORT_EMAIL=$ERIC_SUPPORT_EMAIL
|
||||
BROKER_URL_FOR_PREREQ="${ERIC_BROKER_URL:-$GBN_BROKER_URL}"
|
||||
BROKER_URL_FOR_PREREQ="https://ecdc-vm-ehds-test1.swedencentral.cloudapp.azure.com"
|
||||
|
||||
if [ -n "$GBN_SUPPORT_EMAIL" ]; then
|
||||
SUPPORT_EMAIL=$GBN_SUPPORT_EMAIL
|
||||
fi
|
||||
|
||||
if [ -n "$EHDS2_SUPPORT_EMAIL" ]; then
|
||||
SUPPORT_EMAIL=$EHDS2_SUPPORT_EMAIL
|
||||
fi
|
||||
|
||||
function do_enroll {
|
||||
COUNT=0
|
||||
if [ "$ENABLE_ERIC" == "true" ]; then
|
||||
@ -30,6 +37,10 @@ function do_enroll {
|
||||
do_enroll_inner $GBN_PROXY_ID $GBN_SUPPORT_EMAIL
|
||||
COUNT=$((COUNT+1))
|
||||
fi
|
||||
if [ "$ENABLE_EHDS2" == "true" ]; then
|
||||
do_enroll_inner $EHDS2_PROXY_ID $EHDS2_SUPPORT_EMAIL
|
||||
COUNT=$((COUNT+1))
|
||||
fi
|
||||
if [ $COUNT -ge 2 ]; then
|
||||
echo
|
||||
echo "You just received $COUNT certificate signing requests (CSR). Please send $COUNT e-mails, with 1 CSR each, to the respective e-mail address."
|
||||
|
13
bridgehead
13
bridgehead
@ -88,7 +88,20 @@ case "$ACTION" in
|
||||
start)
|
||||
loadVars
|
||||
hc_send log "Bridgehead $PROJECT startup: Checking requirements ..."
|
||||
chown -R bridgehead ${BASE}
|
||||
checkRequirements
|
||||
# Note: changes to "bridgehead" script will only take effect after next start.
|
||||
su bridgehead -c "git pull"
|
||||
chown -R bridgehead ${BASE}
|
||||
# Local versions of focus and transfair are needed by EHDS2
|
||||
clone_focus_if_nonexistent ${BASE}/..
|
||||
build_focus ${BASE}/..
|
||||
clone_transfair_if_nonexistent ${BASE}/..
|
||||
build_transfair ${BASE}/..
|
||||
# Location for input data and results for EHDS2
|
||||
mkdir -p ${BASE}/../ecdc/test
|
||||
mkdir -p ${BASE}/../ecdc/data
|
||||
chown -R bridgehead ${BASE}/../ecdc
|
||||
hc_send log "Bridgehead $PROJECT startup: Requirements checked out. Now starting bridgehead ..."
|
||||
exec $COMPOSE -p $PROJECT -f ./minimal/docker-compose.yml -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit
|
||||
;;
|
||||
|
14
ecdc.service
Normal file
14
ecdc.service
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Start ECDC Bridgehead
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/srv/docker/bridgehead/restart_service.sh
|
||||
ExecStop=/srv/docker/bridgehead/shutdown_service.sh
|
||||
Restart=always
|
||||
RestartSec=36000
|
||||
KillMode=mixed
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
@ -239,3 +239,67 @@ add_basic_auth_user() {
|
||||
log DEBUG "Saving clear text credentials in $FILE. If wanted, delete them manually."
|
||||
sed -i "/^$NAME/ s|$|\n# User: $USER\n# Password: $PASSWORD|" $FILE
|
||||
}
|
||||
|
||||
function clone_repo_if_nonexistent() {
|
||||
local repo_url="$1" # First argument: Repository URL
|
||||
local target_dir="$2" # Second argument: Target directory
|
||||
local branch_name="$3" # Third argument: Branch name
|
||||
|
||||
echo Repo directory: $target_dir
|
||||
|
||||
# Check if the target directory exists
|
||||
if [ ! -d "$target_dir" ]; then
|
||||
echo "Directory '$target_dir' does not exist. Cloning the repository..."
|
||||
# Clone the repository
|
||||
git clone "$repo_url" "$target_dir"
|
||||
fi
|
||||
|
||||
# Change to the cloned directory
|
||||
cd "$target_dir"
|
||||
|
||||
# Checkout the specified branch
|
||||
chown -R bridgehead .
|
||||
su bridgehead -c "git checkout $branch_name"
|
||||
|
||||
cd -
|
||||
}
|
||||
|
||||
function clone_transfair_if_nonexistent() {
|
||||
local base_dir="$1"
|
||||
|
||||
clone_repo_if_nonexistent https://github.com/samply/transFAIR.git $base_dir/transfair ehds2
|
||||
}
|
||||
|
||||
function clone_focus_if_nonexistent() {
|
||||
local base_dir="$1"
|
||||
|
||||
clone_repo_if_nonexistent https://github.com/samply/focus.git $base_dir/focus ehds2
|
||||
}
|
||||
|
||||
|
||||
function build_transfair() {
|
||||
local base_dir="$1"
|
||||
|
||||
# We only take the touble to build transfair if:
|
||||
#
|
||||
# 1. There is data available (any CSV files) and
|
||||
# 2. There is no data lock file (which means that no ETL has yet been run).
|
||||
if ls ../ecdc/data/*.[cC][sS][vV] 1> /dev/null 2>&1 && [ ! -f ../ecdc/data/lock ]; then
|
||||
cd $base_dir/transfair
|
||||
su bridgehead -c "git pull"
|
||||
docker build --progress=plain -t samply/transfair --no-cache .
|
||||
chown -R bridgehead .
|
||||
cd -
|
||||
fi
|
||||
}
|
||||
|
||||
function build_focus() {
|
||||
local base_dir="$1"
|
||||
|
||||
cd $base_dir/focus
|
||||
su bridgehead -c "git pull"
|
||||
docker build --progress=plain -f DockerfileWithBuild -t samply/focus --no-cache .
|
||||
chown -R bridgehead .
|
||||
cd -
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ else
|
||||
SYNCTEXT="For example, consider entering a correct NTP server (e.g. your institution's Active Directory Domain Controller in /etc/systemd/timesyncd.conf (option NTP=) and restart systemd-timesyncd."
|
||||
if [ $SKEW -ge 300 ]; then
|
||||
report_error 5 "Your clock is not synchronized (${SKEW}s off). This will cause Samply.Beam's certificate will fail. Please setup time synchronization. $SYNCTEXT"
|
||||
exit 1
|
||||
log WARN "Server Time Error"
|
||||
elif [ $SKEW -ge 60 ]; then
|
||||
log WARN "Your clock is more than a minute off (${SKEW}s). Consider syncing to a time server. $SYNCTEXT"
|
||||
fi
|
||||
|
@ -45,7 +45,7 @@ services:
|
||||
|
||||
landing:
|
||||
container_name: bridgehead-landingpage
|
||||
image: docker.verbis.dkfz.de/cache/samply/bridgehead-landingpage:main
|
||||
image: docker.verbis.dkfz.de/cache/samply/bridgehead-landingpage:master
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.landing.rule=PathPrefix(`/`)"
|
||||
|
30
restart_service.sh
Executable file
30
restart_service.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start a running Bridgehead. If there is already a Bridgehead running,
|
||||
# stop it first.
|
||||
# This is intended to be used by systemctl.
|
||||
|
||||
cd /srv/docker/bridgehead
|
||||
|
||||
echo "git status before stop"
|
||||
git status
|
||||
|
||||
echo "Stopping running Bridgehead, if present"
|
||||
./bridgehead stop bbmri
|
||||
|
||||
# If "flush_blaze" is present, delete the Blaze volume before starting
|
||||
# the Bridgehead again. This allows a user to upload all data, if
|
||||
# requested.
|
||||
if [ -f "/srv/docker/ecdc/data/flush_blaze" ]; then
|
||||
docker volume rm bbmri_blaze-data
|
||||
rm -f /srv/docker/ecdc/data/flush_blaze
|
||||
fi
|
||||
|
||||
echo "git status before start"
|
||||
git status | systemd-cat -p info
|
||||
|
||||
echo "Start the Bridgehead anew"
|
||||
./bridgehead start bbmri
|
||||
|
||||
echo "Bridgehead has unexpectedly terminated"
|
||||
|
83
run.sh
Executable file
83
run.sh
Executable file
@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Start a Bridgehead from the command line. Upload data if requested.
|
||||
# Behind the scenes we use systemctl to do the work.
|
||||
|
||||
# Function to print usage
|
||||
print_usage() {
|
||||
echo "Start a Bridghead, optionally upload data"
|
||||
echo "Usage: $0 [--upload | --upload-all | --help | -h]"
|
||||
echo "Options:"
|
||||
echo " --upload Run Bridgehead and upload just the new CSV data files."
|
||||
echo " --upload-all Run Bridgehead and upload all CSV data files."
|
||||
echo " --help, -h Display this help message."
|
||||
echo " No options Run Bridgehead only."
|
||||
}
|
||||
|
||||
# Initialize variables
|
||||
UPLOAD=false
|
||||
UPLOAD_ALL=false
|
||||
|
||||
# Parse arguments
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
case $1 in
|
||||
--upload)
|
||||
UPLOAD=true
|
||||
;;
|
||||
--upload-all)
|
||||
UPLOAD_ALL=true
|
||||
;;
|
||||
--help|-h)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown argument '$1'"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Check for conflicting options
|
||||
if [ "$UPLOAD" = true ] && [ "$UPLOAD_ALL" = true ]; then
|
||||
echo "Error: you must specify either --upload or --upload-all, specifying both is not permitted."
|
||||
print_usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Disable/stop standard Bridgehead systemctl services, if present
|
||||
sudo systemctl disable bridgehead@bbmri.service >& /dev/null
|
||||
sudo systemctl disable system-bridgehead.slice >& /dev/null
|
||||
sudo systemctl disable bridgehead-update@bbmri.timer >& /dev/null
|
||||
sudo systemctl stop bridgehead@bbmri.service >& /dev/null
|
||||
sudo systemctl stop system-bridgehead.slice >& /dev/null
|
||||
sudo systemctl stop bridgehead-update@bbmri.timer >& /dev/null
|
||||
|
||||
# Set up systemctl for EHDS2/ECDC if necessary
|
||||
cp /srv/docker/bridgehead/ecdc.service /etc/systemd/system
|
||||
systemctl daemon-reload
|
||||
systemctl enable ecdc.service
|
||||
|
||||
# Use systemctl to stop the Bridgehead if it is running
|
||||
sudo systemctl stop ecdc.service
|
||||
|
||||
# Use files to tell the Bridgehead what to do with any data present
|
||||
if [ "$UPLOAD" = true ] || [ "$UPLOAD_ALL" = true ]; then
|
||||
if [ -f /srv/docker/ecdc/data/lock ]; then
|
||||
rm /srv/docker/ecdc/data/lock
|
||||
fi
|
||||
fi
|
||||
if [ "$UPLOAD_ALL" = true ]; then
|
||||
echo "All CSV files in /srv/docker/ecdc/data will be uploaded"
|
||||
touch /srv/docker/ecdc/data/flush_blaze
|
||||
fi
|
||||
|
||||
# Start up the Bridgehead
|
||||
sudo systemctl start ecdc.service
|
||||
|
||||
# Show status of Bridgehead service
|
||||
sleep 10
|
||||
systemctl status ecdc.service
|
||||
|
13
shutdown_service.sh
Executable file
13
shutdown_service.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Shut down a running Bridgehead.
|
||||
# This is intended to be used by systemctl.
|
||||
|
||||
cd /srv/docker/bridgehead
|
||||
|
||||
echo "git status before stop"
|
||||
git status
|
||||
|
||||
echo "Stopping running Bridgehead, if present"
|
||||
./bridgehead stop bbmri
|
||||
|
43
stop.sh
Executable file
43
stop.sh
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Shut down a running Bridgehead.
|
||||
# Behind the scenes we use systemctl to do the work.
|
||||
|
||||
# Function to print usage
|
||||
print_usage() {
|
||||
echo "Stop the running Bridgehead"
|
||||
echo "Usage: $0 [--help | -h]"
|
||||
echo "Options:"
|
||||
echo " --help, -h Display this help message."
|
||||
echo " No options Stop Bridgehead only."
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
while [[ "$#" -gt 0 ]]; do
|
||||
case $1 in
|
||||
--help|-h)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown argument '$1'"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Set up systemctl for EHDS2/ECDC if necessary
|
||||
cp /srv/docker/bridgehead/ecdc.service /etc/systemd/system
|
||||
systemctl daemon-reload
|
||||
systemctl enable ecdc.service
|
||||
|
||||
# Use systemctl to stop the Bridgehead if it is running
|
||||
sudo systemctl stop ecdc.service
|
||||
|
||||
# Show status of Bridgehead service
|
||||
sleep 20
|
||||
systemctl status ecdc.service
|
||||
docker ps
|
||||
|
Reference in New Issue
Block a user