FHIR Server on Rancher Desktop - LinuxForHealth/FHIR GitHub Wiki

Rancher Desktop

Instead of using Docker you can use Rancher Desktop for locally deploying the LinuxForHealth FHIR Server image. This was tested with the 1.0.1 version of Rancher Desktop. The following information is based on having completed the wiki guide Setting up for development, and you have a successful local maven build of the LinuxForHealth FHIR Server.

Using nerdctl run

After the installation of Rancher Desktop and supporting utility nerdctl you can create the LinuxForHealth FHIR Server image using nerdctl. In a terminal session:

nerdctl build <local-base-directory>/git/FHIR/fhir-install -t linuxforhealth/fhir-server:test

You can then use nerdctl to run the image with a bootstrapped derby DB.

nerdctl run -d --name fhirserver -p 9443:9443 -e BOOTSTRAP_DB=true -e FHIR_TRANSACTION_MANAGER_TIMEOUT=120s linuxforhealth/fhir-server-:test

This will get the image running with a created Derby db. you can access this FHIR Server locally at this URL https://localhost:9443/fhir-server/api/v4/metadata.

Using kubernetes

You can also use the kubernetes part of Rancher Desktop and helm to deploy an image of the FHIR Server using a postgresql database for persistence. So instead of creating the image in the default namespace you need to build the image into the image namespace for the local cluster.

nerdctl -n k8s.io build <local-base-directory>/git/FHIR/fhir-install -t linuxforhealth/fhir-server:test

You will also need the image for the FHIR Server schema tool. To build that image create a local script schema.sh like the following:

#!/usr/bin/env bash

# set some work variables
WORKSPACE=<local-base-directory>/git/FHIR
BUILD_ID=main

cd ${WORKSPACE}/fhir-install/src/main/docker/fhir-schematool/

# Copy the files over
mkdir -p target/
cp ${WORKSPACE}/fhir-persistence-schema/target/fhir-persistence-schema-*cli.jar target/
cp ${WORKSPACE}/LICENSE target/
# build image into proper name space
nerdctl -n k8s.io build --build-arg FHIR_VERSION=${BUILD_ID} -t linuxforhealth/fhir-schematool:latest .

# EOF

Then run schema.sh script to create the fhir-schematool image into the proper namespace for the local cluster.

Then create a local values-file.yaml file that looks like this:

image:
  repository: linuxforhealth/fhir-server
  tag: test
replicaCount: 1
schemaMigration:
  enabled: true
  image:
    repository: linuxforhealth/fhir-schematool
    tag: latest
    pullPolicy: Never
postgresql:
  postgresqlPassword: <your-password-here>

After you have created the fhir-server and fhir-schematool images in the correct namespace for the local Rancher Desktop kubernetes cluster you can use our helm charts to deploy the FHIR Server locally.

Issue this helm command to use the LinuxForHealth FHIR Server helm charts: helm repo add alvearie https://alvearie.io/alvearie-helm

Run following command to make sure the added repo is up to date: helm repo update

Then using the above created values-file.yaml you can issue this command to use helm to deploy to the local kubernetes cluster:

helm upgrade --install testserver alvearie/ibm-fhir-server -f values-file.yaml --render-subchart-notes --set fhirAdminPassword=$(openssl rand -hex 20)

After the helm upgrade is successful, you should be able to view your local cluster up and running

> kubectl get all                    
NAME                                              READY   STATUS    RESTARTS   AGE
pod/testserver-postgresql-0                       1/1     Running   0          67m
pod/testserver-ibm-fhir-server-6fc75d5c74-tlk2b   1/1     Running   0          67m

NAME                                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/kubernetes                       ClusterIP   10.43.0.1       <none>        443/TCP    46h
service/testserver-postgresql-headless   ClusterIP   None            <none>        5432/TCP   67m
service/testserver-postgresql            ClusterIP   10.43.196.161   <none>        5432/TCP   67m
service/testserver-ibm-fhir-server       ClusterIP   10.43.35.170    <none>        9443/TCP   67m

NAME                                         READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/testserver-ibm-fhir-server   1/1     1            1           67m

NAME                                                    DESIRED   CURRENT   READY   AGE
replicaset.apps/testserver-ibm-fhir-server-6fc75d5c74   1         1         1       67m

NAME                                     READY   AGE
statefulset.apps/testserver-postgresql   1/1     67m

To run against your local FHIR Server you can do a port forward to access the server:

kubectl port-forward service/testserver-ibm-fhir-server 9443:9443 -n default
⚠️ **GitHub.com Fallback** ⚠️