Skip to main content

HIP EHRbase with YugabyteDB

Setup YugabyteDB

Before HIP EHRbase can be run, a YugabyteDB database needs to be set up and configured. Follow the instructions for YugabyteDB installation. Please note that the YugabyteDB configuration will highly depend on your project and system requirements.

You are provided with a database installation script createdb.sql. This script needs to be run as a role superuser in order to create the database. Extensions are installed in a separate schema called ext. For production servers, these operations should be performed by a configuration management system. You only have to run this script once. It only contains those operations which require superuser privileges. The actual database schema is managed by flyway, which will automatically be executed the first time CDR Base is connected to YugabyteDB.

note

A preconfigure Docker image can also be provided.

Docker

EHRbase is delivered as a single Docker container including all plugins (Please note that for the current release of EHRbase running on YugabyteDB, only ATNA Logging and Event Trigger Plugins are packaged).

Prerequisites

  • A YugabyteDB is available and is pre-configured in accordance with the steps described above.
  • A recent version of a Docker runtime environment (e.g., Docker, Rancher, Colima, etc.)

Parameters

To set parameters of HIP EHRbase and the plugins, the default environment variables can be overwritten. Check the next example (which assumes you pulled or created an image named ehrbase/ehrbase):

docker run --network ehrbase-net --name ehrbase \
-e EHRBASE_DBMSPROVIDER=YUGABYTE \
-e DB_URL=jdbc:postgresql://ehrdb:5433/ehrbase \
-e DB_USER=ehrbase_restricted \
-e DB_PASS=ehrbase_restricted \
-e DB_USER_ADMIN=ehrbase \
-e DB_PASS_ADMIN=ehrbase \
-e SERVER_NODENAME=local.ehrbase.org \
-e SPRING_PROFILES_ACTIVE=local \
-d -p 8080:8080 \
ehrbase/ehrbase

Here you can find some example settings for common use cases for the usage of EHRbase Docker containers. You can also use the environment variables with the normal .jar execution by setting the variables according to your operating system.

Use BASIC auth

Run the docker image with this setting:

docker run --network ehrbase-net --name ehrbase \
-e EHRBASE_DBMSPROVIDER=YUGABYTE \
-e DB_URL=jdbc:postgresql://ehrdb:5433/ehrbase \
-e DB_USER=ehrbase_restricted \
-e DB_PASS=ehrbase_restricted \
-e DB_USER_ADMIN=ehrbase \
-e DB_PASS_ADMIN=ehrbase \
-e SERVER_NODENAME=local.ehrbase.org \
-e SPRING_PROFILES_ACTIVE=local \
-e SECURITY_AUTHTYPE=BASIC \
-e SECURITY_AUTHUSER=myuser \
-e SECURITY_AUTHPASSWORD=ThePasswordForUser \
-e SECURITY_AUTHADMINUSER=myadmin \
-e SECURITY_AUTHADMINPASSWORD=SecretAdminPassword \
-d -p 8080:8080 \
ehrbase/ehrbase

This will set the used authentication method to BASIC auth, and all requests against the EHRbase must be provided with the Authorization header set to Basic %username%:%password% whereas the username and password must be encoded with base64.

note

Ensure you use an encrypted connection over https; otherwise, the username and password can be decrypted easily.

Use OAuth2

Run the docker image with this setting:

docker run --network ehrbase-net --name ehrbase \
-e EHRBASE_DBMSPROVIDER=YUGABYTE \
-e DB_URL=jdbc:postgresql://ehrdb:5433/ehrbase \
-e DB_USER=ehrbase_restricted \
-e DB_PASS=ehrbase_restricted \
-e DB_USER_ADMIN=ehrbase \
-e DB_PASS_ADMIN=ehrbase \
-e SERVER_NODENAME=local.ehrbase.org \
-e SPRING_PROFILES_ACTIVE=local \
-e SECURITY_AUTHTYPE=OAUTH \
-e SPRING_SECURITY_OAUTH2_RESOURCESERVER_JWT_ISSUERURI=https://keycloak.example.com/auth/realms/ehrbase \
-d -p 8080:8080 \
ehrbase/ehrbase

You have to prepare the authentication server, including a valid client at the target server to get this setup run.

note

For more information regarding authentication checkout the Security section.

HELM Chart

A Helm chart can be used to install HIP EHRbase in a Kubernetes or OpenShift cluster.

Prerequisites

  • A YugabyteDB is available and is pre-configured in accordance with the steps described above.
  • Kubernetes 1.20+
  • Helm 3.2.0+

Installing the Chart

Adding the needed chart repository:

$ helm repo add ... <<< TODO: which repo has to be added for an external user?

Install the EHRbase helm chart with a Yugabyte database with a release name ehrbase-kube in the Kubernetes context mykubecontext and the namespace myinstallnamespace: Update values.yaml and mark yugabyte.enabled: true

$ helm install --kube-context mykubecontext -n myinstallnamespace -f values.yaml ehrbase-kube .

Uninstalling the Chart

To uninstall the deployment with a release name ehrbase-kube in the Kubernetes context mykubecontext and the namespace myinstallnamespace:

$ helm uninstall --kube-context mykubecontext -n myinstallnamespace ehrbase-kube

Running Against an Existing YugabyteDB Instance

When disabling Yugabyte from this helm chart and running against an existing YugabyteDB instance, the init DB script that creates the users and DB has to be executed manually against YugabyteDB.

Open config/db_setup.sql and change the GO placeholders with concrete values

  • ${EHRBASE_DB_USER} and ${EHRBASE_DB_PASSWORD} - credentials of the ehrbase user that reads/writes data
  • ${EHRBASE_DB_USER_ADMIN} and ${EHRBASE_DB_PASSWORD_ADMIN} - credentials of the ehrbase user that manages the schema

Execute the updated script against YugabyteDB.

Parameters

Global Parameters

NameDescriptionValue
global.baseDomainDomain value for EHRbase ingress settings"ehrbase.org"
global.internalImagePullSecrets.ehrbaseImagePullSecretSecret for pulling the ehrbase image from the docker registryehrbase
global.hosts.ehrbaseEHRbase host to be used for ingressehrbase.{{ .Values.global.baseDomain }}
global.tlsSecrets.ehrbaseSecret name for the the host certificatevitasystems-dev
global.initContainer.enabledToggle the init container of the DB. To be set to false if the DB init is done manually.true

Application Parameters

This general overview of available CDR Base parameters is complemented by additional parameters within dedicated chapters of this documentation (for example, for configuration with an external terminology service).

NameDescriptionValue
appConfig.database.dbNameName of the EHRbase databaseehrbase
appConfig.database.adminUsernameName of the EHRbase admin userehrbase
appConfig.database.dbUserName of the EHRbase database userehrbase_restricted
appConfig.database.dbPortPort of the EHRbase database server5433
appConfig.database.dbHostnameHost of the EHRbase databaseyb-tservers
appConfig.database.dbDriverDatabase driver to use"jdbc:yugabytedb"
appConfig.database.dbAdditionalParameterAdditional parameter to use for EHRbase database URL (used for Yugabyte)"?load-balance=true"
appConfig.cacheEnabledToggle to activate/deactivate EHRbase caching mechanismstrue
appConfig.adminApiActiveToggle to activate/deactivate EHRbase admin APItrue
appConfig.serviceUrlExternal EHRbase URL used for ingress setup"hip-cdr-core-ehrbase-enterprise-{{ .Release.Namespace }}.{{ .Values.domain }}"
appConfig.commonFullnameOverrideEHRbase service name (also used for naming of EHRbase database service)hip-cdr-core-ehrbase-enterprise
appConfig.atna.enabledEnables ATNA logsfalse
appConfig.atna.hostHost of the ATNA logs registryhip-logging
appConfig.atna.portPort of the ATNA logs registry514
appConfig.restApiDoc.enabledEnables the built-in REST API documentation like swagger ui and api docfalse
appConfig.restApiDoc.swaggerUi.enabledEnables the Swagger ui for the EHRbase REST APIfalse
appConfig.restApiDoc.apiDocs.enabledEnables the OpenAPI documentationfalse
replicaCountNumber of EHRbase replicas to deploy1

Image Parameters

NameDescriptionValue
image.repositoryEHRbase image repositoryehrbase/ehrbase
image.pullPolicyEHRbase image pull policyAlways
image.tagEHRbase image taglatest

Service Parameters

NameDescriptionValue
service.typeEHRbase service typeClusterIP
service.portEHRbase service port8080
service.targetPortEHRbase service target port8080
service.protocolEHRbase service protocolTCP
service.nameEHRbase service namehttp

YugabyteDB Parameters

NameDescriptionValue
yugabyte.enabledToggle for choosing database deploymentfalse
yugabyte.storage.master.sizeStorage size of the Yugabyte master database5Gi
yugabyte.storage.master.storageClassStorage class of the Yugabyte master database""
yugabyte.storage.tserver.sizeStorage size of the Yugabyte tserver database5Gi
yugabyte.storage.tserver.storageClassStorage class of the Yugabyte tserver database""
yugabyte.enableLoadBalancerToggle to activate/deactivate the Yugabyte load balancerfalse
yugabyte.gflags.master.minloglevelConfigure log level for Yugabyte master node2
yugabyte.gflags.tserver.minloglevelConfigure log level for Yugabyte tserver nodes2
yugabyte.authCredentials.ysql.userUser name of the main Yugabyte YSQL useryugabyte
yugabyte.authCredentials.ysql.passwordPassword of the main Yugabyte YSQL useryugabyte