From 91ff51304b25a8d0d8bc272ea3faca87ed9a8c3b Mon Sep 17 00:00:00 2001 From: Martin Lablans Date: Mon, 1 Jul 2024 14:54:04 +0200 Subject: [PATCH 1/6] Add new dashboard backend --- ccp/modules/dashboard-compose.yml | 28 ++++++++++++++++++++++++++++ ccp/modules/dashboard-setup.sh | 7 +++++++ ccp/modules/dashboard.md | 1 + 3 files changed, 36 insertions(+) create mode 100644 ccp/modules/dashboard-compose.yml create mode 100644 ccp/modules/dashboard-setup.sh create mode 100644 ccp/modules/dashboard.md diff --git a/ccp/modules/dashboard-compose.yml b/ccp/modules/dashboard-compose.yml new file mode 100644 index 0000000..43b109d --- /dev/null +++ b/ccp/modules/dashboard-compose.yml @@ -0,0 +1,28 @@ +version: "3.7" + +services: + fhir2sql: + depends_on: + - "dashboard-db" + image: docker.verbis.dkfz.de/cache/samply/fhir2sql:latest + container_name: bridgehead-ccp-dashboard-fhir2sql + environment: + BLAZE_BASE_URL: "http://blaze:8080/fhir/" + PG_HOST: "dashboard-db" + PG_PORT: 5432 + PG_USERNAME: "dashboard" + PG_PASSWORD: "${DASHBOARD_DB_PASSWORD}" # Set in exporter-setup.sh + PG_DBNAME: "dashboard" + # TODO: Remove the following, replace with defaults in app + BLAZE_PAGE_RESOURCE_COUNT: 10000 + PG_BATCH_SIZE: 10000 + + dashboard-db: + image: docker.verbis.dkfz.de/cache/postgres:${POSTGRES_TAG} + container_name: bridgehead-ccp-dashboard-db + environment: + POSTGRES_USER: "dashboard" + POSTGRES_PASSWORD: "${DASHBOARD_DB_PASSWORD}" # Set in exporter-setup.sh + POSTGRES_DB: "dashboard" + volumes: + - "/var/cache/bridgehead/ccp/dashboard-db:/var/lib/postgresql/data" diff --git a/ccp/modules/dashboard-setup.sh b/ccp/modules/dashboard-setup.sh new file mode 100644 index 0000000..aee79fa --- /dev/null +++ b/ccp/modules/dashboard-setup.sh @@ -0,0 +1,7 @@ +#!/bin/bash -e + +if [ "$ENABLE_DASHBOARD" == true ]; then + log INFO "Dashboard setup detected -- will start Dashboard backend and FHIR2SQL service." + OVERRIDE+=" -f ./$PROJECT/modules/dashboard-compose.yml" + DASHBOARD_DB_PASSWORD="$(echo \"This is a salt string to generate one consistent password for the Dashboard database. It is not required to be secret.\" | sha1sum | openssl pkeyutl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)" +fi diff --git a/ccp/modules/dashboard.md b/ccp/modules/dashboard.md new file mode 100644 index 0000000..ed00305 --- /dev/null +++ b/ccp/modules/dashboard.md @@ -0,0 +1 @@ +# TODO David Scholz From f28e3c2cd2bd311271c6eff7e47b48eb4418e23c Mon Sep 17 00:00:00 2001 From: Martin Lablans Date: Mon, 1 Jul 2024 15:19:44 +0200 Subject: [PATCH 2/6] Remove unnecessary default values --- ccp/modules/dashboard-compose.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ccp/modules/dashboard-compose.yml b/ccp/modules/dashboard-compose.yml index 43b109d..037f88f 100644 --- a/ccp/modules/dashboard-compose.yml +++ b/ccp/modules/dashboard-compose.yml @@ -9,13 +9,9 @@ services: environment: BLAZE_BASE_URL: "http://blaze:8080/fhir/" PG_HOST: "dashboard-db" - PG_PORT: 5432 PG_USERNAME: "dashboard" PG_PASSWORD: "${DASHBOARD_DB_PASSWORD}" # Set in exporter-setup.sh PG_DBNAME: "dashboard" - # TODO: Remove the following, replace with defaults in app - BLAZE_PAGE_RESOURCE_COUNT: 10000 - PG_BATCH_SIZE: 10000 dashboard-db: image: docker.verbis.dkfz.de/cache/postgres:${POSTGRES_TAG} From df08d678398a1b719af426a16d4655c2a42364e4 Mon Sep 17 00:00:00 2001 From: davidmscholz Date: Mon, 29 Jul 2024 10:45:00 +0200 Subject: [PATCH 3/6] add optional dashboard module --- ccp/modules/dashboard-compose.yml | 4 ++-- ccp/modules/dashboard.md | 37 ++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/ccp/modules/dashboard-compose.yml b/ccp/modules/dashboard-compose.yml index 037f88f..e2756d4 100644 --- a/ccp/modules/dashboard-compose.yml +++ b/ccp/modules/dashboard-compose.yml @@ -10,7 +10,7 @@ services: BLAZE_BASE_URL: "http://blaze:8080/fhir/" PG_HOST: "dashboard-db" PG_USERNAME: "dashboard" - PG_PASSWORD: "${DASHBOARD_DB_PASSWORD}" # Set in exporter-setup.sh + PG_PASSWORD: "${DASHBOARD_DB_PASSWORD}" # Set in dashboard-setup.sh PG_DBNAME: "dashboard" dashboard-db: @@ -18,7 +18,7 @@ services: container_name: bridgehead-ccp-dashboard-db environment: POSTGRES_USER: "dashboard" - POSTGRES_PASSWORD: "${DASHBOARD_DB_PASSWORD}" # Set in exporter-setup.sh + POSTGRES_PASSWORD: "${DASHBOARD_DB_PASSWORD}" # Set in dashboard-setup.sh POSTGRES_DB: "dashboard" volumes: - "/var/cache/bridgehead/ccp/dashboard-db:/var/lib/postgresql/data" diff --git a/ccp/modules/dashboard.md b/ccp/modules/dashboard.md index ed00305..defdf39 100644 --- a/ccp/modules/dashboard.md +++ b/ccp/modules/dashboard.md @@ -1 +1,36 @@ -# TODO David Scholz +# fhir2sql +fhir2sql connects to Blaze, retrieves data, and syncs it with a PostgreSQL database. The application is designed to run continuously, syncing data at regular intervals. +The Dashboard module is a optional component of the Bridgehead CCP setup. When enabled, it starts two Docker services: **fhir2sql** and **dashboard-db**. Data held in PostgreSQL is only stored temporarily and Blaze is considered to be the 'leading system' or 'source of truth'. + +## Services +### fhir2sql +* Image: docker.verbis.dkfz.de/cache/samply/fhir2sql:latest +* Container name: bridgehead-ccp-dashboard-fhir2sql +* Depends on: dashboard-db +* Environment variables: + - BLAZE_BASE_URL: The base URL of the Blaze FHIR server (set to http://blaze:8080/fhir/) + - PG_HOST: The hostname of the PostgreSQL database (set to dashboard-db) + - PG_USERNAME: The username for the PostgreSQL database (set to dashboard) + - PG_PASSWORD: The password for the PostgreSQL database (set to the value of DASHBOARD_DB_PASSWORD) + - PG_DBNAME: The name of the PostgreSQL database (set to dashboard) + +### dashboard-db + +* Image: docker.verbis.dkfz.de/cache/postgres:${POSTGRES_TAG} +* Container name: bridgehead-ccp-dashboard-db +* Environment variables: + - POSTGRES_USER: The username for the PostgreSQL database (set to dashboard) + - POSTGRES_PASSWORD: The password for the PostgreSQL database (set to the value of DASHBOARD_DB_PASSWORD) + - POSTGRES_DB: The name of the PostgreSQL database (set to dashboard) +* Volumes: + - /var/cache/bridgehead/ccp/dashboard-db:/var/lib/postgresql/data + +The volume used by dashboard-db can be removed safely and should be restored to a working order by re-importing data from Blaze. + +### Environment Variables +* DASHBOARD_DB_PASSWORD: A generated password for the PostgreSQL database, created using a salt string and the SHA1 hash function. +* POSTGRES_TAG: The tag of the PostgreSQL image to use (not set in this module, but required by the dashboard-db service). + + +### Setup +To enable the Dashboard module, set the ENABLE_DASHBOARD environment variable to true. The dashboard-setup.sh script will then start the fhir2sql and dashboard-db services, using the environment variables and volumes defined above. \ No newline at end of file From 5ed07423f3a04132c08f59294909534d4f1e8038 Mon Sep 17 00:00:00 2001 From: davidmscholz Date: Tue, 30 Jul 2024 09:24:07 +0200 Subject: [PATCH 4/6] fix dashboard-compose --- ccp/modules/dashboard-compose.yml | 3 ++- ccp/modules/dashboard-setup.sh | 2 +- ccp/modules/dashboard.md | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ccp/modules/dashboard-compose.yml b/ccp/modules/dashboard-compose.yml index e2756d4..a84ff24 100644 --- a/ccp/modules/dashboard-compose.yml +++ b/ccp/modules/dashboard-compose.yml @@ -4,10 +4,11 @@ services: fhir2sql: depends_on: - "dashboard-db" + - [ blaze ] image: docker.verbis.dkfz.de/cache/samply/fhir2sql:latest container_name: bridgehead-ccp-dashboard-fhir2sql environment: - BLAZE_BASE_URL: "http://blaze:8080/fhir/" + BLAZE_BASE_URL: "http://bridgehead-ccp-blaze:8080" PG_HOST: "dashboard-db" PG_USERNAME: "dashboard" PG_PASSWORD: "${DASHBOARD_DB_PASSWORD}" # Set in dashboard-setup.sh diff --git a/ccp/modules/dashboard-setup.sh b/ccp/modules/dashboard-setup.sh index aee79fa..e1a33af 100644 --- a/ccp/modules/dashboard-setup.sh +++ b/ccp/modules/dashboard-setup.sh @@ -1,6 +1,6 @@ #!/bin/bash -e -if [ "$ENABLE_DASHBOARD" == true ]; then +if [ "$ENABLE_FHIR2SQL" == true ]; then log INFO "Dashboard setup detected -- will start Dashboard backend and FHIR2SQL service." OVERRIDE+=" -f ./$PROJECT/modules/dashboard-compose.yml" DASHBOARD_DB_PASSWORD="$(echo \"This is a salt string to generate one consistent password for the Dashboard database. It is not required to be secret.\" | sha1sum | openssl pkeyutl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)" diff --git a/ccp/modules/dashboard.md b/ccp/modules/dashboard.md index defdf39..deea710 100644 --- a/ccp/modules/dashboard.md +++ b/ccp/modules/dashboard.md @@ -33,4 +33,4 @@ The volume used by dashboard-db can be removed safely and should be restored to ### Setup -To enable the Dashboard module, set the ENABLE_DASHBOARD environment variable to true. The dashboard-setup.sh script will then start the fhir2sql and dashboard-db services, using the environment variables and volumes defined above. \ No newline at end of file +To enable the Dashboard module, set the ENABLE_FHIR2SQL environment variable to true. The dashboard-setup.sh script will then start the fhir2sql and dashboard-db services, using the environment variables and volumes defined above. \ No newline at end of file From af44b6b4462e9ba874db9917a8d070a9df05aca4 Mon Sep 17 00:00:00 2001 From: Tobias Kussel Date: Tue, 30 Jul 2024 07:40:49 +0000 Subject: [PATCH 5/6] Fix depends_on syntax --- ccp/modules/dashboard-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccp/modules/dashboard-compose.yml b/ccp/modules/dashboard-compose.yml index a84ff24..7733787 100644 --- a/ccp/modules/dashboard-compose.yml +++ b/ccp/modules/dashboard-compose.yml @@ -4,7 +4,7 @@ services: fhir2sql: depends_on: - "dashboard-db" - - [ blaze ] + - "blaze" image: docker.verbis.dkfz.de/cache/samply/fhir2sql:latest container_name: bridgehead-ccp-dashboard-fhir2sql environment: From 2e5aeabca8cc252c431dfb05ce964740fd0755e3 Mon Sep 17 00:00:00 2001 From: Tobias Kussel Date: Tue, 30 Jul 2024 07:44:47 +0000 Subject: [PATCH 6/6] Rename fhir2sql module files --- ccp/modules/{dashboard-compose.yml => fhir2sql-compose.yml} | 0 ccp/modules/{dashboard-setup.sh => fhir2sql-setup.sh} | 2 +- ccp/modules/{dashboard.md => fhir2sql.md} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename ccp/modules/{dashboard-compose.yml => fhir2sql-compose.yml} (100%) rename ccp/modules/{dashboard-setup.sh => fhir2sql-setup.sh} (87%) rename ccp/modules/{dashboard.md => fhir2sql.md} (100%) diff --git a/ccp/modules/dashboard-compose.yml b/ccp/modules/fhir2sql-compose.yml similarity index 100% rename from ccp/modules/dashboard-compose.yml rename to ccp/modules/fhir2sql-compose.yml diff --git a/ccp/modules/dashboard-setup.sh b/ccp/modules/fhir2sql-setup.sh similarity index 87% rename from ccp/modules/dashboard-setup.sh rename to ccp/modules/fhir2sql-setup.sh index e1a33af..6b27571 100644 --- a/ccp/modules/dashboard-setup.sh +++ b/ccp/modules/fhir2sql-setup.sh @@ -2,6 +2,6 @@ if [ "$ENABLE_FHIR2SQL" == true ]; then log INFO "Dashboard setup detected -- will start Dashboard backend and FHIR2SQL service." - OVERRIDE+=" -f ./$PROJECT/modules/dashboard-compose.yml" + OVERRIDE+=" -f ./$PROJECT/modules/fhir2sql-compose.yml" DASHBOARD_DB_PASSWORD="$(echo \"This is a salt string to generate one consistent password for the Dashboard database. It is not required to be secret.\" | sha1sum | openssl pkeyutl -sign -inkey /etc/bridgehead/pki/${SITE_ID}.priv.pem | base64 | head -c 30)" fi diff --git a/ccp/modules/dashboard.md b/ccp/modules/fhir2sql.md similarity index 100% rename from ccp/modules/dashboard.md rename to ccp/modules/fhir2sql.md