From a1cdc2659df70a767c2948a00462e46bc0a554ea Mon Sep 17 00:00:00 2001 From: djuarezgf <46350150+djuarezgf@users.noreply.github.com> Date: Wed, 25 Jun 2025 15:53:29 +0200 Subject: [PATCH] CCE Teiler and Export (#323) * Added Exporter to CCE * Add Teiler to CCE * Add EXPORTER_USER to adduser function --- bbmri/modules/exporter.md | 15 ------ bbmri/modules/teiler.md | 19 ------- bridgehead | 2 +- cce/modules/exporter-compose.yml | 87 ++++++++++++++++++++++++++++++++ cce/modules/exporter-setup.sh | 8 +++ cce/modules/teiler-compose.yml | 69 +++++++++++++++++++++++++ cce/modules/teiler-setup.sh | 8 +++ 7 files changed, 173 insertions(+), 35 deletions(-) delete mode 100644 bbmri/modules/exporter.md delete mode 100644 bbmri/modules/teiler.md create mode 100644 cce/modules/exporter-compose.yml create mode 100644 cce/modules/exporter-setup.sh create mode 100644 cce/modules/teiler-compose.yml create mode 100644 cce/modules/teiler-setup.sh diff --git a/bbmri/modules/exporter.md b/bbmri/modules/exporter.md deleted file mode 100644 index 24e81b0..0000000 --- a/bbmri/modules/exporter.md +++ /dev/null @@ -1,15 +0,0 @@ -# Exporter and Reporter - - -## Exporter -The exporter is a REST API that exports the data of the different databases of the bridgehead in a set of tables. -It can accept different output formats as CSV, Excel, JSON or XML. It can also export data into Opal. - -## Exporter-DB -It is a database to save queries for its execution in the exporter. -The exporter manages also the different executions of the same query in through the database. - -## Reporter -This component is a plugin of the exporter that allows to create more complex Excel reports described in templates. -It is compatible with different template engines as Groovy, Thymeleaf,... -It is perfect to generate a document as our traditional CCP quality report. diff --git a/bbmri/modules/teiler.md b/bbmri/modules/teiler.md deleted file mode 100644 index 51e94e4..0000000 --- a/bbmri/modules/teiler.md +++ /dev/null @@ -1,19 +0,0 @@ -# Teiler -This module orchestrates the different microfrontends of the bridgehead as a single page application. - -## Teiler Orchestrator -Single SPA component that consists on the root HTML site of the single page application and a javascript code that -gets the information about the microfrontend calling the teiler backend and is responsible for registering them. With the -resulting mapping, it can initialize, mount and unmount the required microfrontends on the fly. - -The microfrontends run independently in different containers and can be based on different frameworks (Angular, Vue, React,...) -This microfrontends can run as single alone but need an extension with Single-SPA (https://single-spa.js.org/docs/ecosystem). -There are also available three templates (Angular, Vue, React) to be directly extended to be used directly in the teiler. - -## Teiler Dashboard -It consists on the main dashboard and a set of embedded services. -### Login -user and password in ccp.local.conf - -## Teiler Backend -In this component, the microfrontends are configured. diff --git a/bridgehead b/bridgehead index 395504a..1951a7f 100755 --- a/bridgehead +++ b/bridgehead @@ -162,7 +162,7 @@ case "$ACTION" in adduser) loadVars log "INFO" "Adding encrypted credentials in /etc/bridgehead/$PROJECT.local.conf" - read -p "Please choose the component (LDM_AUTH|NNGM_AUTH) you want to add a user to : " COMPONENT + read -p "Please choose the component (LDM_AUTH|NNGM_AUTH|EXPORTER_USER) you want to add a user to : " COMPONENT read -p "Please enter a username: " USER read -s -p "Please enter a password (will not be echoed): "$'\n' PASSWORD add_basic_auth_user $USER $PASSWORD $COMPONENT $PROJECT diff --git a/cce/modules/exporter-compose.yml b/cce/modules/exporter-compose.yml new file mode 100644 index 0000000..af31465 --- /dev/null +++ b/cce/modules/exporter-compose.yml @@ -0,0 +1,87 @@ +version: "3.7" + +services: + + exporter: + image: docker.verbis.dkfz.de/ccp/dktk-exporter:latest + container_name: bridgehead-cce-exporter + environment: + JAVA_OPTS: "-Xms1G -Xmx8G -XX:+UseG1GC" + LOG_LEVEL: "INFO" + EXPORTER_API_KEY: "${EXPORTER_API_KEY}" # Set in exporter-setup.sh + CROSS_ORIGINS: "https://${HOST}" + EXPORTER_DB_USER: "exporter" + EXPORTER_DB_PASSWORD: "${EXPORTER_DB_PASSWORD}" # Set in exporter-setup.sh + EXPORTER_DB_URL: "jdbc:postgresql://exporter-db:5432/exporter" + HTTP_RELATIVE_PATH: "/cce-exporter" + SITE: "${SITE_ID}" + HTTP_SERVLET_REQUEST_SCHEME: "https" + OPAL_PASSWORD: "${EXPORTER_OPAL_PASSWORD}" + labels: + - "traefik.enable=true" + - "traefik.http.routers.exporter_cce.rule=PathPrefix(`/cce-exporter`)" + - "traefik.http.services.exporter_cce.loadbalancer.server.port=8092" + - "traefik.http.routers.exporter_cce.tls=true" + - "traefik.http.middlewares.exporter_cce_strip.stripprefix.prefixes=/cce-exporter" + - "traefik.http.routers.exporter_cce.middlewares=exporter_cce_strip" + # Main router + - "traefik.http.routers.exporter_cce.priority=20" + + # API router + - "traefik.http.routers.exporter_cce_api.middlewares=exporter_cce_strip,exporter_auth" + - "traefik.http.routers.exporter_cce_api.rule=PathRegexp(`/cce-exporter/.+`)" + - "traefik.http.routers.exporter_cce_api.tls=true" + - "traefik.http.routers.exporter_cce_api.priority=25" + + # Shared middlewares + - "traefik.http.middlewares.exporter_auth.basicauth.users=${EXPORTER_USER}" + + volumes: + - "/var/cache/bridgehead/cce/exporter-files:/app/exporter-files/output" + + exporter-db: + image: docker.verbis.dkfz.de/cache/postgres:${POSTGRES_TAG} + container_name: bridgehead-cce-exporter-db + environment: + POSTGRES_USER: "exporter" + POSTGRES_PASSWORD: "${EXPORTER_DB_PASSWORD}" # Set in exporter-setup.sh + POSTGRES_DB: "exporter" + volumes: + # Consider removing this volume once we find a solution to save Lens-queries to be executed in the explorer. + - "/var/cache/bridgehead/cce/exporter-db:/var/lib/postgresql/data" + + reporter: + image: docker.verbis.dkfz.de/ccp/dktk-reporter:latest + container_name: bridgehead-cce-reporter + environment: + JAVA_OPTS: "-Xms1G -Xmx8G -XX:+UseG1GC" + LOG_LEVEL: "INFO" + CROSS_ORIGINS: "https://${HOST}" + HTTP_RELATIVE_PATH: "/cce-reporter" + SITE: "${SITE_ID}" + EXPORTER_API_KEY: "${EXPORTER_API_KEY}" # Set in exporter-setup.sh + EXPORTER_URL: "http://exporter:8092" + LOG_FHIR_VALIDATION: "false" + HTTP_SERVLET_REQUEST_SCHEME: "https" + + # In this initial development state of the bridgehead, we are trying to have so many volumes as possible. + # However, in the first executions in the cce sites, this volume seems to be very important. A report is + # a process that can take several hours, because it depends on the exporter. + # There is a risk that the bridgehead restarts, losing the already created export. + + volumes: + - "/var/cache/bridgehead/cce/reporter-files:/app/reports" + labels: + - "traefik.enable=true" + - "traefik.http.routers.reporter_cce.rule=PathPrefix(`/cce-reporter`)" + - "traefik.http.services.reporter_cce.loadbalancer.server.port=8095" + - "traefik.http.routers.reporter_cce.tls=true" + - "traefik.http.middlewares.reporter_cce_strip.stripprefix.prefixes=/cce-reporter" + - "traefik.http.routers.reporter_cce.middlewares=reporter_cce_strip" + - "traefik.http.routers.reporter_cce.priority=20" + + - "traefik.http.routers.reporter_cce_api.middlewares=reporter_cce_strip,exporter_auth" + - "traefik.http.routers.reporter_cce_api.rule=PathRegexp(`/cce-reporter/.+`)" + - "traefik.http.routers.reporter_cce_api.tls=true" + - "traefik.http.routers.reporter_cce_api.priority=25" + diff --git a/cce/modules/exporter-setup.sh b/cce/modules/exporter-setup.sh new file mode 100644 index 0000000..9b947a6 --- /dev/null +++ b/cce/modules/exporter-setup.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e + +if [ "$ENABLE_EXPORTER" == true ]; then + log INFO "Exporter setup detected -- will start Exporter service." + OVERRIDE+=" -f ./$PROJECT/modules/exporter-compose.yml" + EXPORTER_DB_PASSWORD="$(echo \"This is a salt string to generate one consistent password for the exporter. It is not required to be secret.\" | sha1sum | openssl pkeyutl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)" + EXPORTER_API_KEY="$(echo \"This is a salt string to generate one consistent API KEY for the exporter. It is not required to be secret.\" | sha1sum | openssl pkeyutl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 64)" +fi diff --git a/cce/modules/teiler-compose.yml b/cce/modules/teiler-compose.yml new file mode 100644 index 0000000..e5db73f --- /dev/null +++ b/cce/modules/teiler-compose.yml @@ -0,0 +1,69 @@ +version: "3.7" + +services: + + teiler-orchestrator: + image: docker.verbis.dkfz.de/cache/samply/teiler-orchestrator:latest + container_name: bridgehead-teiler-orchestrator + labels: + - "traefik.enable=true" + - "traefik.http.routers.teiler_orchestrator_cce.rule=PathPrefix(`/cce-teiler`)" + - "traefik.http.services.teiler_orchestrator_cce.loadbalancer.server.port=9000" + - "traefik.http.routers.teiler_orchestrator_cce.tls=true" + - "traefik.http.middlewares.teiler_orchestrator_cce_strip.stripprefix.prefixes=/cce-teiler" + - "traefik.http.routers.teiler_orchestrator_cce.middlewares=teiler_orchestrator_cce_strip" + environment: + TEILER_BACKEND_URL: "/cce-teiler-backend" + TEILER_DASHBOARD_URL: "/cce-teiler-dashboard" + DEFAULT_LANGUAGE: "${TEILER_DEFAULT_LANGUAGE_LOWER_CASE}" + HTTP_RELATIVE_PATH: "/cce-teiler" + + teiler-dashboard: + image: docker.verbis.dkfz.de/cache/samply/teiler-dashboard:develop + container_name: bridgehead-teiler-dashboard + labels: + - "traefik.enable=true" + - "traefik.http.routers.teiler_dashboard_cce.rule=PathPrefix(`/cce-teiler-dashboard`)" + - "traefik.http.services.teiler_dashboard_cce.loadbalancer.server.port=80" + - "traefik.http.routers.teiler_dashboard_cce.tls=true" + - "traefik.http.middlewares.teiler_dashboard_cce_strip.stripprefix.prefixes=/cce-teiler-dashboard" + - "traefik.http.routers.teiler_dashboard_cce.middlewares=teiler_dashboard_cce_strip" + environment: + DEFAULT_LANGUAGE: "${TEILER_DEFAULT_LANGUAGE}" + TEILER_BACKEND_URL: "/cce-teiler-backend" + TEILER_DASHBOARD_URL: "/cce-teiler-dashboard" + OIDC_URL: "${OIDC_URL}" + OIDC_CLIENT_ID: "${OIDC_PUBLIC_CLIENT_ID}" + OIDC_TOKEN_GROUP: "${OIDC_GROUP_CLAIM}" + TEILER_ADMIN_NAME: "${OPERATOR_FIRST_NAME} ${OPERATOR_LAST_NAME}" + TEILER_ADMIN_EMAIL: "${OPERATOR_EMAIL}" + TEILER_ADMIN_PHONE: "${OPERATOR_PHONE}" + TEILER_PROJECT: "${PROJECT}" + EXPORTER_API_KEY: "${EXPORTER_API_KEY}" + TEILER_ORCHESTRATOR_URL: "/cce-teiler" + TEILER_ORCHESTRATOR_HTTP_RELATIVE_PATH: "/cce-teiler" + TEILER_USER: "${OIDC_USER_GROUP}" + TEILER_ADMIN: "${OIDC_ADMIN_GROUP}" + REPORTER_DEFAULT_TEMPLATE_ID: "cce-qb" + EXPORTER_DEFAULT_TEMPLATE_ID: "cce" + + + teiler-backend: + image: docker.verbis.dkfz.de/ccp/cce-teiler-backend:latest + container_name: bridgehead-teiler-backend + labels: + - "traefik.enable=true" + - "traefik.http.routers.teiler_backend_cce.rule=PathPrefix(`/cce-teiler-backend`)" + - "traefik.http.services.teiler_backend_cce.loadbalancer.server.port=8085" + - "traefik.http.routers.teiler_backend_cce.tls=true" + - "traefik.http.middlewares.teiler_backend_cce_strip.stripprefix.prefixes=/cce-teiler-backend" + - "traefik.http.routers.teiler_backend_cce.middlewares=teiler_backend_cce_strip" + environment: + LOG_LEVEL: "INFO" + APPLICATION_PORT: "8085" + DEFAULT_LANGUAGE: "${TEILER_DEFAULT_LANGUAGE}" + TEILER_ORCHESTRATOR_HTTP_RELATIVE_PATH: "/cce-teiler" + TEILER_ORCHESTRATOR_URL: "/cce-teiler" + TEILER_DASHBOARD_DE_URL: "/cce-teiler-dashboard/de" + TEILER_DASHBOARD_EN_URL: "/cce-teiler-dashboard/en" + HTTP_PROXY: "http://forward_proxy:3128" diff --git a/cce/modules/teiler-setup.sh b/cce/modules/teiler-setup.sh new file mode 100644 index 0000000..dc8dfc4 --- /dev/null +++ b/cce/modules/teiler-setup.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e + +if [ "$ENABLE_TEILER" == true ];then + log INFO "Teiler setup detected -- will start Teiler services." + OVERRIDE+=" -f ./$PROJECT/modules/teiler-compose.yml" + TEILER_DEFAULT_LANGUAGE=EN + TEILER_DEFAULT_LANGUAGE_LOWER_CASE=${TEILER_DEFAULT_LANGUAGE,,} +fi