Skip to content

Commit

Permalink
fix: db backup fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikZed committed May 21, 2024
1 parent 6fe2351 commit 5f96a86
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/strapi/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,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.2.5
version: 0.2.6

# 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
Expand Down
11 changes: 11 additions & 0 deletions charts/strapi/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ Create chart name and version as used by the chart label.
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

# just the internal database host name, used as backup target
{{- define "strapi.internalDatabaseBackupHost" -}}
{{- if eq .Values.postgresql.architecture "replication" }}
{{- printf "%s%s" .Release.Name "-postgresql-primary" }}
{{- else }}
{{- printf "%s%s" .Release.Name "-postgresql" }}
{{- end }}
{{- end }}



{{- define "strapi.internalDatabaseUrl" -}}
{{- if eq .Values.postgresql.architecture "replication" }}
{{- printf "%s%s%s%s%s%s%s%s" "postgresql://" .Values.postgresql.auth.username ":" .Values.postgresql.auth.password "@" .Release.Name "-postgresql-primary:5432/" .Values.postgresql.auth.database }}
Expand Down
2 changes: 1 addition & 1 deletion charts/strapi/templates/postgres_backup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ spec:
key: POSTGRES_DB_USER
name: {{ include "strapi.fullname" . }}
- name: POSTGRES_DB_HOST
value: "{{ $fullName }}-postgresql"
value: {{ include "strapi.internalDatabaseBackupHost" .}}
- name: POSTGRES_DB_PORT
value: "5432"
envFrom:
Expand Down

0 comments on commit 5f96a86

Please sign in to comment.