From ee39795d11895b761a536b695bbd163820f575dc Mon Sep 17 00:00:00 2001 From: Tim Campbell Date: Mon, 3 Mar 2025 16:07:19 +0100 Subject: [PATCH] DB prepare job cannot run on install when using included postgres --- templates/job-db-prepare.yaml | 3 +++ templates/secret-prepare.yml | 3 +++ templates/secrets.yaml | 2 ++ values.yaml | 7 ++++++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/templates/job-db-prepare.yaml b/templates/job-db-prepare.yaml index 037b207..5f0b5ab 100644 --- a/templates/job-db-prepare.yaml +++ b/templates/job-db-prepare.yaml @@ -1 +1,4 @@ +# Does not work with included database because of helm install order. +{{- if not .Values.postgresql.enabled }} {{- include "mastodon.dbMigrateJob" (merge (dict "prepare" true ) .) }} +{{- end }} diff --git a/templates/secret-prepare.yml b/templates/secret-prepare.yml index 5b15ee7..8cfac53 100644 --- a/templates/secret-prepare.yml +++ b/templates/secret-prepare.yml @@ -1 +1,4 @@ +# Does not work with included database because of helm install order. +{{- if and (include "mastodon.createSecret" .) (not .Values.postgresql.enabled) -}} {{- include "mastodon.secrets.object" (merge (dict "prepare" true ) .) }} +{{- end }} diff --git a/templates/secrets.yaml b/templates/secrets.yaml index 284dcb1..584177c 100644 --- a/templates/secrets.yaml +++ b/templates/secrets.yaml @@ -1 +1,3 @@ +{{- if (include "mastodon.createSecret" .) -}} {{- include "mastodon.secrets.object" . }} +{{- end }} diff --git a/values.yaml b/values.yaml index 1bf977d..7ad93af 100644 --- a/values.yaml +++ b/values.yaml @@ -24,6 +24,9 @@ mastodon: # @ignored email: not@example.com hooks: + # Whether to perform DB migrations on `helm install|upgrade`. + # Please note that initial DB schema creation on `helm install` does not + # work when using the included database (postgresql.enabled=true). dbMigrate: enabled: true assetsPrecompile: @@ -523,7 +526,9 @@ elasticsearch: # https://github.com/bitnami/charts/tree/master/bitnami/postgresql#parameters postgresql: # -- disable if you want to use an existing db; in which case the values below - # must match those of that external postgres instance + # must match those of that external postgres instance. + # Please note that certain features do not work when enabling the included + # database, namely automatic schema creation when the app is first installed. enabled: true # postgresqlHostname: preexisting-postgresql # postgresqlPort: 5432