commit
03452a74fb
|
@ -3,10 +3,4 @@
|
||||||
site-config/*
|
site-config/*
|
||||||
|
|
||||||
## Ignore site configuration
|
## Ignore site configuration
|
||||||
config/**/*
|
*/docker-compose.override.yml
|
||||||
!config/**/*.default
|
|
||||||
landing/*
|
|
||||||
docker-compose.override.yml
|
|
||||||
site.conf
|
|
||||||
auth/*
|
|
||||||
certs/*
|
|
||||||
|
|
581
README.md
581
README.md
|
@ -1,532 +1,175 @@
|
||||||
# Bridgehead
|
# Bridgehead
|
||||||
|
|
||||||
This repository contains all information and tools to deploy a bridgehead. If you have any questions about deploying a bridgehead, please [contact us](mailto:verbis-support@dkfz-heidelberg.de).
|
The Bridgehead is a secure, low-effort solution to connect your research institution to a federated research network. It bundles interoperable, open-source software components into a turnkey package for installation on one of your secure servers. The Bridgehead is pre-configured with sane defaults, centrally monitored and with an absolute minimum of "moving parts" on your side, making it an extremely low-maintenance gateway to data sharing.
|
||||||
|
|
||||||
|
This repository is the starting point for any information and tools you will need to deploy a Bridgehead. If you have questions, please [contact us](mailto:verbis-support@dkfz-heidelberg.de).
|
||||||
|
|
||||||
TOC
|
|
||||||
|
|
||||||
1. [About](#about)
|
|
||||||
- [Projects](#projects)
|
|
||||||
- [GBA/BBMRI-ERIC](#gbabbmri-eric)
|
|
||||||
- [CCP(DKTK/C4)](#ccpdktkc4)
|
|
||||||
- [NNGM](#nngm)
|
|
||||||
- [Bridgehead Components](#bridgehead-components)
|
|
||||||
- [Blaze Server](#blaze-serverhttpsgithubcomsamplyblaze)
|
|
||||||
- [Connector](#connector)
|
|
||||||
1. [Requirements](#requirements)
|
1. [Requirements](#requirements)
|
||||||
- [Hardware](#hardware)
|
- [Hardware](#hardware)
|
||||||
- [System](#system-requirements)
|
- [System](#system)
|
||||||
- [git](#git)
|
- [Git](#git)
|
||||||
- [docker](#dockerhttpsdocsdockercomget-docker)
|
- [Docker](#docker)
|
||||||
- [systemd](#systemd)
|
2. [Deployment](#deployment)
|
||||||
2. [Getting Started](#getting-started)
|
- [Installation](#installation)
|
||||||
- [DKTK](#dktkc4)
|
- [Register with Samply.Beam](#register-with-samplybeam)
|
||||||
- [C4](#c4)
|
- [Starting and stopping your Bridgehead](#starting-and-stopping-your-bridgehead)
|
||||||
- [GBA/BBMRI-ERIC](#gbabbmri-eric)
|
- [Auto-starting your Bridgehead when the server starts](#auto-starting-your-bridgehead-when-the-server-starts)
|
||||||
3. [Configuration](#configuration)
|
3. [Additional Services](#additional-Services)
|
||||||
4. [Managing your Bridgehead](#managing-your-bridgehead)
|
- [Monitoring](#monitoring)
|
||||||
- [Systemd](#on-a-server)
|
- [Register with a Directory](#register-with-a-Directory)
|
||||||
- [Without Systemd](#on-developers-machine)
|
4. [Site-specific configuration](#site-specific-configuration)
|
||||||
4. [Pitfalls](#pitfalls)
|
- [HTTPS Access](#https-access)
|
||||||
5. [Migration-guide](#migration-guide)
|
- [Locally Managed Secrets](#locally-managed-secrets)
|
||||||
7. [License](#license)
|
- [Git Proxy Configuration](#git-proxy-configuration)
|
||||||
|
- [Docker Daemon Proxy Configuration](#docker-daemon-proxy-configuration)
|
||||||
|
- [Non-Linux OS](#non-linux-os)
|
||||||
## About
|
5. [License](#license)
|
||||||
|
|
||||||
TODO: Insert comprehensive feature list of the bridgehead? Why would anyone install it?
|
|
||||||
|
|
||||||
## Projects
|
|
||||||
|
|
||||||
### GBA/BBMRI-ERIC
|
|
||||||
|
|
||||||
The **Sample Locator** is a tool that allows researchers to make searches for samples over a large number of geographically distributed biobanks. Each biobank runs a so-called **Bridgehead** at its site, which makes it visible to the Sample Locator. The Bridgehead is designed to give a high degree of protection to patient data. Additionally, a tool called the [Negotiator][negotiator] puts you in complete control over which samples and which data are delivered to which researcher.
|
|
||||||
|
|
||||||
You will most likely want to make your biobanks visible via the [publicly accessible Sample Locator][sl], but the possibility also exists to install your own Sample Locator for your site or organization, see the GitHub pages for [the server][sl-server-src] and [the GUI][sl-ui-src].
|
|
||||||
|
|
||||||
The Bridgehead has two primary components:
|
|
||||||
* The **Blaze Store**. This is a highly responsive FHIR data store, which you will need to fill with your data via an ETL chain.
|
|
||||||
* The **Connector**. This is the communication portal to the Sample Locator, with specially designed features that make it possible to run it behind a corporate firewall without making any compromises on security.
|
|
||||||
|
|
||||||
### CCP(DKTK/C4)
|
|
||||||
|
|
||||||
TODO:
|
|
||||||
|
|
||||||
### nNGM
|
|
||||||
|
|
||||||
TODO:
|
|
||||||
|
|
||||||
### Bridgehead Components
|
|
||||||
|
|
||||||
#### [Blaze Server](https://github.com/samply/blaze)
|
|
||||||
|
|
||||||
This holds the actual data being searched. This store must be filled by you, generally by running an ETL on your locally stored data to turn it into the standardized FHIR format that we require.
|
|
||||||
|
|
||||||
#### [Connector]
|
|
||||||
|
|
||||||
TODO:
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
### Hardware
|
### Hardware
|
||||||
|
|
||||||
For running your bridgehead we recommend the follwing Hardware:
|
Hardware requirements strongly depend on the specific use-cases of your network as well as on the data it is going to serve. Most use-cases are well-served with the following configuration:
|
||||||
|
|
||||||
- 4 CPU cores
|
- 4 CPU cores
|
||||||
- At least 8 GB Ram
|
- 32 GB RAM
|
||||||
- 100GB Hard Drive, SSD recommended
|
- 160GB Hard Drive, SSD recommended
|
||||||
|
|
||||||
|
### Software
|
||||||
|
|
||||||
### System Requirements
|
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. We recommend the newest Ubuntu LTS server release.
|
||||||
|
|
||||||
Before starting the installation process, please ensure that following software is available on your system:
|
Ensure the following software (or newer) is installed:
|
||||||
|
|
||||||
#### Git
|
- git >= 2.0
|
||||||
|
- docker >= 20.10.1
|
||||||
|
- docker-compose >= 2.xx (`docker-compose` and `docker compose` are both supported).
|
||||||
|
- systemd
|
||||||
|
|
||||||
Check if you have at leat git 2.0 installed on the system with:
|
We recommend to install Docker(-compose) from its official sources as described on the [Docker website](https://docs.docker.com).
|
||||||
|
|
||||||
|
Note for Ubuntu: Please note that snap versions of Docker are not supported.
|
||||||
|
|
||||||
|
### Network
|
||||||
|
|
||||||
|
Since it needs to carry sensitive patient data, Bridgeheads are intended to be deployed within your institution's secure network and behave well even in networks in strict security settings, e.g. firewall rules. The only connectivity required is an outgoing HTTPS proxy. TLS termination is supported, too (see [below](#tls-terminating-proxies))
|
||||||
|
|
||||||
|
Note for Ubuntu: Please note that the uncomplicated firewall (ufw) is known to conflict with Docker [here](https://github.com/chaifeng/ufw-docker).
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
### Base Installation
|
||||||
|
|
||||||
|
First, clone the repository to the directory `/srv/docker/bridgehead`:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo mkdir -p /srv/docker/
|
||||||
|
sudo git clone https://github.com/samply/bridgehead.git /srv/docker/bridgehead
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, run the installation script:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
cd /srv/docker/bridgehead
|
||||||
|
sudo ./bridgehead install <PROJECT>
|
||||||
|
```
|
||||||
|
|
||||||
|
... and follow the instructions on the screen. You should then be prompted to do the next step:
|
||||||
|
|
||||||
|
### Register with Samply.Beam
|
||||||
|
|
||||||
|
Many Bridgehead services rely on the secure, performant and flexible messaging middleware called [Samply.Beam](https://github.com/samply/beam). You will need to register ("enroll") with Samply.Beam by creating a cryptographic key pair for your bridgehead:
|
||||||
|
|
||||||
``` shell
|
``` shell
|
||||||
git --version
|
cd /srv/docker/bridgehead
|
||||||
|
sudo ./bridgehead enroll <PROJECT>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### [Docker](https://docs.docker.com/get-docker/)
|
... and follow the instructions on the screen. You should then be prompted to do the next step:
|
||||||
|
|
||||||
To check your docker installation, you should execute the docker with --version:
|
### Starting and stopping your Bridgehead
|
||||||
|
|
||||||
``` shell
|
If you followed the above steps, your Bridgehead should already be configured to autostart (via systemd). If you would like to start/stop manually:
|
||||||
docker --version
|
|
||||||
|
To start, run
|
||||||
|
|
||||||
|
```shell
|
||||||
|
sudo systemctl start bridgehead@<PROJECT>.service
|
||||||
```
|
```
|
||||||
|
|
||||||
The Version should be higher than "20.10.1". Otherwise you will have problems starting the bridgehead. The next step is to check ``` docker-compose``` with:
|
To stop, run
|
||||||
|
|
||||||
``` shell
|
```shell
|
||||||
docker-compose --version
|
sudo systemctl stop bridgehead@<PROJECT>.service
|
||||||
```
|
```
|
||||||
|
|
||||||
The recomended version is "2.XX" and higher. If docker-compose was not installed with docker follow these [instructions](https://docs.docker.com/compose/install/#install-compose-as-standalone-binary-on-linux-systems). To futher check your docker and docker-compose installation, please run the following command.
|
To enable/disable autostart, run
|
||||||
|
|
||||||
``` shell
|
```shell
|
||||||
docker-compose -f - up <<EOF
|
sudo systemctl [enable|disable] bridgehead@<PROJECT>.service
|
||||||
version: "3.7"
|
|
||||||
services:
|
|
||||||
hello-world:
|
|
||||||
image: hello-world
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
Docker will now download the "hello-world" docker image and try to execute it. After the download you should see a message starting with "Hello from Docker!".
|
|
||||||
|
|
||||||
> NOTE: If the download of the image fails (e.g with "connection timed out" message), ensure that you have correctly set the proxy for the docker daemon. Refer to ["Docker Daemon Proxy Configuration" in the "Pitfalls" section](#docker-daemon-proxy-configuration)
|
|
||||||
|
|
||||||
#### [systemd](https://systemd.io/)
|
|
||||||
|
|
||||||
You shouldn't need to install it yourself, If systemd is not available on your system you should get another system.
|
|
||||||
To check if systemd is available on your system, please execute
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
systemctl --version
|
|
||||||
```
|
```
|
||||||
|
|
||||||
If systemd is not installed, you can start the bridgehead. However, for productive use we recomend using systemd.
|
## Site-specific configuration
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
If your system passed all checks from ["Requirements" section], you are now ready to download the bridgehead.
|
|
||||||
|
|
||||||
First, clone the repository to the directory "/srv/docker/bridgehead":
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
sudo mkdir -p /srv/docker/;
|
|
||||||
sudo git clone https://github.com/samply/bridgehead.git /srv/docker/bridgehead;
|
|
||||||
```
|
|
||||||
|
|
||||||
It is recomended to create a user for the bridgehead service. This should be done after clone the repository. Since not all linux distros support ```adduser```, we provide an action for the systemcall ```useradd```. You should try the first one, when the systm can't create the user you should try the second one.
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
adduser --no-create-home --disabled-login --ingroup docker --gecos "" bridgehead
|
|
||||||
```
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
useradd -M -g docker -N -s /sbin/nologin bridgehead
|
|
||||||
```
|
|
||||||
|
|
||||||
After adding the User you need to change the ownership of the directory to the bridgehead user.
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
chown bridgehead /srv/docker/bridgehead/ -R
|
|
||||||
```
|
|
||||||
|
|
||||||
### Configuration
|
|
||||||
|
|
||||||
> NOTE: If you are part of the CCP-IT we will provide you another link for the configuration.
|
|
||||||
|
|
||||||
Next, you need to configure a set of variables, specific for your site with not so high security concerns. You can clone the configuration template at [GitHub](https://github.com/samply/bridgehead-config). The confiugration of the bridgehead should be located in /etc/bridghead.
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
sudo git clone https://github.com/samply/bridgehead-config.git /etc/bridgehead;
|
|
||||||
```
|
|
||||||
|
|
||||||
After cloning or forking the repository you need to add value to the template. If you are a part of the CCP-IT you will get an already filled out config repo.
|
|
||||||
|
|
||||||
### Testing your bridgehead
|
|
||||||
|
|
||||||
We recomend to run first with the start and stop script. If you have trouble starting the bridghead have a look at the troubleshooting section.
|
|
||||||
|
|
||||||
Now you ready to run a bridgehead instance. The bridgehead scripts checks if your configuration is correct. To check if everything works, execute the following:
|
|
||||||
``` shell
|
|
||||||
/srv/docker/bridgehead/bridgehead start <Project>
|
|
||||||
```
|
|
||||||
|
|
||||||
You should now be able to access the landing page on your system, e.g "https://<your-host>/".
|
|
||||||
|
|
||||||
To shutdown the bridgehead just run.
|
|
||||||
``` shell
|
|
||||||
/srv/docker/bridgehead/bridgehead stop <Project>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Systemd service configuration
|
|
||||||
|
|
||||||
For a server, we highly recommend that you install the system units for managing the bridgehead, provided by us. You can do this by executing the [bridgehead](./bridgehead) script:
|
|
||||||
``` shell
|
|
||||||
sudo /srv/docker/bridgehead/bridgehead install <Project>
|
|
||||||
```
|
|
||||||
|
|
||||||
This will install the systemd units to run and update the bridghead.
|
|
||||||
|
|
||||||
Finally, you need to configure your sites secrets. These are places as configuration for each bridgehead system unit. Refer to the section for your specific project:
|
|
||||||
|
|
||||||
For Every project you need to set the proxy this way, if you have one. This is done with the ```systemctl edit``` comand.
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
sudo systemctl edit bridgehead@<project>.service;
|
|
||||||
sudo systemctl edit bridgehead-update@<project>.service;
|
|
||||||
```
|
|
||||||
|
|
||||||
``` conf
|
|
||||||
[Service]
|
|
||||||
Environment=http_proxy=<proxy-url>
|
|
||||||
Environment=https_proxy=<proxy-url>
|
|
||||||
```
|
|
||||||
|
|
||||||
There a further configurations for each project.
|
|
||||||
|
|
||||||
#### CCP(DKTK/C4)
|
|
||||||
|
|
||||||
For the federate search please follow the basic auth configuration step.
|
|
||||||
|
|
||||||
### DKTK/C4
|
|
||||||
|
|
||||||
You can create the site specific configuration with:
|
|
||||||
|
|
||||||
|
|
||||||
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. You share some of the ID-Management secrets with the central patientlist (Mainz) and controlnumbergenerator (Frankfurt). Refer to the ["Configuration" section](#configuration) for this.
|
|
||||||
|
|
||||||
``` conf
|
|
||||||
[Service]
|
|
||||||
Environment=http_proxy=
|
|
||||||
Environment=https_proxy=
|
|
||||||
```
|
|
||||||
|
|
||||||
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 bridgehead@ccp.service;
|
|
||||||
```
|
|
||||||
|
|
||||||
You can create the site specific configuration with:
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
sudo systemctl edit bridgehead@c4.service;
|
|
||||||
```
|
|
||||||
|
|
||||||
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. You share some of the ID-Management secrets with the central patientlist (Mainz) and controlnumbergenerator (Frankfurt). Refer to the ["Configuration" section](#configuration) for this.
|
|
||||||
|
|
||||||
``` conf
|
|
||||||
[Service]
|
|
||||||
Environment=http_proxy=
|
|
||||||
Environment=https_proxy=
|
|
||||||
Environment=HOSTIP=
|
|
||||||
Environment=HOST=
|
|
||||||
Environment=HTTP_PROXY_USER=
|
|
||||||
Environment=HTTP_PROXY_PASSWORD=
|
|
||||||
Environment=HTTPS_PROXY_USER=
|
|
||||||
Environment=HTTPS_PROXY_PASSWORD=
|
|
||||||
Environment=CONNECTOR_POSTGRES_PASS=
|
|
||||||
Environment=ML_DB_PASS=
|
|
||||||
Environment=MAGICPL_API_KEY=
|
|
||||||
Environment=MAGICPL_MAINZELLISTE_API_KEY=
|
|
||||||
Environment=MAGICPL_API_KEY_CONNECTOR=
|
|
||||||
Environment=MAGICPL_MAINZELLISTE_CENTRAL_API_KEY=
|
|
||||||
Environment=MAGICPL_CENTRAL_API_KEY=
|
|
||||||
Environment=MAGICPL_OIDC_CLIENT_ID=
|
|
||||||
Environment=MAGICPL_OIDC_CLIENT_SECRET=
|
|
||||||
```
|
|
||||||
|
|
||||||
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 bridgehead@c4.service;
|
|
||||||
```
|
|
||||||
### GBA/BBMRI-ERIC
|
|
||||||
|
|
||||||
You can create the site specific configuration with:
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
sudo systemctl edit bridgehead@gbn.service;
|
|
||||||
```
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
``` 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=
|
|
||||||
```
|
|
||||||
|
|
||||||
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 bridgehead@gbn.service;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
### Basic Auth
|
|
||||||
|
|
||||||
For Data protection we use basic authenfication for some services. To access those services you need an username and password combination. If you start the bridgehead without basic auth, then those services are not accesbile. We provide a script which set the needed config for you, just run the script and follow the instructions.
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
add_user.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
The result needs to be set in either in the systemd service or in your console.
|
|
||||||
|
|
||||||
|
|
||||||
#### Console
|
|
||||||
|
|
||||||
When just running the bridgehead you need to export the auth variable. Be aware that this export is only for the current session in the environment and after exit it will not be accessible anymore.
|
|
||||||
|
|
||||||
``` shell
|
|
||||||
export bc_auth_user=<output>
|
|
||||||
```
|
|
||||||
|
|
||||||
Cation: you need to escape occrring dollar signs.
|
|
||||||
|
|
||||||
#### systemd
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### HTTPS Access
|
### HTTPS Access
|
||||||
|
|
||||||
We advise to use https for all service of your bridgehead. HTTPS is enabled on default. For starting the bridghead you need a ssl certificate. You can either create it yourself or get a signed one. You need to drop the certificates in /certs.
|
Even within your internal network, the Bridgehead enforces HTTPS for all services. During the installation, a self-signed, long-lived certificate was created for you. To increase security, you can simply replace the files under `/etc/bridgehead/traefik-tls` with ones from established certification authorities such as [Let's Encrypt](https://letsencrypt.org) or [DFN-AAI](https://www.aai.dfn.de).
|
||||||
|
|
||||||
The bridgehead create one autotmatic on the first start. However, it will be unsigned and we recomend to get a signed one.
|
### TLS terminating proxies
|
||||||
|
|
||||||
|
All of the Bridgehead's outgoing connections are secured by transport encryption (TLS) and a Bridgehead will refuse to connect if certificate verification fails. If your local forward proxy server performs TLS termination, please place its CA certificate in `/etc/bridgehead/trusted-ca-certs` as a `.pem` file, e.g. `/etc/bridgehead/trusted-ca-certs/mylocalca.pem`. Then, all Bridgehead components will pick up this certificate and trust it for outgoing connections.
|
||||||
|
|
||||||
### Locally Managed Secrets
|
### File structure
|
||||||
|
|
||||||
This section describes the secrets you need to configure locally through the configuration
|
- `/srv/docker/bridgehead` contains this git repository with the shell scripts and *project-specific configuration*. In here, all files are identical for all sites. You should not make any changes here.
|
||||||
|
- `/etc/bridgehead` contains your *site-specific configuration* synchronized from your site-specific git repository as part of the [base installation](#base-installation). To change anything here, please consult your git repository (find out its URL via `git -C /etc/bridgehead remote -v`).
|
||||||
|
- `/etc/bridgehead/<PROJECT>.conf` is your main site-specific configuration, all bundled into one concise config file. Do not change it here but via the central git repository.
|
||||||
|
- `/etc/bridgehead/<PROJECT>.local.conf` contains site-specific parameters to be known to your Bridgehead only, e.g. local access credentials. The file is ignored via git, and you may edit it here via a text editor.
|
||||||
|
- `/etc/bridgehead/traefik-tls` contains your Bridgehead's reverse proxies TLS certificates for [HTTPS access](#https-access).
|
||||||
|
- `/etc/bridgehead/pki` contains your Bridgehead's private key (e.g., but not limited to Samply.Beam), generated as part of the [Samply.Beam enrollment](#register-with-samplybeam).
|
||||||
|
- `/etc/bridgehead/trusted-ca-certs` contains third-party certificates to be trusted by the Bridgehead. For example, you want to place the certificates of your [TLS-terminating proxy](#network) here.
|
||||||
|
|
||||||
| Name | Recommended Value | Description |
|
Your Bridgehead's actual data is not stored in the above directories, but in named docker volumes, see `docker volume ls` and `docker volume inspect <volume_name>`.
|
||||||
|--------------------------------------|---------------------------------------------------------------------------------------------------| ----------- |
|
|
||||||
| 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 |
|
|
||||||
|
|
||||||
### Cooperatively Managed Secrets
|
## Things you should know
|
||||||
|
|
||||||
> TODO: Describe secrets from site-config
|
### Auto-Updates
|
||||||
|
|
||||||
## Managing your Bridgehead
|
Your Bridgehead will automatically and regularly check for updates. Whenever something has been updates (e.g., one of the git repositories or one of the docker images), your Bridgehead is automatically restarted. This should happen automatically and does not need any configuration.
|
||||||
|
|
||||||
> TODO: Rewrite this section (restart, stop, uninstall, manual updates)
|
If you would like to understand what happens exactly and when, please check the systemd units deployed during the [installation](#base-installation) via `systemctl cat bridgehead-update@<PROJECT>.service` and `systemctl cat bridgehead-update@<PROJECT.timer`.
|
||||||
|
|
||||||
### On a Server
|
### Monitoring
|
||||||
|
|
||||||
#### Start
|
To keep all Bridgeheads up and working and detect any errors before a user does, a central monitoring
|
||||||
|
|
||||||
This will start a not running bridgehead system unit:
|
- Your Bridgehead itself will report relevant system events, such as successful/failed updates, restarts, performance metrics or version numbers.
|
||||||
``` shell
|
- Your Bridgehead is also monitored from the outside by your network's central components. For example, the federated search will regularly perform a black-box test by sending an empty query to your Bridgehead and checking if the results make sense.
|
||||||
sudo systemctl start bridgehead@<dktk/c4/gbn>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Stop
|
In all monitoring cases, obviously no sensitive information is transmitted, in particular not any patient-related data. Aggregated data, e.g. total amount of datasets, may be transmitted for diagnostic purposes.
|
||||||
|
|
||||||
This will stop a running bridgehead system unit:
|
## Troubleshooting
|
||||||
``` shell
|
|
||||||
sudo systemctl stop bridgehead@<dktk/c4/gbn>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Update
|
|
||||||
|
|
||||||
This will update bridgehead system unit:
|
|
||||||
``` shell
|
|
||||||
sudo systemctl start bridgehead-update@<dktk/c4/gbn>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Remove the Bridgehead System Units
|
|
||||||
|
|
||||||
If, for some reason you want to remove the installed bridgehead units, we added a command to [bridgehead](./bridgehead):
|
|
||||||
``` shell
|
|
||||||
sudo /srv/docker/bridgehead/bridgehead uninstall <project>
|
|
||||||
```
|
|
||||||
|
|
||||||
### On Developers Machine
|
|
||||||
|
|
||||||
For developers, we provide additional scripts for starting and stopping the specif bridgehead:
|
|
||||||
|
|
||||||
#### Start or stop
|
|
||||||
|
|
||||||
This command starts a specified bridgehead. Choose between "dktk", "c4" and "gbn".
|
|
||||||
``` shell
|
|
||||||
/srv/docker/bridgehead/bridgehead start <dktk/c4/gbn>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Stop
|
|
||||||
|
|
||||||
This command stops a specified bridgehead. Choose between "dktk", "c4" and "gbn".
|
|
||||||
``` shell
|
|
||||||
/srv/docker/bridgehead/bridgehead stop <dktk/c4/gbn>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Update
|
|
||||||
|
|
||||||
This shell script updates the configuration for all bridgeheads installed on your system.
|
|
||||||
``` shell
|
|
||||||
/srv/docker/bridgehead/bridgehead update
|
|
||||||
```
|
|
||||||
> NOTE: If you want to regularly update your developing instance, you can create a CRON job that executes this script.
|
|
||||||
|
|
||||||
## Migration Guide
|
|
||||||
|
|
||||||
> TODO: How to transfer from windows/gbn
|
|
||||||
|
|
||||||
## Pitfalls
|
|
||||||
|
|
||||||
### [Git Proxy Configuration](https://gist.github.com/evantoli/f8c23a37eb3558ab8765)
|
|
||||||
|
|
||||||
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
|
|
||||||
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
|
|
||||||
sudo git config --global --list;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Docker Daemon Proxy Configuration
|
### Docker Daemon Proxy Configuration
|
||||||
|
|
||||||
Docker has a background daemon, responsible for downloading images and starting them. To configure the proxy for this daemon, use the systemctl command:
|
Docker has a background daemon, responsible for downloading images and starting them. Sometimes, proxy configuration from your system won't carry over and it will fail to download images. In that case, configure the proxy for this daemon as described in the [official documentation](https://docs.docker.com).
|
||||||
|
|
||||||
``` shell
|
### Non-Linux OS
|
||||||
sudo systemctl edit docker
|
|
||||||
```
|
|
||||||
|
|
||||||
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:
|
The installation procedures described above have only been tested under Linux.
|
||||||
``` 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
|
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!
|
||||||
``` 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:
|
We believe that it is likely that installation would also work with FreeBSD and MacOS.
|
||||||
|
|
||||||
``` shell
|
Under Windows, you have 2 options:
|
||||||
sudo systemctl daemon-reload;
|
|
||||||
sudo systemctl restart docker;
|
|
||||||
```
|
|
||||||
|
|
||||||
## After the Installtion
|
- Virtual machine
|
||||||
|
- WSL
|
||||||
|
|
||||||
After starting your bridgehead, visit the landing page under the hostname. If you singed your own ssl certificate, there is probable an error message. However, you can accept it as exception.
|
We have tested the installation procedure with an Ubuntu 22.04 guest system running on a VMware virtual machine. That worked flawlessly.
|
||||||
|
|
||||||
On this page, there are all important links to each component, central and local.
|
|
||||||
|
|
||||||
### Connector Administration
|
|
||||||
|
|
||||||
The Connector administration panel allows you to set many of the parameters regulating your Bridgehead. Most especially, it is the place where you can register your site with the Sample Locator. To access this page, proceed as follows:
|
|
||||||
|
|
||||||
* Open the Connector page: https://<hostname>/<project>-connector/
|
|
||||||
* In the "Local components" box, click the "Samply Share" button.
|
|
||||||
* A new page will be opened, where you will need to log in using the administrator credentials (admin/adminpass by default).
|
|
||||||
* After log in, you will be taken to the administration dashboard, allowing you to configure the Connector.
|
|
||||||
* If this is the first time you have logged in as an administrator, you are strongly recommended to set a more secure password! You can use the "Users" button on the dashboard to do this.
|
|
||||||
|
|
||||||
### GBA/BBMRI-ERIC
|
|
||||||
|
|
||||||
#### Register with a Directory
|
|
||||||
|
|
||||||
The [Directory][directory] 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][negotiator].
|
|
||||||
|
|
||||||
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.
|
|
||||||
* Note the biobank ID and the collection ID that you have created - these will be needed when you register with the Locator (see below).
|
|
||||||
|
|
||||||
#### Register with a Locator
|
|
||||||
|
|
||||||
* Go to the registration page http://localhost:8082/admin/broker_list.xhtml.
|
|
||||||
* To register with a Locator, enter the following values in the three fields under "Join new Searchbroker":
|
|
||||||
* "Address": Depends on which Locator you want to register with:
|
|
||||||
* `https://locator.bbmri-eric.eu/broker/`: BBMRI Locator production service (European).
|
|
||||||
* `http://147.251.124.125:8088/broker/`: BBMRI Locator test service (European).
|
|
||||||
* `https://samplelocator.bbmri.de/broker/`: GBA Sample Locator production service (German).
|
|
||||||
* `https://samplelocator.test.bbmri.de/broker/`: GBA Sample Locator test service (German).
|
|
||||||
* "Your email address": this is the email to which the registration token will be returned.
|
|
||||||
* "Automatic reply": Set this to be `Total Size`
|
|
||||||
* Click "Join" to start the registration process.
|
|
||||||
* You should now have a list containing exactly one broker. You will notice that the "Status" box is empty.
|
|
||||||
* Send an email to `feedback@germanbiobanknode.de` and let us know which of our Sample Locators you would like to register to. Please include the biobank ID and the collection ID from your Directory registration, if you have these available.
|
|
||||||
* We will send you a registration token per email.
|
|
||||||
* You will then re-open the Connector and enter the token into the "Status" box.
|
|
||||||
* You should send us an email to let us know that you have done this.
|
|
||||||
* We will then complete the registration process
|
|
||||||
* We will email you to let you know that your biobank is now visible in the Sample Locator.
|
|
||||||
|
|
||||||
If you are a Sample Locator administrator, you will need to understand the [registration process](./SampleLocatorRegistration.md). Normal bridgehead admins do not need to worry about this.
|
|
||||||
|
|
||||||
|
Installation under WSL ought to work, but we have not tested this.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,112 @@
|
||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
services:
|
||||||
|
traefik:
|
||||||
|
container_name: bridgehead-traefik
|
||||||
|
image: traefik:latest
|
||||||
|
command:
|
||||||
|
- --entrypoints.web.address=:80
|
||||||
|
- --entrypoints.websecure.address=:443
|
||||||
|
- --providers.docker=true
|
||||||
|
- --providers.docker.exposedbydefault=false
|
||||||
|
- --providers.file.directory=/configuration/
|
||||||
|
- --api.dashboard=true
|
||||||
|
- --accesslog=true
|
||||||
|
- --entrypoints.web.http.redirections.entrypoint.to=websecure
|
||||||
|
- --entrypoints.web.http.redirections.entrypoint.scheme=https
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.dashboard.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
|
||||||
|
- "traefik.http.routers.dashboard.entrypoints=websecure"
|
||||||
|
- "traefik.http.routers.dashboard.service=api@internal"
|
||||||
|
- "traefik.http.routers.dashboard.tls=true"
|
||||||
|
- "traefik.http.routers.dashboard.middlewares=auth"
|
||||||
|
- "traefik.http.middlewares.auth.basicauth.users=${LDM_LOGIN}"
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 443:443
|
||||||
|
volumes:
|
||||||
|
- /etc/bridgehead/traefik-tls:/certs:ro
|
||||||
|
- ../lib/traefik-configuration/:/configuration:ro
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
|
||||||
|
forward_proxy:
|
||||||
|
container_name: bridgehead-forward-proxy
|
||||||
|
image: samply/bridgehead-forward-proxy:latest
|
||||||
|
environment:
|
||||||
|
HTTPS_PROXY: ${HTTPS_PROXY_URL}
|
||||||
|
USERNAME: ${HTTPS_PROXY_USERNAME}
|
||||||
|
PASSWORD: ${HTTPS_PROXY_PASSWORD}
|
||||||
|
volumes:
|
||||||
|
- /etc/bridgehead/trusted-ca-certs:/docker/custom-certs/:ro
|
||||||
|
|
||||||
|
landing:
|
||||||
|
container_name: bridgehead-landingpage
|
||||||
|
image: samply/bridgehead-landingpage:master
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.landing.rule=PathPrefix(`/`)"
|
||||||
|
- "traefik.http.services.landing.loadbalancer.server.port=80"
|
||||||
|
- "traefik.http.routers.landing.tls=true"
|
||||||
|
environment:
|
||||||
|
HOST: ${HOST}
|
||||||
|
PROJECT: ${PROJECT}
|
||||||
|
SITE_NAME: ${SITE_NAME}
|
||||||
|
|
||||||
|
blaze:
|
||||||
|
image: "samply/blaze:0.18"
|
||||||
|
container_name: bridgehead-bbmri-blaze
|
||||||
|
environment:
|
||||||
|
BASE_URL: "http://bridgehead-bbmri-blaze:8080"
|
||||||
|
JAVA_TOOL_OPTIONS: "-Xmx4g"
|
||||||
|
LOG_LEVEL: "debug"
|
||||||
|
ENFORCE_REFERENTIAL_INTEGRITY: "false"
|
||||||
|
volumes:
|
||||||
|
- "blaze-data:/app/data"
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.blaze_ccp.rule=PathPrefix(`/bbmri-localdatamanagement`)"
|
||||||
|
- "traefik.http.middlewares.ccp_b_strip.stripprefix.prefixes=/bbmri-localdatamanagement"
|
||||||
|
- "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"
|
||||||
|
|
||||||
|
spot:
|
||||||
|
image: samply/spot:latest
|
||||||
|
container_name: bridgehead-spot
|
||||||
|
environment:
|
||||||
|
SECRET: ${SPOT_BEAM_SECRET_LONG}
|
||||||
|
APPID: spot
|
||||||
|
PROXY_ID: ${PROXY_ID}
|
||||||
|
LDM_URL: http://bridgehead-bbmri-blaze:8080/fhir
|
||||||
|
BEAM_PROXY: http://beam-proxy:8081
|
||||||
|
depends_on:
|
||||||
|
- "beam-proxy"
|
||||||
|
- "blaze"
|
||||||
|
|
||||||
|
beam-proxy:
|
||||||
|
image: "samply/beam-proxy:develop"
|
||||||
|
container_name: bridgehead-beam-proxy
|
||||||
|
environment:
|
||||||
|
BROKER_URL: ${BROKER_URL}
|
||||||
|
PROXY_ID: ${PROXY_ID}
|
||||||
|
APP_0_ID: spot
|
||||||
|
APP_0_KEY: ${SPOT_BEAM_SECRET_SHORT}
|
||||||
|
PRIVKEY_FILE: /run/secrets/proxy.pem
|
||||||
|
RUST_LOG: debug
|
||||||
|
ALL_PROXY: http://forward_proxy:3128
|
||||||
|
TLS_CA_CERTIFICATES_DIR: /conf/trusted-ca-certs
|
||||||
|
secrets:
|
||||||
|
- proxy.pem
|
||||||
|
depends_on:
|
||||||
|
- "forward_proxy"
|
||||||
|
volumes:
|
||||||
|
- /etc/bridgehead/trusted-ca-certs:/conf/trusted-ca-certs:ro
|
||||||
|
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
blaze-data:
|
||||||
|
|
||||||
|
secrets:
|
||||||
|
proxy.pem:
|
||||||
|
file: /etc/bridgehead/pki/${SITE_ID}.priv.pem
|
|
@ -0,0 +1,7 @@
|
||||||
|
BROKER_ID=broker.bbmri.samply.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}"
|
||||||
|
SUPPORT_EMAIL=bridgehead@helpdesk.bbmri-eric.eu
|
||||||
|
PRIVATEKEYFILENAME=/etc/bridgehead/pki/${SITE_ID}.priv.pem
|
57
bridgehead
57
bridgehead
|
@ -29,10 +29,7 @@ case "$PROJECT" in
|
||||||
ccp)
|
ccp)
|
||||||
#nothing extra to do
|
#nothing extra to do
|
||||||
;;
|
;;
|
||||||
nngm)
|
bbmri)
|
||||||
#nothing extra to do
|
|
||||||
;;
|
|
||||||
gbn)
|
|
||||||
#nothing extra to do
|
#nothing extra to do
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
@ -41,23 +38,65 @@ case "$PROJECT" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
loadVars() {
|
||||||
|
# Load variables from /etc/bridgehead and /srv/docker/bridgehead
|
||||||
|
set -a
|
||||||
|
source /etc/bridgehead/$PROJECT.conf || fail_and_report 1 "/etc/bridgehead/$PROJECT.conf not found"
|
||||||
|
if [ -e /etc/bridgehead/$PROJECT.local.conf ]; then
|
||||||
|
log INFO "Applying /etc/bridgehead/$PROJECT.local.conf"
|
||||||
|
source /etc/bridgehead/$PROJECT.local.conf || fail_and_report 1 "Found /etc/bridgehead/$PROJECT.local.conf but failed to import"
|
||||||
|
fi
|
||||||
|
fetchVarsFromVaultByFile /etc/bridgehead/$PROJECT.conf || fail_and_report 1 "Unable to fetchVarsFromVaultByFile"
|
||||||
|
[ -e ./$PROJECT/vars ] && source ./$PROJECT/vars
|
||||||
|
set +a
|
||||||
|
|
||||||
|
OVERRIDE=${OVERRIDE:=""}
|
||||||
|
if [ -f "$PROJECT/docker-compose.override.yml" ]; then
|
||||||
|
log INFO "Applying $PROJECT/docker-compose.override.yml"
|
||||||
|
OVERRIDE+=" -f ./$PROJECT/docker-compose.override.yml"
|
||||||
|
fi
|
||||||
|
detectCompose
|
||||||
|
setHostname
|
||||||
|
}
|
||||||
|
|
||||||
case "$ACTION" in
|
case "$ACTION" in
|
||||||
start)
|
start)
|
||||||
|
loadVars
|
||||||
|
hc_send log "Bridgehead $PROJECT startup: Checking requirements ..."
|
||||||
checkRequirements
|
checkRequirements
|
||||||
fetchVarsFromVaultByFile /etc/bridgehead/$PROJECT.conf || exit 1
|
hc_send log "Bridgehead $PROJECT startup: Requirements checked out. Now starting bridgehead ..."
|
||||||
exec docker-compose -f ./$PROJECT/docker-compose.yml --env-file /etc/bridgehead/$PROJECT.conf up
|
export LDM_LOGIN=$(getLdmPassword)
|
||||||
|
exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE up --abort-on-container-exit
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
exec docker-compose -f ./$PROJECT/docker-compose.yml --env-file /etc/bridgehead/$PROJECT.conf down
|
loadVars
|
||||||
|
exec $COMPOSE -f ./$PROJECT/docker-compose.yml $OVERRIDE down
|
||||||
;;
|
;;
|
||||||
update)
|
update)
|
||||||
|
loadVars
|
||||||
exec ./lib/update-bridgehead.sh $PROJECT
|
exec ./lib/update-bridgehead.sh $PROJECT
|
||||||
;;
|
;;
|
||||||
install)
|
install)
|
||||||
exec ./lib/setup-bridgehead-units.sh $PROJECT
|
source ./lib/prepare-system.sh
|
||||||
|
loadVars
|
||||||
|
exec ./lib/install-bridgehead.sh $PROJECT
|
||||||
;;
|
;;
|
||||||
uninstall)
|
uninstall)
|
||||||
exec ./lib/remove-bridgehead-units.sh $PROJECT
|
exec ./lib/uninstall-bridgehead.sh $PROJECT
|
||||||
|
;;
|
||||||
|
enroll)
|
||||||
|
loadVars
|
||||||
|
if [ -e $PRIVATEKEYFILENAME ]; then
|
||||||
|
log ERROR "Private key already exists at $PRIVATEKEYFILENAME. Please delete first to proceed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
docker run --rm -ti -v /etc/bridgehead/pki:/etc/bridgehead/pki samply/beam-enroll:latest --output-file $PRIVATEKEYFILENAME --proxy-id $PROXY_ID --admin-email $SUPPORT_EMAIL
|
||||||
|
chmod 600 $PRIVATEKEYFILENAME
|
||||||
|
;;
|
||||||
|
preRun | preUpdate)
|
||||||
|
fixPermissions
|
||||||
|
;;
|
||||||
|
postRun | postUpdate)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
printUsage
|
printUsage
|
||||||
|
|
|
@ -8,32 +8,37 @@ services:
|
||||||
- --entrypoints.web.address=:80
|
- --entrypoints.web.address=:80
|
||||||
- --entrypoints.websecure.address=:443
|
- --entrypoints.websecure.address=:443
|
||||||
- --providers.docker=true
|
- --providers.docker=true
|
||||||
|
- --providers.docker.exposedbydefault=false
|
||||||
|
- --providers.file.directory=/configuration/
|
||||||
- --api.dashboard=true
|
- --api.dashboard=true
|
||||||
- --accesslog=true # print access-logs
|
- --accesslog=true
|
||||||
- --entrypoints.web.http.redirections.entrypoint.to=websecure
|
- --entrypoints.web.http.redirections.entrypoint.to=websecure
|
||||||
- --entrypoints.web.http.redirections.entrypoint.scheme=https
|
- --entrypoints.web.http.redirections.entrypoint.scheme=https
|
||||||
labels:
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
- "traefik.http.routers.dashboard.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
|
- "traefik.http.routers.dashboard.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
|
||||||
- "traefik.http.routers.dashboard.entrypoints=websecure"
|
- "traefik.http.routers.dashboard.entrypoints=websecure"
|
||||||
- "traefik.http.routers.dashboard.service=api@internal"
|
- "traefik.http.routers.dashboard.service=api@internal"
|
||||||
- "traefik.http.routers.dashboard.tls=true"
|
- "traefik.http.routers.dashboard.tls=true"
|
||||||
- "traefik.http.routers.dashboard.middlewares=auth"
|
- "traefik.http.routers.dashboard.middlewares=auth"
|
||||||
- "traefik.http.middlewares.auth.basicauth.users=${bc_auth_users}"
|
- "traefik.http.middlewares.auth.basicauth.users=${LDM_LOGIN}"
|
||||||
ports:
|
ports:
|
||||||
- 80:80
|
- 80:80
|
||||||
- 443:443
|
- 443:443
|
||||||
volumes:
|
volumes:
|
||||||
- ../certs:/tools/certs
|
- /etc/bridgehead/traefik-tls:/certs:ro
|
||||||
|
- ../lib/traefik-configuration/:/configuration:ro
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||||
|
|
||||||
forward_proxy:
|
forward_proxy:
|
||||||
container_name: bridgehead-forward-proxy
|
container_name: bridgehead-forward-proxy
|
||||||
image: samply/bridgehead-forward-proxy:develop
|
image: samply/bridgehead-forward-proxy:latest
|
||||||
environment:
|
environment:
|
||||||
http_proxy: ${http_proxy}
|
HTTPS_PROXY: ${HTTPS_PROXY_URL}
|
||||||
https_proxy: ${https_proxy}
|
USERNAME: ${HTTPS_PROXY_USERNAME}
|
||||||
|
PASSWORD: ${HTTPS_PROXY_PASSWORD}
|
||||||
volumes:
|
volumes:
|
||||||
- "bridgehead-proxy:/var/log/squid"
|
- /etc/bridgehead/trusted-ca-certs:/docker/custom-certs/:ro
|
||||||
|
|
||||||
landing:
|
landing:
|
||||||
container_name: bridgehead-landingpage
|
container_name: bridgehead-landingpage
|
||||||
|
@ -49,10 +54,10 @@ services:
|
||||||
SITE_NAME: ${SITE_NAME}
|
SITE_NAME: ${SITE_NAME}
|
||||||
|
|
||||||
blaze:
|
blaze:
|
||||||
image: "samply/blaze:0.17"
|
image: "samply/blaze:0.18"
|
||||||
container_name: bridgehead-ccp-blaze
|
container_name: bridgehead-ccp-blaze
|
||||||
environment:
|
environment:
|
||||||
BASE_URL: "http://blaze:8080"
|
BASE_URL: "http://bridgehead-ccp-blaze:8080"
|
||||||
JAVA_TOOL_OPTIONS: "-Xmx4g"
|
JAVA_TOOL_OPTIONS: "-Xmx4g"
|
||||||
LOG_LEVEL: "debug"
|
LOG_LEVEL: "debug"
|
||||||
ENFORCE_REFERENTIAL_INTEGRITY: "false"
|
ENFORCE_REFERENTIAL_INTEGRITY: "false"
|
||||||
|
@ -60,43 +65,50 @@ services:
|
||||||
- "blaze-data:/app/data"
|
- "blaze-data:/app/data"
|
||||||
labels:
|
labels:
|
||||||
- "traefik.enable=true"
|
- "traefik.enable=true"
|
||||||
- "traefik.http.middlewares.ccp-auth.basicauth.users=${bc_auth_users}"
|
|
||||||
- "traefik.http.routers.blaze_ccp.rule=PathPrefix(`/ccp-localdatamanagement`)"
|
- "traefik.http.routers.blaze_ccp.rule=PathPrefix(`/ccp-localdatamanagement`)"
|
||||||
- "traefik.http.middlewares.ccp_b_strip.stripprefix.prefixes=/ccp-localdatamanagement"
|
- "traefik.http.middlewares.ccp_b_strip.stripprefix.prefixes=/ccp-localdatamanagement"
|
||||||
- "traefik.http.services.blaze_ccp.loadbalancer.server.port=8080"
|
- "traefik.http.services.blaze_ccp.loadbalancer.server.port=8080"
|
||||||
- "traefik.http.routers.blaze_ccp.middlewares=ccp_b_strip,ccp-auth"
|
- "traefik.http.routers.blaze_ccp.middlewares=ccp_b_strip,auth"
|
||||||
- "traefik.http.routers.blaze_ccp.tls=true"
|
- "traefik.http.routers.blaze_ccp.tls=true"
|
||||||
|
|
||||||
ccp-search-share:
|
spot:
|
||||||
image: "samply/dktk-fed-search-share:main"
|
image: samply/spot:latest
|
||||||
container_name: bridgehead-ccp-share
|
container_name: bridgehead-spot
|
||||||
environment:
|
environment:
|
||||||
APP_BASE_URL: "http://dktk-fed-search-share:8080"
|
SECRET: ${SPOT_BEAM_SECRET_LONG}
|
||||||
APP_BROKER_BASEURL: "https://dktk-fed-search.verbis.dkfz.de/broker/rest/searchbroker"
|
APPID: spot
|
||||||
APP_BROKER_MAIL: ${CCP_SEARCHBROKER_USERNAME}
|
PROXY_ID: ${PROXY_ID}
|
||||||
APP_BROKER_AUTHTOKEN: ${CCP_SEARCHBROKER_PASSWORD}
|
LDM_URL: http://bridgehead-ccp-blaze:8080/fhir
|
||||||
APP_STORE_BASEURL: "http://bridgehead-ccp-blaze:8080/fhir"
|
BEAM_PROXY: http://beam-proxy:8081
|
||||||
SPRING_DATASOURCE_URL: "jdbc:postgresql://bridgehead-ccp-share-db:5432/postgres"
|
|
||||||
JAVA_TOOL_OPTIONS: -Xmx1g -Dhttp.proxyHost=bridgehead-forward-proxy -Dhttp.proxyPort=3128 -Dhttps.proxyHost=bridgehead-forward-proxy -Dhttps.proxyPort=3128 -Dhttp.nonProxyHosts="bridgehead-*"
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- ccp-search-share-db
|
- "beam-proxy"
|
||||||
- blaze
|
- "blaze"
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.http.routers.dktk-fed-search.rule=PathPrefix(`/ccp-connector`)"
|
|
||||||
- "traefik.http.services.dktk-fed-search.loadbalancer.server.port=8080"
|
|
||||||
|
|
||||||
ccp-search-share-db:
|
beam-proxy:
|
||||||
image: "postgres:14"
|
image: "samply/beam-proxy:develop"
|
||||||
container_name: bridgehead-ccp-share-db
|
container_name: bridgehead-beam-proxy
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: "postgres"
|
BROKER_URL: ${BROKER_URL}
|
||||||
POSTGRES_PASSWORD: "postgres"
|
PROXY_ID: ${PROXY_ID}
|
||||||
POSTGRES_DB: "dktk-fed-search-share"
|
APP_0_ID: spot
|
||||||
|
APP_0_KEY: ${SPOT_BEAM_SECRET_SHORT}
|
||||||
|
APP_1_ID: report-hub
|
||||||
|
APP_1_KEY: ${REPORTHUB_BEAM_SECRET_SHORT}
|
||||||
|
PRIVKEY_FILE: /run/secrets/proxy.pem
|
||||||
|
RUST_LOG: debug
|
||||||
|
ALL_PROXY: http://forward_proxy:3128
|
||||||
|
TLS_CA_CERTIFICATES_DIR: /conf/trusted-ca-certs
|
||||||
|
secrets:
|
||||||
|
- proxy.pem
|
||||||
|
depends_on:
|
||||||
|
- "forward_proxy"
|
||||||
volumes:
|
volumes:
|
||||||
- "ccp-search-share-db-data:/var/lib/postgresql/data"
|
- /etc/bridgehead/trusted-ca-certs:/conf/trusted-ca-certs:ro
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
blaze-data:
|
blaze-data:
|
||||||
bridgehead-proxy:
|
|
||||||
ccp-search-share-db-data:
|
secrets:
|
||||||
|
proxy.pem:
|
||||||
|
file: /etc/bridgehead/pki/${SITE_ID}.priv.pem
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
version: "3.7"
|
||||||
|
|
||||||
|
services:
|
||||||
|
connector:
|
||||||
|
container_name: bridgehead-connector
|
||||||
|
image: docker.verbis.dkfz.de/ccp/connector:bk2
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: ${CONNECTOR_POSTGRES_PASSWORD}
|
||||||
|
NNGM_MAGICPL_APIKEY: ${NNGM_MAGICPL_APIKEY}
|
||||||
|
NNGM_MAINZELLISTE_APIKEY: ${NNGM_MAINZELLISTE_APIKEY}
|
||||||
|
NNGM_CTS_APIKEY: ${NNGM_CTS_APIKEY}
|
||||||
|
NNGM_CRYPTKEY: ${NNGM_CRYPTKEY}
|
||||||
|
restart: always
|
||||||
|
labels:
|
||||||
|
- "traefik.enable=true"
|
||||||
|
- "traefik.http.routers.connector.rule=PathPrefix(`/ccp-connector`)"
|
||||||
|
- "traefik.http.services.connector.loadbalancer.server.port=8080"
|
||||||
|
- "traefik.http.routers.connector.tls=true"
|
||||||
|
|
||||||
|
connector_db:
|
||||||
|
image: postgres:9.5-alpine
|
||||||
|
container_name: bridgehead-ccp-connector-db
|
||||||
|
volumes:
|
||||||
|
- "connector_db_data:/var/lib/postgresql/data"
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: "samplyconnector"
|
||||||
|
POSTGRES_USER: "samplyconnector"
|
||||||
|
POSTGRES_PASSWORD: ${CONNECTOR_POSTGRES_PASSWORD}
|
||||||
|
restart: always
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
connector_db_data:
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function nngmSetup() {
|
||||||
|
if [ -n "$NNGM_CTS_APIKEY" ]; then
|
||||||
|
log INFO "nNGM setup detected -- will start nNGM Connector."
|
||||||
|
OVERRIDE+=" -f ./$PROJECT/nngm-compose.yml"
|
||||||
|
fi
|
||||||
|
CONNECTOR_POSTGRES_PASSWORD="$(echo \"This is a salt string to generate one consistent password. It is not required to be secret.\" | openssl rsautl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)"
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
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}"
|
||||||
|
SUPPORT_EMAIL=support-ccp@dkfz-heidelberg.de
|
||||||
|
PRIVATEKEYFILENAME=/etc/bridgehead/pki/${SITE_ID}.priv.pem
|
||||||
|
|
||||||
|
# This will load nngm setup. Effective only if nngm configuration is defined.
|
||||||
|
source $PROJECT/nngm-setup.sh
|
||||||
|
nngmSetup
|
|
@ -1,100 +0,0 @@
|
||||||
version: '3.7'
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
gbn-connector-logs:
|
|
||||||
gbn-connector-db-data:
|
|
||||||
gbn-store-db-data:
|
|
||||||
|
|
||||||
services:
|
|
||||||
traefik:
|
|
||||||
container_name: bridgehead-traefik
|
|
||||||
image: traefik:2
|
|
||||||
command:
|
|
||||||
- --entrypoints.web.address=:80
|
|
||||||
- --entrypoints.websecure.address=:443
|
|
||||||
- --providers.docker=true
|
|
||||||
- --api.dashboard=true
|
|
||||||
- --accesslog=true # print access-logs
|
|
||||||
- --entrypoints.web.http.redirections.entrypoint.to=websecure
|
|
||||||
- --entrypoints.web.http.redirections.entrypoint.scheme=https
|
|
||||||
labels:
|
|
||||||
- "traefik.http.routers.dashboard.rule=PathPrefix(`/api`) || PathPrefix(`/dashboard`)"
|
|
||||||
- "traefik.http.routers.dashboard.entrypoints=websecure"
|
|
||||||
- "traefik.http.routers.dashboard.service=api@internal"
|
|
||||||
- "traefik.http.routers.dashboard.tls=true"
|
|
||||||
- "traefik.http.routers.dashboard.middlewares=auth"
|
|
||||||
- "traefik.http.middlewares.auth.basicauth.users=${bc_auth_users}"
|
|
||||||
ports:
|
|
||||||
- 80:80
|
|
||||||
- 443:443
|
|
||||||
volumes:
|
|
||||||
- ../certs:/tools/certs
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
|
|
||||||
forward_proxy:
|
|
||||||
container_name: bridgehead-forward-proxy
|
|
||||||
image: ubuntu/squid
|
|
||||||
environment:
|
|
||||||
http_proxy: ${http_proxy}
|
|
||||||
https_proxy: ${https_proxy}
|
|
||||||
volumes:
|
|
||||||
- "bridgehead-proxy:/var/log/squid"
|
|
||||||
|
|
||||||
landing:
|
|
||||||
container_name: bridgehead-landingpage
|
|
||||||
image: samply/bridgehead-landingpage
|
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.http.routers.landing.rule=PathPrefix(`/`)"
|
|
||||||
- "traefik.http.services.landing.loadbalancer.server.port=80"
|
|
||||||
- "traefik.http.routers.landing.tls=true"
|
|
||||||
environment:
|
|
||||||
HOST: ${HOST}
|
|
||||||
PROJECT: ${PROJECT}
|
|
||||||
SITE_NAME: ${SITE_NAME}
|
|
||||||
|
|
||||||
blaze:
|
|
||||||
image: "samply/blaze:0.17"
|
|
||||||
container_name: bridgehead-gbn-blaze
|
|
||||||
environment:
|
|
||||||
BASE_URL: "http://blaze:8080"
|
|
||||||
JAVA_TOOL_OPTIONS: "-Xmx4g"
|
|
||||||
LOG_LEVEL: "debug"
|
|
||||||
ENFORCE_REFERENTIAL_INTEGRITY: "false"
|
|
||||||
volumes:
|
|
||||||
- "blaze-data:/app/data"
|
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.http.middlewares.gbn-auth.basicauth.users=${bc_auth_users}"
|
|
||||||
- "traefik.http.routers.blaze_gbn.rule=PathPrefix(`/gbn-localdatamanagement`)"
|
|
||||||
- "traefik.http.middlewares.gbn_b_strip.stripprefix.prefixes=/gbn-localdatamanagement"
|
|
||||||
- "traefik.http.services.blaze_gbn.loadbalancer.server.port=8080"
|
|
||||||
- "traefik.http.routers.blaze_gbn.middlewares=gbn_b_strip,gbn-auth"
|
|
||||||
- "traefik.http.routers.blaze_gbn.tls=true"
|
|
||||||
|
|
||||||
gbn-connector:
|
|
||||||
container_name: bridgehead-gbn-connector
|
|
||||||
image: "samply/share-client:gbn-feature-environmentPreconfiguration"
|
|
||||||
environment:
|
|
||||||
POSTGRES_PASSWORD: ${CONNECTOR_POSTGRES_PASS}
|
|
||||||
volumes:
|
|
||||||
- "gbn-connector-logs:/usr/local/tomcat/logs"
|
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.http.routers.gbn_connector.rule=PathPrefix(`/gbn-connector`)"
|
|
||||||
- "traefik.http.services.gbn_connector.loadbalancer.server.port=8080"
|
|
||||||
depends_on:
|
|
||||||
- "gbn-connector-db"
|
|
||||||
restart: "always"
|
|
||||||
|
|
||||||
gbn-connector-db:
|
|
||||||
image: "postgres:10.17"
|
|
||||||
environment:
|
|
||||||
POSTGRES_DB: "samply.connector"
|
|
||||||
POSTGRES_USER: "samply"
|
|
||||||
POSTGRES_PASSWORD: ${CONNECTOR_POSTGRES_PASS}
|
|
||||||
volumes:
|
|
||||||
- "gbn-connector-db-data:/var/lib/postgresql/data"
|
|
||||||
restart: "always"
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
### Note: Currently not complete, needs some features before useable for production
|
|
||||||
|
|
||||||
source lib/functions.sh
|
|
||||||
|
|
||||||
exitIfNotRoot
|
|
||||||
|
|
||||||
if ! ./lib/prerequisites.sh; then
|
|
||||||
log "Prerequisites failed, exiting"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
source site.conf
|
|
||||||
|
|
||||||
./lib/generate.sh
|
|
||||||
|
|
||||||
echo -e "\nInstalling systemd units ..."
|
|
||||||
cp -v \
|
|
||||||
lib/systemd/bridgehead\@.service \
|
|
||||||
lib/systemd/bridgehead-update\@.service \
|
|
||||||
lib/systemd/bridgehead-update\@.timer \
|
|
||||||
/etc/systemd/system/
|
|
||||||
|
|
||||||
systemctl daemon-reload
|
|
||||||
|
|
||||||
if ! systemctl is-active --quiet bridgehead@"${project}"; then
|
|
||||||
echo "Enabling autostart of bridgehead@${project}.service"
|
|
||||||
systemctl enable bridgehead@"${project}"
|
|
||||||
echo "Enabling nightly updates for bridgehead@${project}.service ..."
|
|
||||||
systemctl enable --now bridgehead-update@"${project}".timer
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\nDone - now start your bridgehead by running\n\tsystemctl start bridgehead@${project}.service\nor by rebooting your machine."
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
source lib/functions.sh
|
|
||||||
|
|
||||||
log "INFO" "This script add's a user with password to the bridghead"
|
|
||||||
|
|
||||||
read -p 'Username: ' bc_user
|
|
||||||
read -sp 'Password: ' bc_password
|
|
||||||
|
|
||||||
log "INFO" "\nPlease export the line in the your environment. Please replace the dollar signs with with \\\$"
|
|
||||||
docker run --rm -it httpd:latest htpasswd -nb $bc_user $bc_password
|
|
|
@ -1,9 +1,26 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
detectCompose() {
|
||||||
|
if [[ "$(docker compose version 2>/dev/null)" == *"Docker Compose version"* ]]; then
|
||||||
|
COMPOSE="docker compose"
|
||||||
|
else
|
||||||
|
COMPOSE="docker-compose"
|
||||||
|
# This is intended to fail on startup in the next prereq check.
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
getLdmPassword() {
|
||||||
|
if [ -n "$LDM_PASSWORD" ]; then
|
||||||
|
docker run --rm httpd:alpine htpasswd -nb $PROJECT $LDM_PASSWORD | tr -d '\n' | tr -d '\r'
|
||||||
|
else
|
||||||
|
echo -n ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
exitIfNotRoot() {
|
exitIfNotRoot() {
|
||||||
if [ "$EUID" -ne 0 ]; then
|
if [ "$EUID" -ne 0 ]; then
|
||||||
log "ERROR" "Please run as root"
|
log "ERROR" "Please run as root"
|
||||||
exit 1
|
fail_and_report 1 "Please run as root"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,19 +33,15 @@ checkOwner(){
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
log() {
|
|
||||||
echo -e "$(date +'%Y-%m-%d %T')" "$1:" "$2"
|
|
||||||
}
|
|
||||||
|
|
||||||
printUsage() {
|
printUsage() {
|
||||||
echo "Usage: bridgehead start|stop|update|install|uninstall PROJECTNAME"
|
echo "Usage: bridgehead start|stop|update|install|uninstall|enroll PROJECTNAME"
|
||||||
echo "PROJECTNAME should be one of ccp|nngm|gbn"
|
echo "PROJECTNAME should be one of ccp|bbmri"
|
||||||
}
|
}
|
||||||
|
|
||||||
checkRequirements() {
|
checkRequirements() {
|
||||||
if ! lib/prerequisites.sh; then
|
if ! lib/prerequisites.sh $@; then
|
||||||
log "ERROR" "Validating Prerequisites failed, please fix the error(s) above this line."
|
log "ERROR" "Validating Prerequisites failed, please fix the error(s) above this line."
|
||||||
exit 1
|
fail_and_report 1 "Validating prerequisites failed."
|
||||||
else
|
else
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -97,10 +110,32 @@ assertVarsNotEmpty() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fixPermissions() {
|
||||||
|
CHOWN=$(which chown)
|
||||||
|
sudo $CHOWN -R bridgehead /etc/bridgehead /srv/docker/bridgehead
|
||||||
|
}
|
||||||
|
|
||||||
|
source lib/monitoring.sh
|
||||||
|
|
||||||
|
report_error() {
|
||||||
|
CODE=$1
|
||||||
|
shift
|
||||||
|
log ERROR "$@"
|
||||||
|
hc_send $CODE "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
fail_and_report() {
|
||||||
|
report_error $@
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
setHostname() {
|
||||||
|
if [ -z "$HOST" ]; then
|
||||||
|
export HOST=$(hostname -f)
|
||||||
|
log DEBUG "Using auto-detected hostname $HOST."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
##Setting Network properties
|
##Setting Network properties
|
||||||
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}');
|
# currently not needed
|
||||||
export HOST=$(hostname)
|
#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 PRODUCTION="false";
|
|
||||||
if [ "$(git branch --show-current)" == "main" ]; then
|
|
||||||
export PRODUCTION="true";
|
|
||||||
fi
|
|
||||||
|
|
116
lib/generate.sh
116
lib/generate.sh
|
@ -1,116 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ! -d ./landing ]
|
|
||||||
then
|
|
||||||
mkdir landing
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f ./landing/index.html ]
|
|
||||||
then
|
|
||||||
touch index.html
|
|
||||||
fi
|
|
||||||
|
|
||||||
CENTRAL_SERVICES=" <tr>
|
|
||||||
<td>CCP-IT</td>
|
|
||||||
<td><a href=\"https://monitor.vmitro.de/icingaweb2/dashboard\">Monitoring Service</td>
|
|
||||||
</tr>"
|
|
||||||
|
|
||||||
LOCAL_SERVICES=" <tr>
|
|
||||||
<td>Bridgehead</td>
|
|
||||||
<td>Reverse Proxy <a href=\"http://${HOST}:8080/\">Traefik</a></td>
|
|
||||||
</tr>"
|
|
||||||
|
|
||||||
if [ "$project" = "dktk" ] || [ "$project" = "c4" ] || [ "$project" = "dktk-fed" ]
|
|
||||||
then
|
|
||||||
CENTRAL_SERVICES+=" <tr>
|
|
||||||
<td>CCP-IT</td>
|
|
||||||
<td><a href=\"https://patientlist.ccp-it.dktk.dkfz.de\">Zentrale Patientenliste</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>CCP-IT</td>
|
|
||||||
<td><a href=\"https://decentralsearch.ccp-it.dktk.dkfz.de\">Dezentrale Suche</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>CCP-IT</td>
|
|
||||||
<td><a href=\"https://centralsearch.ccp-it.dktk.dkfz.de\">Zentrale Suche</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>CCP-IT</td>
|
|
||||||
<td><a href=\"https://deployment.ccp-it.dktk.dkfz.de\">Deployment-Server</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>CCP-IT</td>
|
|
||||||
<td><a href=\"https://dktk-kne.kgu.de\">Zentraler Kontrollnummernerzeuger</td>
|
|
||||||
</tr>
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$project" = "dktk-fed" ]
|
|
||||||
then
|
|
||||||
LOCAL_SERVICES+=" <tr>
|
|
||||||
<td>DKTK</td>
|
|
||||||
<td><a href=\"https://${HOST}/dktk-localdatamanagement/fhir/\">Blaze</a></td>
|
|
||||||
</tr>
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat > ./landing/index.html <<EOL
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
||||||
<meta name="description" content="">
|
|
||||||
<title>Bridgehead Overview</title>
|
|
||||||
<!-- Bootstrap core CSS -->
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
|
||||||
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
|
|
||||||
integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
|
|
||||||
crossorigin="anonymous"></script>
|
|
||||||
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class="d-flex flex-column min-vh-100">
|
|
||||||
|
|
||||||
<nav class="navbar navbar-light" style="background-color: #aad7f6;">
|
|
||||||
<h2 class="pb-2 border-bottom">Bridgehead ${site_name}</h2>
|
|
||||||
</nav>
|
|
||||||
<div class="container px-4 py-5" id="featured-3">
|
|
||||||
<div>
|
|
||||||
<h2>Components</h2>
|
|
||||||
<h3>Central</h3>
|
|
||||||
<table class="table">
|
|
||||||
<thead class="thead-dark">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 50%">Group</th>
|
|
||||||
<th style="width: 50%">Service</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
${CENTRAL_SERVICES}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div>
|
|
||||||
<h3>Local</h3>
|
|
||||||
<table class="table">
|
|
||||||
<thead class="thead-dark">
|
|
||||||
<tr>
|
|
||||||
<th style="width: 50%">Project</th>
|
|
||||||
<th style="width: 50%">Services</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
${LOCAL_SERVICES}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<footer class="footer mt-auto py-3">
|
|
||||||
<a href="https://dktk.dkfz.de/"><img src="https://www.oncoray.de/fileadmin/files/bilder_gruppen/DKTK/Logo_DKTK_neu_2016.jpg" style="max-width: 30%; height: auto;"></a> DKTK 2022<span style="float: right;"><a href="https://github.com/samply/bridgehead"><button type="button" class="btn btn-primary">Documentaion</button></a></span>
|
|
||||||
</footer>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
EOL
|
|
|
@ -22,7 +22,7 @@ cd $BASE
|
||||||
|
|
||||||
source lib/functions.sh
|
source lib/functions.sh
|
||||||
|
|
||||||
assertVarsNotEmpty SITE_ID || exit 1
|
assertVarsNotEmpty SITE_ID || fail_and_report 1 "gitpassword.sh failed: SITE_ID is empty."
|
||||||
|
|
||||||
PARAMS="$(cat)"
|
PARAMS="$(cat)"
|
||||||
GITHOST=$(echo "$PARAMS" | grep "^host=" | sed 's/host=\(.*\)/\1/g')
|
GITHOST=$(echo "$PARAMS" | grep "^host=" | sed 's/host=\(.*\)/\1/g')
|
||||||
|
@ -30,8 +30,7 @@ GITHOST=$(echo "$PARAMS" | grep "^host=" | sed 's/host=\(.*\)/\1/g')
|
||||||
fetchVarsFromVault GIT_PASSWORD
|
fetchVarsFromVault GIT_PASSWORD
|
||||||
|
|
||||||
if [ -z "${GIT_PASSWORD}" ]; then
|
if [ -z "${GIT_PASSWORD}" ]; then
|
||||||
log ERROR "Git password not found."
|
fail_and_report 1 "gitpassword.sh failed: Git password not found."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
source lib/functions.sh
|
||||||
|
|
||||||
|
exitIfNotRoot
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
log "ERROR" "Please provide a Project as argument"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PROJECT=$1
|
||||||
|
|
||||||
|
checkRequirements noprivkey
|
||||||
|
|
||||||
|
log "INFO" "Allowing the bridgehead user to start/stop the bridgehead."
|
||||||
|
|
||||||
|
cat <<EOF > /etc/sudoers.d/bridgehead-"${PROJECT}"
|
||||||
|
# This has been added by the Bridgehead installer. Remove with bridgehead uninstall.
|
||||||
|
Cmnd_Alias BRIDGEHEAD${PROJECT^^} = \\
|
||||||
|
/bin/systemctl start bridgehead@${PROJECT}.service, \\
|
||||||
|
/bin/systemctl stop bridgehead@${PROJECT}.service, \\
|
||||||
|
/bin/systemctl restart bridgehead@${PROJECT}.service, \\
|
||||||
|
/bin/systemctl restart bridgehead@*.service, \\
|
||||||
|
/bin/chown -R bridgehead /etc/bridgehead /srv/docker/bridgehead, \\
|
||||||
|
/usr/bin/chown -R bridgehead /etc/bridgehead /srv/docker/bridgehead
|
||||||
|
|
||||||
|
bridgehead ALL= NOPASSWD: BRIDGEHEAD${PROJECT^^}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# TODO: Determine whether this should be located in setup-bridgehead (triggered through bridgehead install) or in update bridgehead (triggered every hour)
|
||||||
|
if [ -z "$LDM_PASSWORD" ]; then
|
||||||
|
log "INFO" "Now generating a password for the local data management. Please save the password for your ETL process!"
|
||||||
|
generated_passwd="$(cat /proc/sys/kernel/random/uuid | sed 's/[-]//g' | head -c 32)"
|
||||||
|
|
||||||
|
log "INFO" "Your generated credentials are:\n user: $PROJECT\n password: $generated_passwd"
|
||||||
|
echo -e "## Local Data Management Basic Authentication\n# User: $PROJECT\nLDM_PASSWORD=$generated_passwd" >> /etc/bridgehead/${PROJECT}.local.conf;
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "INFO" "Registering system units for bridgehead and bridgehead-update"
|
||||||
|
cp -v \
|
||||||
|
lib/systemd/bridgehead\@.service \
|
||||||
|
lib/systemd/bridgehead-update\@.service \
|
||||||
|
lib/systemd/bridgehead-update\@.timer \
|
||||||
|
/etc/systemd/system/
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
|
log INFO "Trying to update your bridgehead ..."
|
||||||
|
|
||||||
|
systemctl start bridgehead-update@"${PROJECT}".service
|
||||||
|
|
||||||
|
log "INFO" "Enabling autostart of bridgehead@${PROJECT}.service"
|
||||||
|
systemctl enable bridgehead@"${PROJECT}".service
|
||||||
|
|
||||||
|
log "INFO" "Enabling auto-updates for bridgehead@${PROJECT}.service ..."
|
||||||
|
systemctl enable --now bridgehead-update@"${PROJECT}".timer
|
||||||
|
|
||||||
|
STR="\n\n systemctl start bridgehead@${PROJECT}.service\n\nor by rebooting your machine."
|
||||||
|
if [ -e /etc/bridgehead/pki/${SITE_ID}.priv.pem ]; then
|
||||||
|
STR="Success. Next, start your bridgehead by running$STR"
|
||||||
|
else
|
||||||
|
STR="Success. Next, enroll into the $PROJECT broker by creating a cryptographic certificate. To do so, run\n\n /srv/docker/bridgehead/bridgehead enroll $PROJECT\n\nThen, you may start the bridgehead by running$STR"
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "INFO" "$STR"
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
log() {
|
||||||
|
SEVERITY="$1"
|
||||||
|
shift
|
||||||
|
echo -e "$(date +'%Y-%m-%d %T')" "$SEVERITY:" "$@"
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source lib/log.sh
|
||||||
|
|
||||||
|
function hc_set_uuid(){
|
||||||
|
HCUUID="$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
function hc_set_service(){
|
||||||
|
HCSERVICE="$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
UPTIME=
|
||||||
|
USER_AGENT=
|
||||||
|
|
||||||
|
function hc_send(){
|
||||||
|
BASEURL="https://healthchecks.verbis.dkfz.de/ping"
|
||||||
|
if [ -n "$MONITOR_APIKEY" ]; then
|
||||||
|
hc_set_uuid $MONITOR_APIKEY
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$HCSERVICE" ]; then
|
||||||
|
HCURL="$BASEURL/$PING_KEY/$HCSERVICE"
|
||||||
|
fi
|
||||||
|
if [ -n "$HCUUID" ]; then
|
||||||
|
HCURL="$BASEURL/$HCUUID"
|
||||||
|
fi
|
||||||
|
if [ ! -n "$HCURL" ]; then
|
||||||
|
log WARN "Did not report Healthcheck: Neither Healthcheck UUID nor service set. Please define MONITOR_APIKEY in /etc/bridgehead."
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$UPTIME" ]; then
|
||||||
|
UPTIME=$(docker ps -a --format 'table {{.Names}} \t{{.RunningFor}} \t {{.Status}} \t {{.Image}}' --filter name=bridgehead || echo "Unable to get docker statistics")
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$USER_AGENT" ]; then
|
||||||
|
if [ "$USER" != "root" ]; then
|
||||||
|
COMMIT_ETC=$(git -C /etc/bridgehead rev-parse HEAD | cut -c -8)
|
||||||
|
COMMIT_SRV=$(git -C /srv/docker/bridgehead rev-parse HEAD | cut -c -8)
|
||||||
|
else
|
||||||
|
COMMIT_ETC=$(su -c 'git -C /etc/bridgehead rev-parse HEAD' bridgehead | cut -c -8)
|
||||||
|
COMMIT_SRV=$(su -c 'git -C /srv/docker/bridgehead rev-parse HEAD' bridgehead | cut -c -8)
|
||||||
|
fi
|
||||||
|
USER_AGENT="srv:$COMMIT_SRV etc:$COMMIT_ETC"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
MSG="$2\n\nDocker stats:\n$UPTIME"
|
||||||
|
echo -e "$MSG" | https_proxy=$HTTPS_PROXY_URL curl -A "$USER_AGENT" -s -o /dev/null -X POST --data-binary @- "$HCURL"/"$1" || log WARN "Monitoring failed: Unable to send data to $HCURL/$1"
|
||||||
|
else
|
||||||
|
https_proxy=$HTTPS_PROXY_URL curl -A "$USER_AGENT" -s -o /dev/null "$HCURL"/"$1" || log WARN "Monitoring failed: Unable to send data to $HCURL/$1"
|
||||||
|
fi
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
source lib/log.sh
|
||||||
|
source lib/functions.sh
|
||||||
|
|
||||||
|
log "INFO" "Preparing your system for bridgehead installation ..."
|
||||||
|
|
||||||
|
# Create the bridgehead user
|
||||||
|
if id bridgehead &>/dev/null; then
|
||||||
|
log "INFO" "Existing user with id $(id -u bridgehead) will be used by the bridgehead system units."
|
||||||
|
else
|
||||||
|
log "INFO" "Now creating a system user to own the bridgehead's files."
|
||||||
|
useradd -M -g docker -N bridgehead || fail_and_report ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Clone the OpenSource repository of bridgehead
|
||||||
|
bridgehead_repository_url="https://github.com/samply/bridgehead.git"
|
||||||
|
if [ -d "/srv/docker/bridgehead" ]; then
|
||||||
|
current_owner=$(stat -c '%U' /srv/docker/bridgehead)
|
||||||
|
if [ "$(su -c 'git -C /srv/docker/bridgehead remote get-url origin' $current_owner)" == "$bridgehead_repository_url" ]; then
|
||||||
|
log "INFO" "Bridgehead's open-source repository has been found at /srv/docker/bridgehead"
|
||||||
|
else
|
||||||
|
log "ERROR" "The directory /srv/docker/bridgehead seems to exist, but doesn't contain a clone of $bridgehead_repository_url\nPlease delete the directory and try again."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "INFO" "Cloning $bridgehead_repository_url to /srv/docker/bridgehead"
|
||||||
|
mkdir -p /srv/docker/
|
||||||
|
git clone bridgehead_repository_url /srv/docker/bridgehead -b feature/samplyBeam
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$PROJECT" in
|
||||||
|
ccp)
|
||||||
|
site_configuration_repository_middle="git.verbis.dkfz.de/bridgehead-configurations/bridgehead-config-"
|
||||||
|
;;
|
||||||
|
bbmri)
|
||||||
|
site_configuration_repository_middle="git.verbis.dkfz.de/bbmri-bridgehead-configs/"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
log ERROR "Internal error, this should not happen."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Clone the site-configuration
|
||||||
|
if [ -d /etc/bridgehead ]; then
|
||||||
|
current_owner=$(stat -c '%U' /etc/bridgehead)
|
||||||
|
if [ "$(su -c 'git -C /etc/bridgehead remote get-url origin' $current_owner | grep $site_configuration_repository_middle)" ]; then
|
||||||
|
log "INFO" "Your site config repository in /etc/bridgehead seems to be installed correctly."
|
||||||
|
else
|
||||||
|
log "WARN" "Your site configuration repository in /etc/bridgehead seems to have another origin than git.verbis.dkfz.de. Please check if the repository is correctly cloned!"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "INFO" "Now cloning your site configuration repository for you."
|
||||||
|
read -p "Please enter your site: " site
|
||||||
|
read -s -p "Please enter the bridgehead's access token for your site configuration repository (will not be echoed): " access_token
|
||||||
|
site_configuration_repository_url="https://bytoken:${access_token}@${site_configuration_repository_middle}$(echo $site | tr '[:upper:]' '[:lower:]').git"
|
||||||
|
git clone $site_configuration_repository_url /etc/bridgehead
|
||||||
|
if [ $? -gt 0 ]; then
|
||||||
|
log "ERROR" "Unable to clone your configuration repository. Please obtain correct access data and try again."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown -R bridgehead /etc/bridgehead /srv/docker/bridgehead
|
||||||
|
|
||||||
|
log INFO "System preparation is completed and private key is present."
|
||||||
|
|
|
@ -2,63 +2,82 @@
|
||||||
|
|
||||||
source lib/functions.sh
|
source lib/functions.sh
|
||||||
|
|
||||||
|
detectCompose
|
||||||
|
|
||||||
if ! id "bridgehead" &>/dev/null; then
|
if ! id "bridgehead" &>/dev/null; then
|
||||||
log ERROR "User bridgehead does not exist. Please consult readme for installation."
|
log ERROR "User bridgehead does not exist. Please run bridgehead install $PROJECT"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
checkOwner . bridgehead || exit 1
|
checkOwner /srv/docker/bridgehead bridgehead || exit 1
|
||||||
checkOwner /etc/bridgehead bridgehead || exit 1
|
checkOwner /etc/bridgehead bridgehead || exit 1
|
||||||
|
|
||||||
## Check if user is a su
|
## Check if user is a su
|
||||||
log INFO "Checking if all prerequisites are met ..."
|
log INFO "Checking if all prerequisites are met ..."
|
||||||
prerequisites="git docker docker-compose"
|
prerequisites="git docker"
|
||||||
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!"
|
fail_and_report 79 "Prerequisite not fulfilled - $prerequisite is not available!"
|
||||||
exit 79
|
|
||||||
fi
|
fi
|
||||||
# TODO: Check for specific version
|
# TODO: Check for specific version
|
||||||
done
|
done
|
||||||
|
|
||||||
|
log INFO "Checking if sudo is installed ..."
|
||||||
|
if [ ! -d /etc/sudoers.d ]; then
|
||||||
|
fail_and_report 1 "/etc/sudoers.d does not exist. Please install sudo package."
|
||||||
|
fi
|
||||||
|
|
||||||
log INFO "Checking configuration ..."
|
log INFO "Checking configuration ..."
|
||||||
|
|
||||||
## Download submodule
|
## Download submodule
|
||||||
if [ ! -d "/etc/bridgehead/" ]; then
|
if [ ! -d "/etc/bridgehead/" ]; then
|
||||||
log ERROR "Please set up the config folder at /etc/bridgehead. Instruction are in the readme."
|
fail_and_report 1 "Please set up the config folder at /etc/bridgehead. Instruction are in the readme."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: Check all required variables here in a generic loop
|
# TODO: Check all required variables here in a generic loop
|
||||||
|
|
||||||
#check if project env is present
|
#check if project env is present
|
||||||
if [ -d "/etc/bridgehead/${PROJECT}.conf" ]; then
|
if [ -d "/etc/bridgehead/${PROJECT}.conf" ]; then
|
||||||
log ERROR "Project config not found. Please copy the template from ${PROJECT} and put it under /etc/bridgehead-config/${PROJECT}.conf."
|
fail_and_report 1 "Project config not found. Please copy the template from ${PROJECT} and put it under /etc/bridgehead-config/${PROJECT}.conf."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: Make sure you're in the right directory, or, even better, be independent from the working directory.
|
# TODO: Make sure you're in the right directory, or, even better, be independent from the working directory.
|
||||||
|
|
||||||
log INFO "Checking ssl cert"
|
log INFO "Checking ssl cert for accessing bridgehead via https"
|
||||||
|
|
||||||
if [ ! -d "certs" ]; then
|
if [ ! -d "/etc/bridgehead/traefik-tls" ]; then
|
||||||
log WARN "TLS cert missing, we'll now create a self-signed one. Please consider getting an officially signed one (e.g. via Let's Encrypt ...)"
|
log WARN "TLS certs for accessing bridgehead via https missing, we'll now create a self-signed one. Please consider getting an officially signed one (e.g. via Let's Encrypt ...) and put into /etc/bridgehead/traefik-tls"
|
||||||
mkdir -p certs
|
mkdir -p /etc/bridgehead/traefik-tls
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "certs/traefik.crt" ]; then
|
if [ ! -e "/etc/bridgehead/traefik-tls/fullchain.pem" ]; then
|
||||||
openssl req -x509 -newkey rsa:4096 -nodes -keyout certs/traefik.key -out certs/traefik.crt -days 3650 -subj "/CN=$HOST"
|
openssl req -x509 -newkey rsa:4096 -nodes -keyout /etc/bridgehead/traefik-tls/privkey.pem -out /etc/bridgehead/traefik-tls/fullchain.pem -days 3650 -subj "/CN=$HOST"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e /etc/bridgehead/vault.conf ]; then
|
if [ -e /etc/bridgehead/vault.conf ]; then
|
||||||
if [ "$(stat -c "%a %U" /etc/bridgehead/vault.conf)" != "600 bridgehead" ]; then
|
if [ "$(stat -c "%a %U" /etc/bridgehead/vault.conf)" != "600 bridgehead" ]; then
|
||||||
log ERROR "/etc/bridgehead/vault.conf has wrong owner/permissions. To correct this issue, run chmod 600 /etc/bridgehead/vault.conf && chown bridgehead /etc/bridgehead/vault.conf."
|
fail_and_report 1 "/etc/bridgehead/vault.conf has wrong owner/permissions. To correct this issue, run chmod 600 /etc/bridgehead/vault.conf && chown bridgehead /etc/bridgehead/vault.conf."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log INFO "Success - all prerequisites are met!"
|
checkPrivKey() {
|
||||||
|
if [ -e /etc/bridgehead/pki/${SITE_ID}.priv.pem ]; then
|
||||||
|
log INFO "Success - private key found."
|
||||||
|
else
|
||||||
|
log ERROR "Unable to find private key at /etc/bridgehead/pki/${SITE_ID}.priv.pem. To fix, please run\n bridgehead enroll ${PROJECT}\nand follow the instructions."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
log INFO "Success - all prerequisites are met!"
|
||||||
|
hc_send log "Success - all prerequisites are met!"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "$@" =~ "noprivkey" ]]; then
|
||||||
|
log INFO "Skipping check for private key for now."
|
||||||
|
else
|
||||||
|
checkPrivKey || exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,37 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source lib/functions.sh
|
|
||||||
|
|
||||||
exitIfNotRoot
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
|
||||||
log "ERROR" "Please provide a Project as argument"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $1 != "ccp" ] && [ $1 != "nngm" ] && [ $1 != "gbn" ]; then
|
|
||||||
log "ERROR" "Please provide a supported project like ccp, gbn or nngm"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
export PROJECT=$1
|
|
||||||
|
|
||||||
checkRequirements
|
|
||||||
|
|
||||||
log "INFO" "Register system units for bridgehead and bridgehead-update"
|
|
||||||
cp -v \
|
|
||||||
lib/systemd/bridgehead\@.service \
|
|
||||||
lib/systemd/bridgehead-update\@.service \
|
|
||||||
lib/systemd/bridgehead-update\@.timer \
|
|
||||||
/etc/systemd/system/
|
|
||||||
|
|
||||||
systemctl daemon-reload
|
|
||||||
|
|
||||||
if ! systemctl is-active --quiet bridgehead@"${PROJECT}"; then
|
|
||||||
log "INFO" "Enabling autostart of bridgehead@${PROJECT}.service"
|
|
||||||
systemctl enable bridgehead@"${PROJECT}"
|
|
||||||
log "INFO" "Enabling nightly updates for bridgehead@${PROJECT}.service ..."
|
|
||||||
systemctl enable --now bridgehead-update@"${PROJECT}".timer
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "INFO" "\nDone - now start your bridgehead by running\n\tsystemctl start bridgehead@${PROJECT}.service\nor by rebooting your machine."
|
|
|
@ -4,7 +4,9 @@ Description=Bridgehead (%i) Update Service
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
User=bridgehead
|
User=bridgehead
|
||||||
|
ExecStartPre=-/srv/docker/bridgehead/bridgehead preUpdate %i
|
||||||
ExecStart=/srv/docker/bridgehead/bridgehead update %i
|
ExecStart=/srv/docker/bridgehead/bridgehead update %i
|
||||||
|
ExecStopPost=-/srv/docker/bridgehead/bridgehead postUpdate %i
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Nightly Updates of Bridgehead (%i)
|
Description=Hourly Updates of Bridgehead (%i)
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar=*-*-* 03:00:00
|
OnCalendar=*-*-* *:00:00
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=basic.target
|
WantedBy=basic.target
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Bridgehead (%i) Service
|
Description=Bridgehead (%i)
|
||||||
|
Requires=docker.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=bridgehead
|
User=bridgehead
|
||||||
Restart=always
|
Restart=always
|
||||||
RestartSec=30
|
RestartSec=30
|
||||||
|
ExecStartPre=-/srv/docker/bridgehead/bridgehead preRun %i
|
||||||
ExecStart=/srv/docker/bridgehead/bridgehead start %i
|
ExecStart=/srv/docker/bridgehead/bridgehead start %i
|
||||||
ExecStop=/srv/docker/bridgehead/bridgehead stop %i
|
ExecStop=/srv/docker/bridgehead/bridgehead stop %i
|
||||||
|
ExecStopPost=-/srv/docker/bridgehead/bridgehead postRun %i
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
tls:
|
||||||
|
stores:
|
||||||
|
default:
|
||||||
|
defaultCertificate:
|
||||||
|
certFile: /certs/fullchain.pem
|
||||||
|
keyFile: /certs/privkey.pem
|
|
@ -7,15 +7,14 @@ if [ $# -eq 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $1 != "ccp" ] && [ $1 != "nngm" ] && [ $1 != "gbn" ]; then
|
|
||||||
log "ERROR" "Please provide a supported project like ccp, gbn or nngm"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
export PROJECT=$1
|
export PROJECT=$1
|
||||||
|
|
||||||
#checkRequirements // not needed when uninstalling
|
#checkRequirements // not needed when uninstalling
|
||||||
|
|
||||||
|
log INFO "Removing bridgehead sudoers permissions."
|
||||||
|
|
||||||
|
rm -vf /etc/sudoers.d/bridgehead-${PROJECT}
|
||||||
|
|
||||||
log "INFO" "Stopping system units and removing bridgehead for ${PROJECT} ..."
|
log "INFO" "Stopping system units and removing bridgehead for ${PROJECT} ..."
|
||||||
|
|
||||||
systemctl disable --now bridgehead@${PROJECT}.service bridgehead-update@${PROJECT}.timer bridgehead-update@${PROJECT}.service
|
systemctl disable --now bridgehead@${PROJECT}.service bridgehead-update@${PROJECT}.timer bridgehead-update@${PROJECT}.service
|
|
@ -1,37 +1,67 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source lib/functions.sh
|
source lib/functions.sh
|
||||||
|
|
||||||
|
AUTO_HOUSEKEEPING=${AUTO_HOUSEKEEPING:-true}
|
||||||
|
|
||||||
|
if [ "$AUTO_HOUSEKEEPING" == "true" ]; then
|
||||||
|
A="Performing automatic maintenance: Cleaning docker images."
|
||||||
|
hc_send log "$A"
|
||||||
|
log INFO "$A"
|
||||||
|
docker system prune -a -f
|
||||||
|
else
|
||||||
|
log WARN "Automatic housekeeping disabled (variable AUTO_HOUSEKEEPING != \"true\")"
|
||||||
|
fi
|
||||||
|
|
||||||
|
hc_send log "Checking for bridgehead updates ..."
|
||||||
|
|
||||||
CONFFILE=/etc/bridgehead/$1.conf
|
CONFFILE=/etc/bridgehead/$1.conf
|
||||||
|
|
||||||
if [ ! -e $CONFFILE ]; then
|
if [ ! -e $CONFFILE ]; then
|
||||||
log ERROR "Configuration file $CONFFILE not found."
|
fail_and_report 1 "Configuration file $CONFFILE not found."
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source $CONFFILE
|
source $CONFFILE
|
||||||
|
|
||||||
assertVarsNotEmpty SITE_ID || exit 1
|
assertVarsNotEmpty SITE_ID || fail_and_report 1 "Update failed: SITE_ID empty"
|
||||||
export SITE_ID
|
export SITE_ID
|
||||||
|
|
||||||
checkOwner . bridgehead || exit 1
|
checkOwner . bridgehead || fail_and_report 1 "Update failed: Wrong permissions in $(pwd)"
|
||||||
checkOwner /etc/bridgehead bridgehead || exit 1
|
checkOwner /etc/bridgehead bridgehead || fail_and_report 1 "Update failed: Wrong permissions in /etc/bridgehead"
|
||||||
|
|
||||||
CREDHELPER="/srv/docker/bridgehead/lib/gitpassword.sh"
|
CREDHELPER="/srv/docker/bridgehead/lib/gitpassword.sh"
|
||||||
|
|
||||||
|
CHANGES=""
|
||||||
|
|
||||||
# Check git updates
|
# Check git updates
|
||||||
|
git_updated="false"
|
||||||
for DIR in /etc/bridgehead $(pwd); do
|
for DIR in /etc/bridgehead $(pwd); do
|
||||||
log "INFO" "Checking for updates to git repo $DIR ..."
|
log "INFO" "Checking for updates to git repo $DIR ..."
|
||||||
|
OUT="$(git -C $DIR status --porcelain)"
|
||||||
|
if [ -n "$OUT" ]; then
|
||||||
|
log WARN "The working directory $DIR is modified. Changed files: $OUT"
|
||||||
|
report_error log "The working directory $DIR is modified. Changed files: $OUT"
|
||||||
|
fi
|
||||||
if [ "$(git -C $DIR config --get credential.helper)" != "$CREDHELPER" ]; then
|
if [ "$(git -C $DIR config --get credential.helper)" != "$CREDHELPER" ]; then
|
||||||
log "INFO" "Configuring repo to use bridgehead git credential helper."
|
log "INFO" "Configuring repo to use bridgehead git credential helper."
|
||||||
git -C $DIR config credential.helper "$CREDHELPER"
|
git -C $DIR config credential.helper "$CREDHELPER"
|
||||||
fi
|
fi
|
||||||
old_git_hash="$(git -C $DIR rev-parse --verify HEAD)"
|
old_git_hash="$(git -C $DIR rev-parse --verify HEAD)"
|
||||||
git -C $DIR fetch 2>&1
|
if [ -z "$HTTP_PROXY_URL" ]; then
|
||||||
git -C $DIR pull 2>&1
|
log "INFO" "Git is using no proxy!"
|
||||||
|
OUT=$(git -C $DIR fetch 2>&1 && git -C $DIR pull 2>&1)
|
||||||
|
else
|
||||||
|
log "INFO" "Git is using proxy ${HTTP_PROXY_URL} from ${CONFFILE}"
|
||||||
|
OUT=$(git -c http.proxy=$HTTP_PROXY_URL -c https.proxy=$HTTPS_PROXY_URL -C $DIR fetch 2>&1 && git -c http.proxy=$HTTP_PROXY_URL -c https.proxy=$HTTPS_PROXY_URL -C $DIR pull 2>&1)
|
||||||
|
fi
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
report_error log "Unable to update git $DIR: $OUT"
|
||||||
|
fi
|
||||||
|
|
||||||
new_git_hash="$(git -C $DIR rev-parse --verify HEAD)"
|
new_git_hash="$(git -C $DIR rev-parse --verify HEAD)"
|
||||||
git_updated="false"
|
|
||||||
if [ "$old_git_hash" != "$new_git_hash" ]; then
|
if [ "$old_git_hash" != "$new_git_hash" ]; then
|
||||||
log "INFO" "Updated git repository in ${DIR} from commit $old_git_hash to $new_git_hash"
|
CHANGE="Updated git repository in ${DIR} from commit $old_git_hash to $new_git_hash"
|
||||||
|
CHANGES+="- $CHANGE\n"
|
||||||
|
log "INFO" "$CHANGE"
|
||||||
# NOTE: Link generation doesn't work on repositories placed at an self-hosted instance of bitbucket.
|
# NOTE: Link generation doesn't work on repositories placed at an self-hosted instance of bitbucket.
|
||||||
# See: https://community.atlassian.com/t5/Bitbucket-questions/BitBucket-4-14-diff-between-any-two-commits/qaq-p/632974
|
# See: https://community.atlassian.com/t5/Bitbucket-questions/BitBucket-4-14-diff-between-any-two-commits/qaq-p/632974
|
||||||
git_repository_url="$(git -C $DIR remote get-url origin)"
|
git_repository_url="$(git -C $DIR remote get-url origin)"
|
||||||
|
@ -52,20 +82,26 @@ done
|
||||||
# Check docker updates
|
# Check docker updates
|
||||||
log "INFO" "Checking for updates to running docker images ..."
|
log "INFO" "Checking for updates to running docker images ..."
|
||||||
docker_updated="false"
|
docker_updated="false"
|
||||||
for IMAGE in $(docker ps --filter "name=bridgehead" --format {{.Image}}); do
|
for IMAGE in $(cat $PROJECT/docker-compose.yml | grep -v "^#" | grep "image:" | sed -e 's_^.*image: \(.*\).*$_\1_g; s_\"__g'); do
|
||||||
log "INFO" "Checking for Updates of Image: $IMAGE"
|
log "INFO" "Checking for Updates of Image: $IMAGE"
|
||||||
if docker pull $IMAGE | grep "Downloaded newer image"; then
|
if docker pull $IMAGE | grep "Downloaded newer image"; then
|
||||||
log "INFO" "$IMAGE updated."
|
CHANGE="Image $IMAGE updated."
|
||||||
|
CHANGES+="- $CHANGE\n"
|
||||||
|
log "INFO" "$CHANGE"
|
||||||
docker_updated="true"
|
docker_updated="true"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# If anything is updated, restart service
|
# If anything is updated, restart service
|
||||||
if [ $git_updated = "true" ] || [ $docker_updated = "true" ]; then
|
if [ $git_updated = "true" ] || [ $docker_updated = "true" ]; then
|
||||||
log "INFO" "Update detected, now restarting bridgehead"
|
RES="Updates detected, now restarting bridgehead:\n$CHANGES"
|
||||||
systemctl restart 'bridgehead@*'
|
log "INFO" "$RES"
|
||||||
|
hc_send log "$RES"
|
||||||
|
sudo /bin/systemctl restart bridgehead@*.service
|
||||||
else
|
else
|
||||||
log "INFO" "Nothing updated, nothing to restart."
|
RES="Nothing updated, nothing to restart."
|
||||||
|
log "INFO" "$RES"
|
||||||
|
hc_send log "$RES"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -1,86 +0,0 @@
|
||||||
version: "3.7"
|
|
||||||
|
|
||||||
services:
|
|
||||||
traefik:
|
|
||||||
container_name: bridgehead-traefik
|
|
||||||
image: traefik:2.4
|
|
||||||
command:
|
|
||||||
- --api.insecure=true
|
|
||||||
- --entrypoints.web.address=:80
|
|
||||||
- --entrypoints.websecure.address=:443
|
|
||||||
- --providers.docker=true
|
|
||||||
- --entrypoints.web.http.redirections.entrypoint.to=websecure
|
|
||||||
- --entrypoints.web.http.redirections.entrypoint.scheme=https
|
|
||||||
ports:
|
|
||||||
- 80:80
|
|
||||||
- 443:443
|
|
||||||
- 8080:8080
|
|
||||||
volumes:
|
|
||||||
- ../certs:/tools/certs
|
|
||||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
|
|
||||||
### Does need to know the outside proxy to connect central components
|
|
||||||
forward_proxy:
|
|
||||||
container_name: bridgehead-squid
|
|
||||||
image: ubuntu/squid
|
|
||||||
environment:
|
|
||||||
http_proxy: ${http_proxy}
|
|
||||||
https_proxy: ${https_proxy}
|
|
||||||
volumes:
|
|
||||||
- "bridgehead-proxy:/var/log/squid"
|
|
||||||
|
|
||||||
## Needs internal proxy config
|
|
||||||
landing:
|
|
||||||
container_name: bridgehead-landingpage
|
|
||||||
image: samply/bridgehead-landingpage
|
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.http.routers.landing.rule=PathPrefix(`/`)"
|
|
||||||
- "traefik.http.services.landing.loadbalancer.server.port=80"
|
|
||||||
- "traefik.http.routers.landing.tls=true"
|
|
||||||
environment:
|
|
||||||
HOST: ${HOST}
|
|
||||||
PROJECT: ${PROJECT}
|
|
||||||
SITE_NAME: ${SITE_NAME}
|
|
||||||
|
|
||||||
nngm-connector:
|
|
||||||
container_name: bridgehead-nngm-connector
|
|
||||||
image: "samply/share-client:nngm-feature-environmentPreconfiguration"
|
|
||||||
environment:
|
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
||||||
NNGM_MAGICPL_APIKEY: ${NNGM_MAGICPL_APIKEY}
|
|
||||||
NNGM_MAINZELLISTE_APIKEY: ${NNGM_MAINZELLISTE_APIKEY}
|
|
||||||
NNGM_CTS_APIKEY: ${NNGM_CTS_APIKEY}
|
|
||||||
NNGM_CRYPTKEY: ${NNGM_CRYPTKEY}
|
|
||||||
volumes:
|
|
||||||
- "nngm-connector-logs:/usr/local/tomcat/logs"
|
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.http.routers.nngm_connector.rule=PathPrefix(`/nngm-connector`)"
|
|
||||||
- "traefik.http.services.nngm_connector.loadbalancer.server.port=8080"
|
|
||||||
- "traefik.http.routers.nngm_connector.tls=true"
|
|
||||||
|
|
||||||
depends_on:
|
|
||||||
- "nngm-connector-db"
|
|
||||||
- "forward_proxy"
|
|
||||||
ports:
|
|
||||||
- 5005:5005
|
|
||||||
restart: "always"
|
|
||||||
|
|
||||||
nngm-connector-db:
|
|
||||||
container_name: bridgehead-nngm-connector-db
|
|
||||||
image: "postgres:10.17"
|
|
||||||
environment:
|
|
||||||
POSTGRES_DB: "share_v2"
|
|
||||||
POSTGRES_USER: "samplyweb"
|
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
||||||
volumes:
|
|
||||||
- "nngm-connector-db-data:/var/lib/postgresql/data"
|
|
||||||
restart: "always"
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
nngm-connector-db-data:
|
|
||||||
nngm-connector-logs:
|
|
||||||
bridgehead-proxy:
|
|
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
### This is the configuration file for secrets, only your site should know
|
|
||||||
|
|
||||||
##Setting Network properties
|
|
||||||
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=
|
|
||||||
|
|
||||||
export site_name=
|
|
||||||
### Write the Project you want to start with the brigdehead
|
|
||||||
##Exmaple project=dktk-fed
|
|
||||||
export project=
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
### Note: Currently not complete, needs some features before useable for production
|
|
||||||
|
|
||||||
source lib/functions.sh
|
|
||||||
|
|
||||||
if ! lib/prerequisites.sh; then
|
|
||||||
log "Prerequisites failed, exiting"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
source site.conf
|
|
||||||
|
|
||||||
./lib/generate.sh
|
|
||||||
|
|
||||||
log "Starting bridgehead"
|
|
||||||
|
|
||||||
docker-compose -f ${project}/docker-compose.yml --env-file site-config/${project}.env up -d
|
|
||||||
|
|
||||||
log "The bridgehead should be in online in a few seconds"
|
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
source lib/functions.sh
|
|
||||||
source site.conf
|
|
||||||
|
|
||||||
log "Stopping bridgehead"
|
|
||||||
|
|
||||||
docker-compose -f ${project}/docker-compose.yml --env-file site-config/${project}.env down
|
|
|
@ -1,10 +0,0 @@
|
||||||
#!/bin/bash -e
|
|
||||||
|
|
||||||
source site.conf
|
|
||||||
source lib/functions.sh
|
|
||||||
|
|
||||||
echo "Stopping systemd services and removing bridgehead ..."
|
|
||||||
|
|
||||||
systemctl disable --now bridgehead@${project}.service bridgehead-update@${project}.timer bridgehead-update@${project}.service
|
|
||||||
|
|
||||||
rm -v /etc/systemd/system/{bridgehead\@.service,bridgehead-update\@.timer,bridgehead-update\@.service}
|
|
|
@ -1,38 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
service="bridgehead"
|
|
||||||
|
|
||||||
source lib/functions.sh
|
|
||||||
|
|
||||||
if ! lib/prerequisites.sh; then
|
|
||||||
log "Prerequisites failed, exiting"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "INFO" "Checking for updates of $service"
|
|
||||||
# check prerequisites
|
|
||||||
|
|
||||||
# check if updates are available
|
|
||||||
old_git_hash="$(git rev-parse --verify HEAD)"
|
|
||||||
git fetch 2>&1
|
|
||||||
git pull 2>&1
|
|
||||||
new_git_hash="$(git rev-parse --verify HEAD)"
|
|
||||||
git_updated="false"
|
|
||||||
if [ "$old_git_hash" != "$new_git_hash" ]; then
|
|
||||||
log "INFO" "Pulled new changes from origin"
|
|
||||||
git_updated="true"
|
|
||||||
fi
|
|
||||||
docker_updated="false"
|
|
||||||
for image in $(docker ps --filter "name=$service" --format {{.Image}}); do
|
|
||||||
log "INFO" "Checking for Updates of Image: $image"
|
|
||||||
if docker pull $image | grep "Downloaded newer image"; then
|
|
||||||
log "INFO" "$image updated."
|
|
||||||
docker_updated="true"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ $git_updated = "true" ] || [ $docker_updated = "true" ]; then
|
|
||||||
log "INFO" "Due to previous updates now restarting $service@$1"
|
|
||||||
systemctl restart "$service@$1.service"
|
|
||||||
./lib/generate.sh
|
|
||||||
fi
|
|
||||||
log "INFO" "checking updates finished"
|
|
||||||
exit 0
|
|
Loading…
Reference in New Issue