Skip to content

Commit

Permalink
add preupgradetasks
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k committed Dec 18, 2023
1 parent 131666e commit 7c5a2df
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions library/common/templates/app_functions/_postgres.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ backupChownMode (optional): Whether to chown the backup directory or
{{- $backupPath := .backupPath | default "/postgres_backup" -}}
{{- $backupChownMode := .backupChownMode | default "check" -}}
{{- $ixChartContext := .ixChartContext -}}
{{- $preUpgradeTasks := .preUpgradeTasks | default list -}}
{{- $resources := (required "Postgres - Resources are required" .resources) }}

{{ $name }}:
Expand Down Expand Up @@ -127,6 +128,9 @@ postgresbackup:
echo "Creating backup of ${POSTGRES_DB} database"
pg_dump --dbname=${POSTGRES_URL} --file {{ $backupPath }}/${POSTGRES_DB}_$(date +%Y-%m-%d_%H-%M-%S).sql || echo "Failed to create backup"
echo "Backup finished"
{{- range $task := $preUpgradeTasks }}
{{ $task }}
{{- end }}
initContainers:
{{- include "ix.v1.common.app.permissions"
(dict
Expand Down
4 changes: 2 additions & 2 deletions library/ix-dev/community/immich/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ description: Immich is a self-hosted photo and video backup solution directly fr
annotations:
title: Immich
type: application
version: 2.1.0
version: 3.0.0
apiVersion: v2
appVersion: 1.90.2
appVersion: 1.91.3
kubeVersion: '>=1.16.0-0'
maintainers:
- name: truenas
Expand Down
Binary file modified library/ix-dev/community/immich/charts/common-1.2.5.tgz
Binary file not shown.
7 changes: 6 additions & 1 deletion library/ix-dev/community/immich/templates/_postgres.tpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
{{- define "postgres.workload" -}}
{{- $psql := "PGPASSWORD=${POSTGRES_PASSWORD} psql --host=${POSTGRES_HOST} --dbname=${POSTGRES_DB} --username=${POSTGRES_USER}" -}}
{{- $tasks := (list
(printf "%s -c \"ALTER DATABASE ${POSTGRES_DB} REFRESH COLLATION VERSION;\"" $psql)
) }}

workload:
{{- include "ix.v1.common.app.postgres" (dict "secretName" "postgres-creds"
"resources" .Values.resources
"imageSelector" "pgvectorImage"
"preUpgradeTasks" $tasks
"ixChartContext" .Values.ixChartContext) | nindent 2 }}

{{- end -}}

0 comments on commit 7c5a2df

Please sign in to comment.