fhir-server
Helm chart for the LinuxForHealth FHIR Server
About this chart
The LinuxForHealth FHIR Server Helm Chart
The LinuxForHealth FHIR Server implements version 4 of the HL7 FHIR specification with a focus on performance and configurability.
This helm chart will help you install the LinuxForHealth FHIR Server in a Kubernetes environment and uses ConfigMaps and Secrets to support the wide range of configuration options available for the server.
This chart requires a minimum helm version of 3.7.0.
Sample usage
helm repo add linuxforhealth https://linuxforhealth.github.io/lfh-helm
export POSTGRES_ADMIN_PASSWORD=$(openssl rand -hex 20)
export POSTGRES_USER_PASSWORD=$(openssl rand -hex 20)
helm upgrade --install --render-subchart-notes fhir-server linuxforhealth/fhir-server \
--set postgresql.auth.postgresPassword=${POSTGRES_ADMIN_PASSWORD} \
--set postgresql.auth.password=${POSTGRES_USER_PASSWORD} \
--set ingress.hostname=example.com \
--set 'ingress.tls[0].secretName=cluster-tls-secret'
This will install the latest version of the LinuxForHealth FHIR Server using an included PostgreSQL database for persistence.
Note that, to upgrade, either:
postgresql.auth.postgresPasswordandpostgresql.auth.passwordmust be set to these same values ($POSTGRES_ADMIN_PASSWORDand$POSTGRES_USER_PASSWORDrespectively); orpostgresql.auth.existingSecretmust be set to the name of the secret created from the initial installation.
Otherwise the passwords in the secret may become out-of-sync with the passwords in the persistent volume claim.
Often it is easiest to specify a values override file, as opposed to setting the values from the command line on each installation / upgrade.
Transport Layer Security
By default, the LinuxForHealth FHIR Server will only serve HTTPS traffic. With the NGINX Ingress Controller, this means that users must set the following ingress annotation:
nginx.ingress.kubernetes.io/backend-protocol: HTTPS
This can be accomplished via --set 'ingress.annotations.nginx\.ingress\.kubernetes\.io/backend-protocol=HTTPS' or
from your values override file.
See https://github.com/linuxforhealth/lfh-helm/blob/main/charts/fhir-server/values-nginx.yaml for an example.
Customizing the FHIR server configuration
This helm chart uses a named template to generate the fhir-server-config.json file which will control the configuration of the deployed FHIR server. The template name is defaultFhirServerConfig and it is defined in the _fhirServerConfigJson.tpl file. It uses many of this helm chart's values as the values of config properties within the generated fhir-server-config.json file.
This design gives the deployer of this helm chart a number of different options to customize the FHIR server configuration:
- Use the
defaultFhirServerConfignamed template that is provided, but override values specified in the template to customize the configuration. Chart values are used to customize config properties in the following sections of the configuration:- core
- resources
- security
- notifications
- audit
- persistence
- bulkdata
- Provide a custom named template. If this helm chart is being deployed from another helm chart:
- In the deploying chart, create a custom fhir server config named template which specifies the exact configuration required.
- Override the
fhirServerConfigTemplatechart value, setting it to the name of the custom named template. This helm chart will then use the specified named template to generate itsfhir-server-config.jsonfile.
- Provide a custom named template as above, but with the config properties within the template set to a mix of chart values provided by this helm chart and hard-coded values specific to the deployer's use case. With this approach, the deploying helm chart can decide how much of the configuration to make customizable to its users. If there are config properties for which values are not provided by this helm chart, but that the deploying helm chart wants to make customizable, it can define global chart values and use those in the provided custom named template. It is important to make the chart values global to allow them to be in scope for this helm chart.
We can demonstrate these approaches with the following sample section from the defaultFhirServerConfig named template in the _fhirServerConfigJson.tpl file:
"core": {
"tenantIdHeaderName": "X-FHIR-TENANT-ID",
"datastoreIdHeaderName": "X-FHIR-DSID",
"originalRequestUriHeaderName": "X-FHIR-FORWARDED-URL",
"serverRegistryResourceProviderEnabled": {{ .Values.serverRegistryResourceProviderEnabled }},
...
},
-
If the deployer just wants to change the
serverRegistryResourceProviderEnabledconfig property, they can use thedefaultFhirServerConfignamed template provided and simply override theserverRegistryResourceProviderEnabledchart value when deploying this helm chart. -
If the deployer does not want this value to be customizable, and always wants the value to be set to
true, they can provide a custom named template where the value has been hard-coded totrue:"core": { "tenantIdHeaderName": "X-FHIR-TENANT-ID", "datastoreIdHeaderName": "X-FHIR-DSID", "originalRequestUriHeaderName": "X-FHIR-FORWARDED-URL", "serverRegistryResourceProviderEnabled": true, ... },When deploying the chart, the deployer must override the
fhirServerConfigTemplatechart value, setting it to the name of their custom named template. This helm chart will then use that template to generate itsfhir-server-config.jsonfile. -
If the deployer wants to continue to allow the
serverRegistryResourceProviderEnabledconfig property to be customizable, but they also want thedefaultPageSizeconfig property to be customizable, they can provide a custom named template where the "core" section takes the value of theserverRegistryResourceProviderEnabledconfig property from this helm chart's values file, and takes the value of thedefaultPageSizeconfig property from their own values file (as a global value):"core": { "tenantIdHeaderName": "X-FHIR-TENANT-ID", "datastoreIdHeaderName": "X-FHIR-DSID", "originalRequestUriHeaderName": "X-FHIR-FORWARDED-URL", "serverRegistryResourceProviderEnabled": {{ .Values.serverRegistryResourceProviderEnabled }}, "defaultPageSize": {{ .Values.global.defaultPageSize }}, ... },As above, when deploying the chart, the deployer must override the
fhirServerConfigTemplatechart value, setting it to the name of their custom named template. This helm chart will then use that template to generate itsfhir-server-config.jsonfile.
For a complete list of configuration properties for the LinuxForHealth FHIR Server, please see the User's Guide.
In addition to providing a default FHIR server configuration named template, this helm chart also provides default named templates for custom search parameters and datasources, both of which can be overridden by custom named templates in the same manner as the FHIR server configuration template.
The deployer can specify a custom search parameters named template which will be used in the generation of the extension-search-parameters.json file by overriding the extensionSearchParametersTemplate chart value.
The deployer can specify custom datasource named templates which will be used in the generation of the datasource.xml and bulkdata.xml files by overriding the datasourcesTemplate chart value.
The default for this chart value is a template with datasources for a single Postgres database.
Using existing Secrets for sensitive data
This helm chart specifies chart values for the following pieces of sensitive data:
- Database user passwords:
db.adminPassworddb.password
- FHIR server user and admin passwords:
fhirUserPasswordfhirAdminPassword
- Object storage configuration information:
objectStorage.locationobjectStorage.endpointUrlobjectStorage.accessKeyobjectStorage.secretKey
These values can be specified directly in the values.yaml file, or the deployer can specify names of existing Secrets from which to read them.
Database password or api key
To have the db.adminPassword and db.password values read from an existing Secret, the deployer must override the following chart values:
db.dbSecret- this is set to the name of the Secret from which the database information will be readdb.adminPasswordKey- this is set to the key of the key/value pair within the Secret that contains the admin user password (for schema management)db.userPasswordKey- this is set to the key of the key/value pair within the Secret that contains the fhir-server's user password
If the db.dbSecret value is set, this helm chart will only look in the specified Secret for the passwords. The db.adminPassword and db.password chart values will be ignored.
FHIR server user and admin passwords
To have the FHIR server user and admin passwords read from an existing Secret, the deployer must override the following chart values:
fhirPasswordSecret- this is set to the name of the Secret from which the FHIR server user and admin passwords will be readfhirUserPasswordSecretKey- this is set to the key of the key/value pair within the Secret that contains the user passwordfhirAdminPasswordSecretKey- this is set to the key of the key/value pair within the Secret that contains the admin password
If the fhirPasswordSecret value is set, this helm chart will only look in the specified Secret for the FHIR server user and admin passwords. The fhirUserPassword and fhirAdminPassword chart values will be ignored.
Object storage configuration information
To have object storage configuration information read from an existing Secret, the deployer must override the following chart values:
objectStorage.objectStorageSecret- this is set to the name of the Secret from which the object storage configuration information will be readobjectStorage.locationSecretKey- this is set to the key of the key/value pair within the Secret that contains the object storage locationobjectStorage.endpointUrlSecretKey- this is set to the key of the key/value pair within the Secret that contains the object storage endpoint URLobjectStorage.accessKeySecretKey- this is set to the key of the key/value pair within the Secret that contains the object storage access keyobjectStorage.secretKeySecretKey- this is set to the key of the key/value pair within the Secret that contains the object storage secret key
If the objectStorage.objectStorageSecret value is set, this helm chart will only look in the specified Secret for the object storage configuration information. The objectStorage.locationSecretKey, objectStorage.endpointUrlSecretKey, objectStorage.accessKeySecretKey, and objectStorage.secretKeySecretKey chart values will be ignored.
Using Secrets for custom keystore and truststore configuration
By default, the FHIR server's server.xml file includes the definition of a keystore (fhirKeyStore.p12) and a truststore (fhirTrustStore.p12) file. These files are provided only as examples and, while they may suffice in a test environment, the deployer should generate new keystore and truststore files for any installations where security is a concern.
Custom keystore and truststore files can be configured in the FHIR server via Secrets. This helm chart specifies the following chart values to allow the deployer to specify the names of Secrets which contain keystore or truststore data, and to specify the format of the keystore or truststore data:
keyStoreSecret- this is set to the name of the Secret from which the keystore information will be readkeyStoreFormat- this is set to the format of the keystore in the keystore Secret - must be eitherPKCS12orJKStrustStoreSecret- this is set to the name of the Secret from which the truststore information will be readtrustStoreFormat- this is set to the format of the truststore in the truststore Secret - must be eitherPKCS12orJKS
The keystore Secret is expected to contain the following data:
| Key | Value |
|---|---|
fhirKeyStore | The contents of the keystore file |
fhirKeyStorePassword | The keystore password |
An example Secret might look like this (note that the fhirKeyStore value containing the base64-encoded contents of the file has been truncated for display purposes):
apiVersion: v1
kind: Secret
metadata:
name: my-custom-keystore-secret
type: Opaque
data:
fhirKeyStore: MIIa0AIBAzCCGpYGCSqGSIb3D...
fhirKeyStorePassword: Y2hhbmdlLXBhc3N3b3Jk
If a keystore Secret is specified, the default keystore file will be replaced with the provided keystore file, named either fhirKeyStore.p12 or fhirKeyStore.jks depending on the value specified in keyStoreFormat, and the default keystore definition in the server.xml file will be updated with the keystore filename and the provided keystore password.
Similarly, the truststore Secret is expected to contain the following data:
| Key | Value |
Deploy fhir-server with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has fhir-server on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartfhir-server is pinned at v0.9.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply