Dockerfile: add postgresql-client and bake db-customization/ SQL scripts into the image at /vnc/db-customization/. config/migrate.sh: detection + migration script with two modes: - pre-upgrade: runs idempotent prosody-13-new-deployment.sql on 13.0.x databases; skips 0.11.6 (unsafe pre-upgrade) and new deployments. - post-upgrade: waits for Prosody table, then runs the appropriate scripts — full 0.11.6->13.0.6 migration (rules-triggers + migration-once + new-deployment) or idempotent drift correction for 13.0.x. Helm chart: two Job templates (db-migration-pre-upgrade.yaml, db-migration-post-upgrade.yaml) gated by dbMigration.enabled (default true). Both reuse the Prosody image and DB credentials from existing values. backoffLimit: 0, hook-delete-policy: hook-succeeded. Also tracks the db-customization SQL files (previously untracked, now referenced by the Dockerfile ADD). Part-of: <http://gitlab.vnc.biz/uxf/vnctalk-prosody/-/merge_requests/3>
42 lines
1.3 KiB
YAML
42 lines
1.3 KiB
YAML
{{- if .Values.dbMigration.enabled }}
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: {{ include "prosody.fullname" . }}-db-pre-upgrade
|
|
labels:
|
|
{{- include "prosody.labels" . | nindent 4 }}
|
|
annotations:
|
|
helm.sh/hook: pre-upgrade
|
|
helm.sh/hook-weight: "-5"
|
|
helm.sh/hook-delete-policy: hook-succeeded
|
|
spec:
|
|
backoffLimit: 0
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "prosody.selectorLabels" . | nindent 8 }}
|
|
spec:
|
|
restartPolicy: Never
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
containers:
|
|
- name: db-migration
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
command: ["/bin/sh", "/vnc/config/migrate.sh", "pre-upgrade"]
|
|
env:
|
|
{{- range $key, $value := $.Values.env }}
|
|
- name: {{ $key }}
|
|
value: {{ $value | quote }}
|
|
{{- end }}
|
|
{{- range $envName, $secretKey := $.Values.secretEnv.keys }}
|
|
- name: {{ $envName }}
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ $.Values.secretEnv.existingSecret | quote }}
|
|
key: {{ $secretKey | quote }}
|
|
{{- end }}
|
|
{{- end }}
|