From 5d3e6d69608f38ad7c2e19039f036230ec2a45c5 Mon Sep 17 00:00:00 2001 From: Alexander Olofsson Date: Tue, 13 Dec 2022 15:43:07 +0100 Subject: [PATCH] peertube: Update to 5.0.0 --- charts/peertube/Chart.yaml | 4 ++-- charts/peertube/templates/_helpers.tpl | 16 ++++++++++++++++ charts/peertube/templates/deployment.yaml | 10 ++++++++++ charts/peertube/templates/secrets.yaml | 11 +++++++++++ charts/peertube/values.yaml | 3 +++ 5 files changed, 42 insertions(+), 2 deletions(-) diff --git a/charts/peertube/Chart.yaml b/charts/peertube/Chart.yaml index 82217c2..ea668ec 100644 --- a/charts/peertube/Chart.yaml +++ b/charts/peertube/Chart.yaml @@ -5,8 +5,8 @@ description: Free software to take back control of your videos icon: https://upload.wikimedia.org/wikipedia/commons/2/2b/Logo_de_PeerTube.svg type: application -version: 0.1.3 -appVersion: 4.3.1 +version: 0.2.0 +appVersion: 5.0.0 maintainers: - name: Alexander Olofsson email: ace@haxalot.com diff --git a/charts/peertube/templates/_helpers.tpl b/charts/peertube/templates/_helpers.tpl index eb926bc..f42ee9b 100644 --- a/charts/peertube/templates/_helpers.tpl +++ b/charts/peertube/templates/_helpers.tpl @@ -72,6 +72,22 @@ Create the name of the service account to use {{- end }} {{- end }} +{{/* +include "peertube.randHex" 2 > result "4e" +*/}} +{{- define "peertube.randHex" -}} + {{- $result := "" -}} + {{- range $i := until . -}} + {{- $base := shuffle "0123456789abcdef" -}} + {{- $i_curr := (randNumeric 1) | int -}} + {{- $i_next := add $i_curr 1 | int -}} + {{- $rand_hex := substr $i_curr $i_next $base -}} + {{- $result = print $result $rand_hex -}} + {{- end -}} + {{- $result -}} +{{- end -}} + + {{/* Replicate the Postgres fullname */}} diff --git a/charts/peertube/templates/deployment.yaml b/charts/peertube/templates/deployment.yaml index dfeddf2..58808b8 100644 --- a/charts/peertube/templates/deployment.yaml +++ b/charts/peertube/templates/deployment.yaml @@ -60,6 +60,16 @@ spec: {{- end }} containers: - name: {{ .Chart.Name }} + command: + - bash + - -c + - | + ( + echo "Running migrations in background..." + find dist/scripts/migrations/ -iname '*.js' | xargs -rn1 node + echo "Background migrations have finished." + ) & + node dist/server securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ include "peertube.imageTag" . }}" diff --git a/charts/peertube/templates/secrets.yaml b/charts/peertube/templates/secrets.yaml index a82279f..fb937c9 100644 --- a/charts/peertube/templates/secrets.yaml +++ b/charts/peertube/templates/secrets.yaml @@ -9,6 +9,17 @@ metadata: labels: {{- include "peertube.labels" . | nindent 4 }} data: +{{- if .Values.config.secret }} + PEERTUBE_SECRET: {{ .Values.config.secret | b64enc }} +{{- else }} +{{- $existing := (lookup "v1" "Secret" .Release.Namespace (include "peertube.fullname" .)).data.PEERTUBE_SECRET }} +{{- if $existing }} + PEERTUBE_SECRET: {{ $existing }} +{{- else }} + PEERTUBE_SECRET: {{ (include "peertube.randHex" 32) | b64enc }} +{{- end }} +{{- end }} + {{- if (and .Values.externalPostgresql.password (not .Values.externalPostgresql.existingSecret)) }} PEERTUBE_DB_PASSWORD: {{ .Values.externalPostgresql.password | b64enc }} {{- end }} diff --git a/charts/peertube/values.yaml b/charts/peertube/values.yaml index 5238b02..676679d 100644 --- a/charts/peertube/values.yaml +++ b/charts/peertube/values.yaml @@ -26,6 +26,9 @@ config: ## use an init-container to create a config folder in your persistent storage. webadminConfig: true + ## Generate with somethingl like `openssl rand -hex 32` - will auto-generate if left blank + #secret: + admin: email: