Skip to content

Commit dd566aa

Browse files
committed
fix: add auto schema creation and Liquibase configuration
- Add init container to automatically create PostgreSQL schema - Add Liquibase environment variables for schema configuration - Fix backend startup issues with PostgreSQL schema This ensures Healenium backend works out-of-the-box without manual database setup.
1 parent 46e6863 commit dd566aa

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

requirements.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dependencies:
2+
- name: postgresql
3+
repository: https://charts.bitnami.com/bitnami
4+
version: 11.6.2
5+
digest: sha256:f2b516da25d0a7992c8e720991f2f788b031f9e72607887fc1a1f3b85ecb7ca4
6+
generated: "2025-10-20T18:08:04.249487+03:00"

templates/hlm-backend-deploy.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ spec:
1515
labels:
1616
component: {{ .Values.hlmbackend.name }}
1717
spec:
18+
initContainers:
19+
- name: create-schema
20+
image: postgres:16-alpine
21+
command:
22+
- sh
23+
- -c
24+
- |
25+
PGPASSWORD={{ .Values.postgresql.endpoint.password }} psql -h {{ .Values.postgresql.endpoint.address }} -U {{ .Values.postgresql.endpoint.user }} -d {{ .Values.postgresql.endpoint.dbName }} -c "CREATE SCHEMA IF NOT EXISTS {{ .Values.postgresql.endpoint.schema }};" || true
1826
containers:
1927
- name: hlm-backend
2028
image: "{{ .Values.hlmbackend.repository }}:{{ .Values.hlmbackend.tag }}"
@@ -32,6 +40,12 @@ spec:
3240
value: {{ .Values.postgresql.endpoint.password }}
3341
- name: SPRING_POSTGRES_DB_HOST
3442
value: {{ .Values.postgresql.endpoint.address }}
43+
- name: SPRING_LIQUIBASE_LIQUIBASESCHEMA
44+
value: {{ .Values.postgresql.endpoint.schema }}
45+
- name: SPRING_LIQUIBASE_DEFAULTSCHEMA
46+
value: {{ .Values.postgresql.endpoint.schema }}
47+
- name: SPRING_JPA_PROPERTIES_HIBERNATE_DEFAULT_SCHEMA
48+
value: {{ .Values.postgresql.endpoint.schema }}
3549
- name: KEY_SELECTOR_URL
3650
value: "{{ .Values.hlmbackend.environment.key_selector_url }}"
3751
- name: COLLECT_METRICS

values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ postgresql:
2626
port: 5432
2727
user: healenium_user
2828
dbName: healenium
29-
schema: healenium
29+
schema: public
3030
password: YDk2nmNs4s9aCP6K
3131

3232
imitator:

0 commit comments

Comments
 (0)