mirror of
https://github.com/truenas/charts.git
synced 2026-04-14 02:30:53 +08:00
invidious - fix init config (#2121)
* invidious - fix init config * handle upgrade
This commit is contained in:
@@ -3,7 +3,7 @@ description: Invidious is an alternative front-end to YouTube
|
||||
annotations:
|
||||
title: Invidious
|
||||
type: application
|
||||
version: 1.0.2
|
||||
version: 1.0.3
|
||||
apiVersion: v2
|
||||
appVersion: latest
|
||||
kubeVersion: '>=1.16.0-0'
|
||||
|
||||
@@ -36,27 +36,36 @@ secret:
|
||||
PGHOST: {{ $dbHost }}
|
||||
PGPORT: "5432"
|
||||
|
||||
{{/* Do not quote: bools, numbers, json */}}
|
||||
{{- $configOpts := list
|
||||
(dict "path" "check_tables" "value" "true")
|
||||
(dict "path" "database_url" "value" ($dbURL | quote))
|
||||
(dict "path" "database.user" "value" ($dbUser | quote))
|
||||
(dict "path" "database.password" "value" ($dbPass | quote))
|
||||
(dict "path" "database.dbname" "value" ($dbName | quote))
|
||||
(dict "path" "database.host" "value" ($dbHost | quote))
|
||||
(dict "path" "database.port" "value" "5432")
|
||||
(dict "path" "hmac_key" "value" ($hmacKey | quote))
|
||||
(dict "path" "host_binding" "value" ("0.0.0.0" | quote))
|
||||
(dict "path" "port" "value" .Values.invidiousNetwork.webPort)
|
||||
(dict "path" "admins" "value" (.Values.invidiousConfig.admins | toJson))
|
||||
(dict "path" "registration_enabled" "value" .Values.invidiousConfig.registrationEnabled)
|
||||
(dict "path" "login_enabled" "value" .Values.invidiousConfig.loginEnabled)
|
||||
(dict "path" "captcha_enabled" "value" .Values.invidiousConfig.captchaEnabled)
|
||||
}}
|
||||
|
||||
invidious-creds:
|
||||
enabled: true
|
||||
data:
|
||||
# Source config
|
||||
INVIDIOUS_CONFIG_FILE: /config/config.yaml
|
||||
# See https://github.com/iv-org/invidious/pull/1702
|
||||
# Override config
|
||||
INVIDIOUS_HMAC_KEY: {{ $hmacKey }}
|
||||
INVIDIOUS_CHECK_TABLES: "true"
|
||||
INVIDIOUS_DATABASE_URL: {{ $dbURL }}
|
||||
INVIDIOUS_DB_USER: {{ $dbUser }}
|
||||
INVIDIOUS_DB_PASSWORD: {{ $dbPass }}
|
||||
INVIDIOUS_DB_DBNAME: {{ $dbName }}
|
||||
INVIDIOUS_DB_HOST: {{ $dbHost }}
|
||||
INVIDIOUS_DB_PORT: "5432"
|
||||
INVIDIOUS_HOST_BINDING: "0.0.0.0"
|
||||
INVIDIOUS_PORT: {{ .Values.invidiousNetwork.webPort | quote }}
|
||||
# Add some easy to use values in UI
|
||||
INVIDIOUS_ADMINS: {{ .Values.invidiousConfig.admins | toJson | quote }}
|
||||
INVIDIOUS_REGISTRATION_ENABLED: {{ .Values.invidiousConfig.registrationEnabled | quote }}
|
||||
INVIDIOUS_LOGIN_ENABLED: {{ .Values.invidiousConfig.loginEnabled | quote }}
|
||||
INVIDIOUS_CAPTCHA_ENABLED: {{ .Values.invidiousConfig.captchaEnabled | quote }}
|
||||
config.sh: |
|
||||
#!/bin/sh
|
||||
config="/config/config.yaml"
|
||||
echo "Updating Invidious Config..."
|
||||
{{- range $item := $configOpts }}
|
||||
echo "Updating {{ $item.path }} to {{ $item.value }}"
|
||||
yq -i '.{{ $item.path }} = {{ $item.value }}' "$config"
|
||||
{{- end }}
|
||||
cat "$config"
|
||||
echo "Config already exists, skipping."
|
||||
{{- end -}}
|
||||
|
||||
@@ -14,9 +14,8 @@ workload:
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: invidious-creds
|
||||
env:
|
||||
INVIDIOUS_CONFIG_FILE: /config/config.yaml
|
||||
{{ with .Values.invidiousConfig.additionalEnvs }}
|
||||
envList:
|
||||
{{ range $env := . }}
|
||||
@@ -100,9 +99,6 @@ workload:
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: postgres-creds
|
||||
command:
|
||||
- /bin/sh
|
||||
- -c
|
||||
@@ -114,4 +110,13 @@ workload:
|
||||
exit 0
|
||||
fi
|
||||
echo "Config already exists, skipping."
|
||||
05-update-config:
|
||||
enabled: true
|
||||
type: init
|
||||
imageSelector: yqImage
|
||||
securityContext:
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
readOnlyRootFilesystem: false
|
||||
command: /setup/config.sh
|
||||
{{- end -}}
|
||||
|
||||
@@ -9,6 +9,8 @@ persistence:
|
||||
mountPath: /config
|
||||
04-init-config:
|
||||
mountPath: /config
|
||||
05-update-config:
|
||||
mountPath: /config
|
||||
{{- if and (eq .Values.invidiousStorage.config.type "ixVolume")
|
||||
(not (.Values.invidiousStorage.config.ixVolumeConfig | default dict).aclEnable) }}
|
||||
01-permissions:
|
||||
@@ -30,6 +32,16 @@ persistence:
|
||||
invidious:
|
||||
invidious:
|
||||
mountPath: /tmp
|
||||
config-script:
|
||||
enabled: true
|
||||
type: secret
|
||||
objectName: invidious-creds
|
||||
defaultMode: "0550"
|
||||
targetSelector:
|
||||
invidious:
|
||||
05-update-config:
|
||||
mountPath: /setup/config.sh
|
||||
subPath: config.sh
|
||||
|
||||
{{- range $idx, $storage := .Values.invidiousStorage.additionalStorages }}
|
||||
{{ printf "invidious-%v:" (int $idx) }}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
{{- include "ix.v1.common.loader.init" . -}}
|
||||
|
||||
{{- if not .Values.yqImage -}}
|
||||
{{- $_ := set .Values "yqImage" (dict
|
||||
"repository" "mikefarah/yq"
|
||||
"tag" "4.40.5"
|
||||
"pullPolicy" "IfNotPresent"
|
||||
) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Merge the templates with Values */}}
|
||||
{{- $_ := mustMergeOverwrite .Values (include "invidious.configuration" $ | fromYaml) -}}
|
||||
{{- $_ := mustMergeOverwrite .Values (include "invidious.service" $ | fromYaml) -}}
|
||||
|
||||
@@ -6,6 +6,10 @@ gitImage:
|
||||
repository: bitnami/git
|
||||
pullPolicy: IfNotPresent
|
||||
tag: latest
|
||||
yqImage:
|
||||
pullPolicy: IfNotPresent
|
||||
repository: mikefarah/yq
|
||||
tag: 4.40.5
|
||||
|
||||
resources:
|
||||
limits:
|
||||
@@ -56,6 +60,6 @@ notes:
|
||||
{{- $_ := unset .Values "invidiousDbHost" }}
|
||||
|
||||
Additional configuration can be specified
|
||||
by editing the file `/config/config.yaml` (see [example](https://github.com/iv-org/invidious/blob/master/config/config.example.yml))
|
||||
|
||||
- Via [environment variables](https://github.com/iv-org/invidious/pull/1702)
|
||||
- By editing the file `/config/config.yaml` (see [example](https://github.com/iv-org/invidious/blob/master/config/config.example.yml))
|
||||
Note that some configuration options are updated automatically by the chart on each start.
|
||||
|
||||
Reference in New Issue
Block a user