From 655fb74a0170c254c84731b5b45adfa09a75ede2 Mon Sep 17 00:00:00 2001 From: Brian Walsh Date: Wed, 20 Nov 2024 17:36:10 -0800 Subject: [PATCH] Adds HAPI FHIR service --- helm/gen3/Chart.yaml | 13 +++- helm/hapi-fhir-db-init/.helmignore | 23 +++++++ helm/hapi-fhir-db-init/Chart.yaml | 30 +++++++++ helm/hapi-fhir-db-init/templates/NOTES.txt | 1 + helm/hapi-fhir-db-init/templates/_helpers.tpl | 62 +++++++++++++++++++ helm/hapi-fhir-db-init/templates/db-init.yaml | 6 ++ helm/hapi-fhir-db-init/values.yaml | 31 ++++++++++ .../hapi-fhir-jpaserver-service.conf | 10 +++ 8 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 helm/hapi-fhir-db-init/.helmignore create mode 100644 helm/hapi-fhir-db-init/Chart.yaml create mode 100644 helm/hapi-fhir-db-init/templates/NOTES.txt create mode 100644 helm/hapi-fhir-db-init/templates/_helpers.tpl create mode 100644 helm/hapi-fhir-db-init/templates/db-init.yaml create mode 100644 helm/hapi-fhir-db-init/values.yaml create mode 100644 helm/revproxy/gen3.nginx.conf/hapi-fhir-jpaserver-service.conf diff --git a/helm/gen3/Chart.yaml b/helm/gen3/Chart.yaml index fb5bb52d0..01853e82e 100644 --- a/helm/gen3/Chart.yaml +++ b/helm/gen3/Chart.yaml @@ -104,6 +104,17 @@ dependencies: repository: "https://charts.bitnami.com/bitnami" condition: global.dev +# helm repo add hapifhir https://hapifhir.github.io/hapi-fhir-jpaserver-starter/ +# adds the hapi-fhir-jpaserver chart to the list of charts that can be installed +- name: hapi-fhir-jpaserver + version: 0.17.1 + repository: "https://hapifhir.github.io/hapi-fhir-jpaserver-starter/" + condition: global.dev +- name: hapi-fhir-db-init + version: 0.1.0 + repository: "file://../hapi-fhir-db-init" + condition: global.dev + # A chart can be either an 'application' or a 'library' chart. # # Application charts are a collection of templates that can be packaged into versioned archives @@ -117,7 +128,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.19 +version: 0.1.20 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/helm/hapi-fhir-db-init/.helmignore b/helm/hapi-fhir-db-init/.helmignore new file mode 100644 index 000000000..0e8a0eb36 --- /dev/null +++ b/helm/hapi-fhir-db-init/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm/hapi-fhir-db-init/Chart.yaml b/helm/hapi-fhir-db-init/Chart.yaml new file mode 100644 index 000000000..7c34a8dd1 --- /dev/null +++ b/helm/hapi-fhir-db-init/Chart.yaml @@ -0,0 +1,30 @@ +apiVersion: v2 +name: hapi-fhir-db-init +description: A Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "1.16.0" + + +dependencies: + - name: hapi-fhir-jpaserver + version: 0.17.1 + repository: "https://hapifhir.github.io/hapi-fhir-jpaserver-starter/" diff --git a/helm/hapi-fhir-db-init/templates/NOTES.txt b/helm/hapi-fhir-db-init/templates/NOTES.txt new file mode 100644 index 000000000..f87f5c14c --- /dev/null +++ b/helm/hapi-fhir-db-init/templates/NOTES.txt @@ -0,0 +1 @@ +# TODO \ No newline at end of file diff --git a/helm/hapi-fhir-db-init/templates/_helpers.tpl b/helm/hapi-fhir-db-init/templates/_helpers.tpl new file mode 100644 index 000000000..23f35f3b9 --- /dev/null +++ b/helm/hapi-fhir-db-init/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "hapi-fhir-db-init.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "hapi-fhir-db-init.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- $name := default .Chart.Name .Values.nameOverride }} +{{- if contains $name .Release.Name }} +{{- .Release.Name | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "hapi-fhir-db-init.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "hapi-fhir-db-init.labels" -}} +helm.sh/chart: {{ include "hapi-fhir-db-init.chart" . }} +{{ include "hapi-fhir-db-init.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "hapi-fhir-db-init.selectorLabels" -}} +app.kubernetes.io/name: {{ include "hapi-fhir-db-init.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "hapi-fhir-db-init.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "hapi-fhir-db-init.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/helm/hapi-fhir-db-init/templates/db-init.yaml b/helm/hapi-fhir-db-init/templates/db-init.yaml new file mode 100644 index 000000000..5ef14e87e --- /dev/null +++ b/helm/hapi-fhir-db-init/templates/db-init.yaml @@ -0,0 +1,6 @@ +{{ include "common.db-secret" . }} +--- +{{ include "common.db_setup_job" . }} +--- +{{ include "common.db_setup_sa" . }} +--- \ No newline at end of file diff --git a/helm/hapi-fhir-db-init/values.yaml b/helm/hapi-fhir-db-init/values.yaml new file mode 100644 index 000000000..f5a0867ab --- /dev/null +++ b/helm/hapi-fhir-db-init/values.yaml @@ -0,0 +1,31 @@ +# Global configuration + +# -- (map) Postgres database configuration. If db does not exist in postgres cluster and dbCreate is set ot true then these databases will be created for you +postgres: + # (bool) Whether the database should be restored from s3. Default to global.postgres.dbRestore + dbRestore: false + # -- (bool) Whether the database should be created. Default to global.postgres.dbCreate + dbCreate: + # -- (string) Hostname for postgres server. This is a service override, defaults to global.postgres.host + host: + # -- (string) Database name for postgres. This is a service override, defaults to - + database: + # -- (string) Username for postgres. This is a service override, defaults to - + username: + # -- (string) Port for Postgres. + port: "5432" + # -- (string) Password for Postgres. Will be autogenerated if left empty. + password: + # -- (string) Will create a Database for the individual service to help with developing it. + separate: false + +# -- (map) External Secrets settings. +externalSecrets: + # -- (string) Will override the name of the aws secrets manager secret. Default is "Values.global.environment-.Chart.Name-creds" + dbcreds: +# -- (map) Secret information for External Secrets. +secrets: + # -- (str) AWS access key ID. Overrides global key. + awsAccessKeyId: + # -- (str) AWS secret access key ID. Overrides global key. + awsSecretAccessKey: \ No newline at end of file diff --git a/helm/revproxy/gen3.nginx.conf/hapi-fhir-jpaserver-service.conf b/helm/revproxy/gen3.nginx.conf/hapi-fhir-jpaserver-service.conf new file mode 100644 index 000000000..5a49e40d3 --- /dev/null +++ b/helm/revproxy/gen3.nginx.conf/hapi-fhir-jpaserver-service.conf @@ -0,0 +1,10 @@ +location /fhir/ { + proxy_connect_timeout 600s; + proxy_send_timeout 600s; + proxy_read_timeout 600s; + send_timeout 600s; + +# maintain the /fhir prefix in the proxied request + proxy_pass http://local-hapi-fhir-jpaserver.$namespace.svc.cluster.local:8080; +} +