bridgehead/README.md

303 lines
14 KiB
Markdown
Raw Normal View History

# Bridgehead
2022-03-23 11:54:23 +01:00
A Bridgehead is a set of components that must be installed locally, in order to connect your clinic or research centre to a federated search system. This repository contains the information and tools that you will need to deploy a Bridgehead. If you have questions, please [contact us](mailto:verbis-support@dkfz-heidelberg.de).
2022-03-23 11:54:23 +01:00
TOC
1. [Requirements](#requirements)
- [Hardware](#hardware)
- [System](#system)
- [Git](#git)
- [Docker](#docker)
2. [Deployment](#deployment)
- [Installation](#installation)
- [Register with Beam](#register-with-beam)
- [Starting and stopping your Bridgehead](#starting-and-stopping-your-bridgehead)
- [Auto-starting your Bridgehead when the server starts](#auto-starting-your-bridgehead-when-the-server-starts)
3. [Additional Services](#additional-Services)
- [Monitoring](#monitoring)
- [Register with a Directory](#register-with-a-Directory)
4. [Site-specific configuration](#site-specific-configuration)
- [HTTPS Access](#https-access)
- [Locally Managed Secrets](#locally-managed-secrets)
- [Git Proxy Configuration](#git-proxy-configuration)
- [Docker Daemon Proxy Configuration](#docker-daemon-proxy-configuration)
- [Non-Linux OS](#non-linux-os)
5. [License](#license)
2022-03-23 11:54:23 +01:00
## Requirements
2022-03-23 11:54:23 +01:00
### Hardware
To get the most out of your Bridgehead, we recommend the follwing Hardware:
2022-03-23 11:54:23 +01:00
- 4 CPU cores
- At least 8 GB Ram
- 100GB Hard Drive, SSD recommended
2022-03-23 11:54:23 +01:00
### System
2022-03-23 11:54:23 +01:00
You are strongly recommended to install the Bridgehead under a Linux operating system (but see the section [Non-Linux OS](#non-linux-os)). You will need root (administrator) priveleges on this machine in order to perform the deployment.
2022-03-23 11:54:23 +01:00
The following software should be installed:
2021-12-27 11:16:27 +01:00
#### Git
Check if you have at least git 2.0 installed on the system with:
``` shell
git --version
```
#### Docker
2022-03-23 11:54:23 +01:00
Check the installed Docker version:
2022-05-12 13:00:08 +02:00
``` shell
2022-05-12 13:00:08 +02:00
docker --version
```
The version should ideally be higher than "20.10.1". The next step is to check ``` docker-compose``` with:
2022-03-01 17:24:53 +01:00
``` shell
2022-05-12 13:00:08 +02:00
docker-compose --version
2022-03-01 17:24:53 +01:00
```
The recomended version is "2.XX" and higher.
2022-01-10 14:32:40 +01:00
If docker or docker-compose are not installed, please refer to the [Docker website](https://docs.docker.com).
2022-05-12 13:00:08 +02:00
## Deployment
2022-03-23 11:54:23 +01:00
### Installation
2021-12-27 11:16:27 +01:00
First, clone the repository to the directory "/srv/docker/bridgehead":
``` shell
2022-03-23 11:54:23 +01:00
sudo mkdir -p /srv/docker/;
sudo git clone https://github.com/samply/bridgehead.git /srv/docker/bridgehead;
```
Now create a user for the Bridgehead service:
2022-05-09 12:57:24 +02:00
``` shell
sudo useradd -M -g docker -N -s /sbin/nologin bridgehead
```
After adding the user you will need to change the ownership of the directory to the Bridgehead user.
``` shell
sudo chown bridgehead /srv/docker/bridgehead/ -R
2022-05-05 15:03:06 +02:00
```
2022-10-26 16:34:47 +02:00
Download the configuration repository:
``` shell
sudo git clone https://github.com/samply/bridgehead-config.git -b fix/bbmri-config /etc/bridgehead;
```
Change ownership:
``` shell
sudo chown bridgehead /etc/bridgehead/ -R
```
Edit /etc/bridgehead/bbmri.conf and modify SITE_ID and SITE_NAME to be relevant to your biobank. SITE_ID should not contains spaces. By convention, it is lower-case. E.g.:
```
SITE_ID="toulouse-prod"
SITE_NAME="Toulouse"
2022-10-26 16:34:47 +02:00
```
### Register with Beam
2022-10-26 16:34:47 +02:00
You will need to register with Beam in order to be able to start your Bridgehead. Please send an email to: bridgehead@helpdesk.bbmri-eric.eu, mentioning the SITE_ID that you chose above.
The response will contain your private key for Beam.
Create a file for this private key:
``` shell
/etc/bridgehead/pki/$SITE_ID.priv.pem
2022-10-26 16:34:47 +02:00
```
### Starting and stopping your Bridgehead
To start your new Bridgehead, type:
2022-10-26 16:34:47 +02:00
```shell
sudo /srv/docker/bridgehead/bridgehead start bbmri
```
The script may break, because Spot tries to connect to Blaze, but Blaze is not yet ready, causing Spot to terminate. Try to start and stop the script a few times.
To shut down the Bridgehead, type:
```shell
sudo /srv/docker/bridgehead/bridgehead stop bbmri
```
2022-05-12 13:00:08 +02:00
### Auto-starting your Bridgehead when the server starts
Using this feature is optional.
Many Linux distributions support the "systemctl" command, which enables you to autostart processes whenever your server is booted.
In this repository you will find tools that allow you to take advantage of "systemctl" to automatically start the Bridgehead whenever your server gets restarted. You can set this up by executing the [bridgehead](./bridgehead) script:
``` shell
sudo /srv/docker/bridgehead/bridgehead install bbmri
```
This will install the systemd units to run and update the Bridgehead.
2022-05-12 13:00:08 +02:00
If your site operates with a proxy, you will need to set it up with ```systemctl edit``` as follows:
2022-03-01 17:24:53 +01:00
``` shell
sudo systemctl edit bridgehead@bbmri.service;
2022-03-01 17:24:53 +01:00
```
This will open your default editor allowing you to edit the docker system units configuration. Insert the following lines in the editor and define your machines secrets.
2022-03-01 17:24:53 +01:00
``` conf
[Service]
Environment=HOSTIP=
Environment=HOST=
Environment=HTTP_PROXY_USER=
Environment=HTTP_PROXY_PASSWORD=
Environment=HTTPS_PROXY_USER=
Environment=HTTPS_PROXY_PASSWORD=
Environment=CONNECTOR_POSTGRES_PASS=
2022-03-01 17:24:53 +01:00
```
To make the configuration active, you need to tell systemd to reload the configuration and restart the docker service:
2022-05-05 15:03:06 +02:00
``` shell
sudo systemctl daemon-reload;
sudo systemctl bridgehead@bbmri.service;
```
2021-12-27 11:16:27 +01:00
## Additional Services
### Monitoring
We provide a central monitoring service, which checks the health of your Bridgehead 24/7. Using this service is optional but recommended.
2022-03-23 11:54:23 +01:00
You can register for it by sending a request to: bridgehead@helpdesk.bbmri-eric.eu.
2022-10-26 10:42:07 +02:00
The confirmation of your registration will contain a monitoring API key.
2022-05-05 15:03:06 +02:00
You need to add the key to the "/etc/bridgehead/bbmri.conf" file, e.g.:
``` conf
MONITOR_APIKEY=1b9e5e21-8b34-5382-8590-7eae98a4f6d3
```
(your key will be different to the one shown above, obviously).
2022-05-12 13:00:08 +02:00
Your site should now show up in the monitoring with grey (updates) and green (query) messages at the next full hour.
2022-05-12 13:00:08 +02:00
### Register with a Directory
The [Directory](https://directory.bbmri-eric.eu/) is a BBMRI project that aims to catalog all biobanks in Europe and beyond. Each biobank is given its own unique ID and the Directory maintains counts of the number of donors and the number of samples held at each biobank. You are strongly encouraged to register with the Directory, because this opens the door to further services, such as the [Negotiator](https://negotiator.bbmri-eric.eu/login.xhtml).
Generally, you should register with the BBMRI national node for the country where your biobank is based. You can find a list of contacts for the national nodes [here](http://www.bbmri-eric.eu/national-nodes/). If your country is not in this list, or you have any questions, please contact the [BBMRI helpdesk](mailto:directory@helpdesk.bbmri-eric.eu). If your biobank is for COVID samples, you can also take advantage of an accelerated registration process [here](https://docs.google.com/forms/d/e/1FAIpQLSdIFfxADikGUf1GA0M16J0HQfc2NHJ55M_E47TXahju5BlFIQ).
Your national node will give you detailed instructions for registering, but for your information, here are the basic steps:
* Log in to the Directory for your country.
* Add your biobank and enter its details, including contact information for a person involved in running the biobank.
* You will need to create at least one collection.
## Site-specific configuration
2022-05-12 13:00:08 +02:00
2022-05-05 15:03:06 +02:00
### HTTPS Access
We recommend https for all services of your Bridgehead. HTTPS is enabled by default. For starting the Bridgehead you need an ssl certificate. You can either create it yourself or get a signed one. You need to drop the certificates in /certs.
2022-05-05 15:03:06 +02:00
The Bridgehead creates one autotmatically on the first start. However, it will be unsigned and we recomend getting a signed one.
2022-05-05 15:03:06 +02:00
2022-03-23 11:54:23 +01:00
### Locally Managed Secrets
2022-03-23 11:54:23 +01:00
This section describes the secrets you may need to configure locally through the configuration
2022-03-01 17:24:53 +01:00
| Name | Recommended Value | Description |
|--------------------------------------|---------------------------------------------------------------------------------------------------| ----------- |
| HTTP_PROXY_USER | | Your local http proxy user |
| HOSTIP | Compute with: `docker run --rm --add-host=host.docker.internal:host-gateway ubuntu cat /etc/hosts | grep 'host.docker.internal' | awk '{print $1}'` | The ip from which docker containers can reach your host system. |
| HOST | Compute with: `hostname` |The hostname from which all components will eventually be available|
| HTTP_PROXY_PASSWORD | |Your local http proxy user's password|
| HTTPS_PROXY_USER | |Your local https proxy user|
| HTTPS_PROXY_PASSWORD || Your local https proxy user's password |
| CONNECTOR_POSTGRES_PASS | Random String |The password for your project specific connector.|
| STORE_POSTGRES_PASS | Random String |The password for your local datamanagements database (only relevant in c4)|
| ML_DB_PASS | Random String |The password for your local patientlist database|
| MAGICPL_API_KEY | Random String |The apiKey used by the local datamanagement to create pseudonymes.|
| MAGICPL_MAINZELLISTE_API_KEY | Random String |The apiKey used by the local id-manager to communicate with the local patientlist|
| MAGICPL_API_KEY_CONNECTOR | Random String |The apiKey used by the connector to communicate with the local patientlist|
| MAGICPL_MAINZELLISTE_CENTRAL_API_KEY | You need to ask the central patientlists admin for this. |The apiKey for your machine to communicate with the central patientlist|
| MAGICPL_CENTRAL_API_KEY | You need to ask the central controlnumbergenerator admin for this. |The apiKey for your machine to communicate with the central controlnumbergenerator|
| MAGICPL_OIDC_CLIENT_ID || The client id used for your machine, to connect with the central authentication service |
| MAGICPL_OIDC_CLIENT_SECRET || The client secret used for your machine, to connect with the central authentication service |
### Git Proxy Configuration
2022-03-23 11:54:23 +01:00
Unlike most other tools, git doesn't use the default proxy variables "http_proxy" and "https_proxy". To make git use a proxy, you will need to adjust the global git configuration:
``` shell
2022-03-01 17:24:53 +01:00
sudo git config --global http.proxy http://<your-proxy-host>:<your-proxy-port>;
sudo git config --global https.proxy http://<your-proxy-host>:<your-proxy-port>;
```
> NOTE: Some proxies may require user and password authentication. You can adjust the settings like this: "http://<your-proxy-user>:<your-proxy-user-password>@<your-proxy-host>:<your-proxy-port>".
> NOTE: It is also possible that a proxy requires https protocol, so you can replace this to.
You can check that the updated configuration with
``` shell
2022-03-01 17:24:53 +01:00
sudo git config --global --list;
```
### Docker Daemon Proxy Configuration
2022-03-23 11:54:23 +01:00
Docker has a background daemon, responsible for downloading images and starting them. To configure the proxy for this daemon, use the systemctl command:
``` shell
sudo systemctl edit docker
```
2021-12-27 11:16:27 +01:00
This will open your default editor allowing you to edit the docker system units configuration. Insert the following lines in the editor, replace <your-proxy-host> and <your-proxy-port> with the corresponding values for your machine and save the file:
``` conf
[Service]
Environment=HTTP_PROXY=http://<your-proxy-host>:<your-proxy-port>
Environment=HTTPS_PROXY=http://<your-proxy-host>:<your-proxy-port>
Environment=FTP_PROXY=http://<your-proxy-host>:<your-proxy-port>
```
> NOTE: Some proxies may require user and password authentication. You can adjust the settings like this: "http://<your-proxy-user>:<your-proxy-user-password>@<your-proxy-host>:<your-proxy-port>".
> NOTE: It is also possible that a proxy requires https protocol, so you can replace this to.
The file should now be at the location "/etc/systemd/system/docker.service.d/override.conf". You can proof check with
``` shell
cat /etc/systemd/system/docker.service.d/override.conf;
```
To make the configuration effective, you need to tell systemd to reload the configuration and restart the docker service:
``` shell
sudo systemctl daemon-reload;
sudo systemctl restart docker;
```
2022-03-23 11:54:23 +01:00
### Non-Linux OS
2022-03-23 11:54:23 +01:00
The installation procedures described above have only been tested under Linux.
2022-03-23 11:54:23 +01:00
Below are some suggestions for getting the installation to work on other operating systems. Note that we are not able to provide support for these routes!
2022-03-23 11:54:23 +01:00
We believe that it is likely that installation would also work with FreeBSD and MacOS.
2022-03-23 11:54:23 +01:00
Under Windows, you have 2 options:
2022-03-23 11:54:23 +01:00
- Virtual machine
- WSL
2022-03-23 11:54:23 +01:00
We have tested the installation procedure with an Ubuntu 22.04 guest system running on a VMware virtual machine. That worked flawlessly.
2022-03-23 11:54:23 +01:00
Installation under WSL ought to work, but we have not tested this.
2022-03-23 11:54:23 +01:00
## License
Copyright 2019 - 2022 The Samply Community
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.