Skip to content

Commit baa23ad

Browse files
authored
Merge pull request #202 from opencrvs/ocrvs-10450
feat(ocrvs-10450): postgres migration changes for mongo fdw
2 parents edd8604 + e79fee6 commit baa23ad

File tree

10 files changed

+29
-10
lines changed

10 files changed

+29
-10
lines changed

charts/dependencies/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: opencrvs-dependencies-chart
33
description: Dependencies required by OpenCRVS
44
type: application
5-
version: 0.2.4
5+
version: 0.2.5
66
appVersion: 1.9.0

charts/dependencies/templates/postgres-backup-cronjob.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
restartPolicy: OnFailure
2727
containers:
2828
- name: backup
29-
image: postgres:17
29+
image: docker.io/chumaky/postgres_mongo_fdw:17.6_fdw5.5.2
3030
env:
3131
- name: POSTGRES_HOST
3232
value: postgres-0.postgres.{{ .Release.Namespace }}.svc.cluster.local

charts/dependencies/templates/postgres-restore-cronjob.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
restartPolicy: OnFailure
2727
containers:
2828
- name: restore
29-
image: postgres:17
29+
image: docker.io/chumaky/postgres_mongo_fdw:17.6_fdw5.5.2
3030
env:
3131
- name: POSTGRES_HOST
3232
value: postgres-0.postgres.{{ .Release.Namespace }}.svc.cluster.local

charts/dependencies/templates/postgres.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ spec:
6464
{{- end }}
6565
{{- end }}
6666
containers:
67-
- image: postgres:17
67+
- image: docker.io/chumaky/postgres_mongo_fdw:17.6_fdw5.5.2
6868
name: postgres
6969
env:
7070
{{- if .Values.postgres.use_default_credentials }}

charts/opencrvs-services/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: opencrvs-services
33
description: OpenCRVS Services
44
type: application
5-
version: 0.1.19
6-
appVersion: 1.9.0
5+
version: 0.1.20
6+
appVersion: 1.9.0

charts/opencrvs-services/templates/data-cleanup-job.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ spec:
5050
{{- end }}
5151
{{- include "render-env-vars" (dict "service_name" "data_cleanup" "Values" .Values) }}
5252
- name: cleanup-postgres
53-
image: postgres:17
53+
image: docker.io/chumaky/postgres_mongo_fdw:17.6_fdw5.5.2
5454
command: ["/bin/bash", "-c"]
5555
args:
5656
- |

charts/opencrvs-services/templates/data-migration-job.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,21 @@ spec:
103103
secretKeyRef:
104104
key: events_migrator_db_url
105105
name: {{ .Values.postgres.urls_secret }}
106+
- name: EVENTS_SUPERUSER_POSTGRES_URL
107+
valueFrom:
108+
secretKeyRef:
109+
key: events_superuser_db_url
110+
name: {{ .Values.postgres.urls_secret }}
106111
- name: EVENTS_DB_USER
107112
valueFrom:
108113
secretKeyRef:
109114
key: EVENTS_APP_POSTGRES_USER
110115
name: {{ .Values.postgres.users_secret }}
116+
- name: EVENTS_MIGRATION_USER
117+
valueFrom:
118+
secretKeyRef:
119+
key: EVENTS_MIGRATOR_POSTGRES_USER
120+
name: {{ .Values.postgres.users_secret }}
111121
{{- end }}
112122

113123
{{- if or (eq .Values.minio.auth_mode "auto") (eq .Values.minio.auth_mode "use_secret") }}
@@ -125,4 +135,4 @@ spec:
125135
- name: WAIT_HOSTS
126136
value: "{{ .Values.mongodb.host }}:27017,{{ .Values.influxdb.host }}:{{ .Values.influxdb.port }},{{ .Values.minio.host }}:{{ .Values.minio.port }},{{ .Values.elasticsearch.host }}:{{ .Values.elasticsearch.port }}"
127137
{{- include "render-env-vars" (dict "service_name" "data_migration" "Values" .Values) }}
128-
restartPolicy: "OnFailure"
138+
restartPolicy: "OnFailure"

charts/opencrvs-services/templates/postgres-on-update-analytics-job.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ spec:
1818
- name: postgres-on-update-analytics
1919
command: ["bash", "-c", "/scripts/setup-analytics.sh"]
2020
# command: ["bash", "-c", "/scripts/on-deploy.sh;"]
21-
image: "postgres:17"
21+
image: docker.io/chumaky/postgres_mongo_fdw:17.6_fdw5.5.2
2222
env:
2323
- name: POSTGRES_HOST
2424
value: {{ .Values.postgres.host }}

charts/opencrvs-services/templates/postgres-on-update-core-job.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
containers:
1818
- name: postgres-on-update-core
1919
command: ["bash", "-c", "/scripts/on-deploy.sh"]
20-
image: "postgres:17"
20+
image: docker.io/chumaky/postgres_mongo_fdw:17.6_fdw5.5.2
2121
env:
2222
- name: POSTGRES_HOST
2323
value: {{ .Values.postgres.host }}

charts/opencrvs-services/templates/postgres-secrets.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
{{- $passwords := dict }}
55
{{- $postgres_db_urls := dict }}
66

7+
{{- $POSTGRES_USER := "postgres" }}
8+
{{- $POSTGRES_PASSWORD := "postgres" }}
9+
10+
{{- $postgres_admin_secret := lookup "v1" "Secret" .Release.Namespace .Values.postgres.admin_user_secret_name }}
11+
{{- if $postgres_admin_secret }}
12+
{{- $POSTGRES_USER = (index $postgres_admin_secret.data "POSTGRES_USER" | b64dec) }}
13+
{{- $POSTGRES_PASSWORD = (index $postgres_admin_secret.data "POSTGRES_PASSWORD" | b64dec) }}
14+
{{- end }}
715

816
{{- $EVENTS_APP_POSTGRES_PASSWORD := randAlphaNum 32 }}
917
{{- $EVENTS_MIGRATOR_POSTGRES_PASSWORD := randAlphaNum 32 }}
@@ -25,6 +33,7 @@
2533
{{- $EVENTS_DB := $.Values.postgres.events_db | replace "-" "_" }}
2634
{{- $_ := set $postgres_db_urls "events_app_db_url" (printf "postgres://%s:%s@%s:5432/%s" $EVENTS_APP_POSTGRES_USER $EVENTS_APP_POSTGRES_PASSWORD $.Values.postgres.host $EVENTS_DB) }}
2735
{{- $_ := set $postgres_db_urls "events_migrator_db_url" (printf "postgres://%s:%s@%s:5432/%s" $EVENTS_MIGRATOR_POSTGRES_USER $EVENTS_MIGRATOR_POSTGRES_PASSWORD $.Values.postgres.host $EVENTS_DB) }}
36+
{{- $_ := set $postgres_db_urls "events_superuser_db_url" (printf "postgres://%s:%s@%s:5432/%s" $POSTGRES_USER $POSTGRES_PASSWORD $.Values.postgres.host $EVENTS_DB) }}
2837
{{- $_ := set $postgres_db_urls "events_analytics_db_url" (printf "postgres://%s:%s@%s:5432/%s" $EVENTS_ANALYTICS_POSTGRES_USER $EVENTS_ANALYTICS_POSTGRES_PASSWORD $.Values.postgres.host $EVENTS_DB) }}
2938

3039
{{/*

0 commit comments

Comments
 (0)