diff --git a/community/invidious/1.0.0/Chart.lock b/community/invidious/1.0.0/Chart.lock new file mode 100644 index 0000000000..a29541fb4c --- /dev/null +++ b/community/invidious/1.0.0/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.2.7 +digest: sha256:d69abe6772f86bc5c22cd95bf4505685ca88a1f5f99d78e2cf58cb66bb945e07 +generated: "2024-01-10T16:53:36.659684978+02:00" diff --git a/community/invidious/1.0.0/Chart.yaml b/community/invidious/1.0.0/Chart.yaml new file mode 100644 index 0000000000..c128385cb1 --- /dev/null +++ b/community/invidious/1.0.0/Chart.yaml @@ -0,0 +1,25 @@ +name: invidious +description: Invidious is an alternative front-end to YouTube +annotations: + title: Invidious +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: latest +kubeVersion: '>=1.16.0-0' +maintainers: + - name: truenas + url: https://www.truenas.com/ + email: dev@ixsystems.com +dependencies: + - name: common + repository: file://../../../common + version: 1.2.7 +home: https://invidious.io/ +icon: https://media.sys.truenas.net/apps/invidious/icons/icon.svg +sources: + - https://invidious.io/ + - https://github.com/truenas/charts/tree/master/community/invidious + - https://quay.io/repository/invidious +keywords: + - youtube diff --git a/community/invidious/1.0.0/README.md b/community/invidious/1.0.0/README.md new file mode 100644 index 0000000000..f01f004794 --- /dev/null +++ b/community/invidious/1.0.0/README.md @@ -0,0 +1,16 @@ +# Invidious + +[Invidious](https://invidious.io/) is an alternative front-end to YouTube. + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `postgres` directories. +> Afterward, the `postgres` container will run as a **non**-root user (`999`). +> On each upgrade, a container will be launched with **root** privileges in order to apply the correct +> permissions to the `postgres` **backups** directory. Container that performs the backup will run as a **non**-root user (`999`) afterwards. +> Keep in mind the permissions on the backup directory will be changed to `999:999` on **every** update. +> But will only be changed once for the `postgres` data directories. + +Additional configuration can be specified + +- 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)) diff --git a/community/invidious/1.0.0/app-readme.md b/community/invidious/1.0.0/app-readme.md new file mode 100644 index 0000000000..f01f004794 --- /dev/null +++ b/community/invidious/1.0.0/app-readme.md @@ -0,0 +1,16 @@ +# Invidious + +[Invidious](https://invidious.io/) is an alternative front-end to YouTube. + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `postgres` directories. +> Afterward, the `postgres` container will run as a **non**-root user (`999`). +> On each upgrade, a container will be launched with **root** privileges in order to apply the correct +> permissions to the `postgres` **backups** directory. Container that performs the backup will run as a **non**-root user (`999`) afterwards. +> Keep in mind the permissions on the backup directory will be changed to `999:999` on **every** update. +> But will only be changed once for the `postgres` data directories. + +Additional configuration can be specified + +- 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)) diff --git a/community/invidious/1.0.0/charts/common-1.2.7.tgz b/community/invidious/1.0.0/charts/common-1.2.7.tgz new file mode 100644 index 0000000000..b3b92ec645 Binary files /dev/null and b/community/invidious/1.0.0/charts/common-1.2.7.tgz differ diff --git a/community/invidious/1.0.0/ci/basic-values.yaml b/community/invidious/1.0.0/ci/basic-values.yaml new file mode 100644 index 0000000000..f982af71eb --- /dev/null +++ b/community/invidious/1.0.0/ci/basic-values.yaml @@ -0,0 +1,18 @@ +invidiousNetwork: + webPort: 31000 + +invidiousConfig: + admins: + - admin1 + - admin2 + +invidiousStorage: + config: + type: pvc + pgData: + type: pvc + pgBackup: + type: emptyDir + emptyDirConfig: + medium: "" + size: "" diff --git a/community/invidious/1.0.0/ix_values.yaml b/community/invidious/1.0.0/ix_values.yaml new file mode 100644 index 0000000000..6fcb2a7021 --- /dev/null +++ b/community/invidious/1.0.0/ix_values.yaml @@ -0,0 +1,61 @@ +image: + repository: quay.io/invidious/invidious + pullPolicy: IfNotPresent + tag: latest +gitImage: + repository: bitnami/git + pullPolicy: IfNotPresent + tag: latest + +resources: + limits: + cpu: 4000m + memory: 8Gi + +invidiousConfig: + admins: [] + registrationEnabled: true + loginEnabled: true + captchaEnabled: true + additionalEnvs: [] + +invidiousNetwork: + webPort: 31008 + +invidiousStorage: + config: + type: ixVolume + ixVolumeConfig: + datasetName: config + pgData: + type: ixVolume + ixVolumeConfig: + datasetName: pgData + pgBackup: + type: ixVolume + ixVolumeConfig: + datasetName: pgBackup + additionalStorages: [] + +notes: + custom: | + ## Database + You can connect to the database using the pgAdmin App from the catalog + +
+ Database Details + + - Database: `invidious` + - Username: `kemal` + - Password: `{{ .Values.invidiousDbPass }}` + - Host: `{{ .Values.invidiousDbHost }}.{{ .Release.Namespace }}.svc.cluster.local` + - Port: `5432` + +
+ {{- $_ := unset .Values "invidiousDbPass" }} + {{- $_ := unset .Values "invidiousDbHost" }} + + Additional configuration can be specified + + - 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)) diff --git a/community/invidious/1.0.0/metadata.yaml b/community/invidious/1.0.0/metadata.yaml new file mode 100644 index 0000000000..fa204fea32 --- /dev/null +++ b/community/invidious/1.0.0/metadata.yaml @@ -0,0 +1,13 @@ +runAsContext: + - userName: invidious + groupName: invidious + gid: 1000 + uid: 1000 + description: Invidious runs as non-root user + - userName: postgres + groupName: postgres + gid: 999 + uid: 999 + description: Postgres runs as a non-root user. +capabilities: [] +hostMounts: [] diff --git a/community/invidious/1.0.0/questions.yaml b/community/invidious/1.0.0/questions.yaml new file mode 100644 index 0000000000..18c3de9bf6 --- /dev/null +++ b/community/invidious/1.0.0/questions.yaml @@ -0,0 +1,540 @@ +groups: + - name: Invidious Configuration + description: Configure Invidious + - name: Network Configuration + description: Configure Network for Invidious + - name: Storage Configuration + description: Configure Storage for Invidious + - name: Resources Configuration + description: Configure Resources for Invidious + +portals: + web_portal: + protocols: + - "$kubernetes-resource_configmap_portal_protocol" + host: + - "$kubernetes-resource_configmap_portal_host" + ports: + - "$kubernetes-resource_configmap_portal_port" + path: "$kubernetes-resource_configmap_portal_path" + +questions: + + - variable: invidiousConfig + label: "" + group: Invidious Configuration + schema: + type: dict + attrs: + - variable: admins + label: Admins + description: List of usernames that will be granted administrator rights. + schema: + type: list + default: [] + items: + - variable: admin + label: Admin + schema: + type: string + required: true + - variable: registrationEnabled + label: Registration Enabled + description: Enable registration for Invidious. + schema: + type: boolean + default: true + - variable: loginEnabled + label: Login Enabled + description: Enable login for Invidious. + schema: + type: boolean + default: true + - variable: captchaEnabled + label: Captcha Enabled + description: Enable captcha for Invidious. + schema: + type: boolean + default: true + + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for Invidious. + schema: + type: list + default: [] + items: + - variable: env + label: Environment Variable + schema: + type: dict + attrs: + - variable: name + label: Name + schema: + type: string + required: true + - variable: value + label: Value + schema: + type: string + required: true + + - variable: invidiousNetwork + label: "" + group: Network Configuration + schema: + type: dict + attrs: + - variable: webPort + label: Web Port + description: The port for the Invidious WebUI. + schema: + type: int + default: 31008 + min: 9000 + max: 65535 + required: true + + - variable: invidiousStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: config + label: Invidious Config Storage + description: The path to store Invidious Configuration. + schema: + type: dict + attrs: + - variable: type + label: Type + description: | + ixVolume: Is dataset created automatically by the system.
+ Host Path: Is a path that already exists on the system. + schema: + type: string + required: true + immutable: true + default: "ixVolume" + enum: + - value: "hostPath" + description: Host Path (Path that already exists on the system) + - value: "ixVolume" + description: ixVolume (Dataset created automatically by the system) + - variable: ixVolumeConfig + label: ixVolume Configuration + description: The configuration for the ixVolume dataset. + schema: + type: dict + show_if: [["type", "=", "ixVolume"]] + $ref: + - "normalize/ixVolume" + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + default: false + - variable: datasetName + label: Dataset Name + description: The name of the dataset to use for storage. + schema: + type: string + required: true + immutable: true + hidden: true + default: "config" + - variable: aclEntries + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + - variable: hostPathConfig + label: Host Path Configuration + schema: + type: dict + show_if: [["type", "=", "hostPath"]] + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + default: false + - variable: acl + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + $ref: + - "normalize/acl" + - variable: hostPath + label: Host Path + description: The host path to use for storage. + schema: + type: hostpath + show_if: [["aclEnable", "=", false]] + required: true + - variable: pgData + label: Invidious Postgres Data Storage + description: The path to store Invidious Postgres Data. + schema: + type: dict + attrs: + - variable: type + label: Type + description: | + ixVolume: Is dataset created automatically by the system.
+ Host Path: Is a path that already exists on the system. + schema: + type: string + required: true + immutable: true + default: ixVolume + enum: + - value: hostPath + description: Host Path (Path that already exists on the system) + - value: ixVolume + description: ixVolume (Dataset created automatically by the system) + - variable: ixVolumeConfig + label: ixVolume Configuration + description: The configuration for the ixVolume dataset. + schema: + type: dict + # Nothing to show for the user + hidden: true + show_if: [["type", "=", "ixVolume"]] + $ref: + - "normalize/ixVolume" + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + # Postgres does a CHMOD at startup + # Which fails with ACL + hidden: true + default: false + - variable: datasetName + label: Dataset Name + description: The name of the dataset to use for storage. + schema: + type: string + required: true + immutable: true + hidden: true + default: "pgData" + - variable: aclEntries + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + - variable: hostPathConfig + label: Host Path Configuration + schema: + type: dict + show_if: [["type", "=", "hostPath"]] + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + # Postgres does a CHMOD at startup + # Which fails with ACL + hidden: true + default: false + - variable: acl + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + $ref: + - "normalize/acl" + - variable: hostPath + label: Host Path + description: The host path to use for storage. + schema: + type: hostpath + show_if: [["aclEnable", "=", false]] + required: true + + - variable: pgBackup + label: Invidious Postgres Backup Storage + description: The path to store Invidious Postgres Backup. + schema: + type: dict + attrs: + - variable: type + label: Type + description: | + ixVolume: Is dataset created automatically by the system.
+ Host Path: Is a path that already exists on the system. + schema: + type: string + required: true + immutable: true + default: ixVolume + enum: + - value: hostPath + description: Host Path (Path that already exists on the system) + - value: ixVolume + description: ixVolume (Dataset created automatically by the system) + - variable: ixVolumeConfig + label: ixVolume Configuration + description: The configuration for the ixVolume dataset. + schema: + type: dict + # Nothing to show for the user + hidden: true + show_if: [["type", "=", "ixVolume"]] + $ref: + - "normalize/ixVolume" + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + # Postgres does a CHMOD at startup + # Which fails with ACL + hidden: true + default: false + - variable: datasetName + label: Dataset Name + description: The name of the dataset to use for storage. + schema: + type: string + required: true + immutable: true + hidden: true + default: "pgBackup" + - variable: aclEntries + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + - variable: hostPathConfig + label: Host Path Configuration + schema: + type: dict + show_if: [["type", "=", "hostPath"]] + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + # Postgres does a CHMOD at startup + # Which fails with ACL + hidden: true + default: false + - variable: acl + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + $ref: + - "normalize/acl" + - variable: hostPath + label: Host Path + description: The host path to use for storage. + schema: + type: hostpath + show_if: [["aclEnable", "=", false]] + required: true + + - variable: additionalStorages + label: Additional Storage + description: Additional storage for Invidious. + schema: + type: list + default: [] + items: + - variable: storageEntry + label: Storage Entry + schema: + type: dict + attrs: + - variable: type + label: Type + description: | + ixVolume: Is dataset created automatically by the system.
+ Host Path: Is a path that already exists on the system.
+ SMB Share: Is a SMB share that is mounted to a persistent volume claim. + schema: + type: string + required: true + default: "ixVolume" + immutable: true + enum: + - value: "hostPath" + description: Host Path (Path that already exists on the system) + - value: "ixVolume" + description: ixVolume (Dataset created automatically by the system) + - value: "smb-pv-pvc" + description: SMB Share (Mounts a persistent volume claim to a SMB share) + - variable: readOnly + label: Read Only + description: Mount the volume as read only. + schema: + type: boolean + default: false + - variable: mountPath + label: Mount Path + description: The path inside the container to mount the storage. + schema: + type: path + required: true + - variable: hostPathConfig + label: Host Path Configuration + schema: + type: dict + show_if: [["type", "=", "hostPath"]] + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + default: false + - variable: acl + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + $ref: + - "normalize/acl" + - variable: hostPath + label: Host Path + description: The host path to use for storage. + schema: + type: hostpath + show_if: [["aclEnable", "=", false]] + required: true + - variable: ixVolumeConfig + label: ixVolume Configuration + description: The configuration for the ixVolume dataset. + schema: + type: dict + show_if: [["type", "=", "ixVolume"]] + $ref: + - "normalize/ixVolume" + attrs: + - variable: aclEnable + label: Enable ACL + description: Enable ACL for the dataset. + schema: + type: boolean + default: false + - variable: datasetName + label: Dataset Name + description: The name of the dataset to use for storage. + schema: + type: string + required: true + immutable: true + default: "storage_entry" + - variable: aclEntries + label: ACL Configuration + schema: + type: dict + show_if: [["aclEnable", "=", true]] + attrs: [] + - variable: smbConfig + label: SMB Share Configuration + description: The configuration for the SMB Share. + schema: + type: dict + show_if: [["type", "=", "smb-pv-pvc"]] + attrs: + - variable: server + label: Server + description: The server for the SMB share. + schema: + type: string + required: true + - variable: share + label: Share + description: The share name for the SMB share. + schema: + type: string + required: true + - variable: domain + label: Domain (Optional) + description: The domain for the SMB share. + schema: + type: string + - variable: username + label: Username + description: The username for the SMB share. + schema: + type: string + required: true + - variable: password + label: Password + description: The password for the SMB share. + schema: + type: string + required: true + private: true + - variable: size + label: Size (in Gi) + description: The size of the volume quota. + schema: + type: int + required: true + min: 1 + default: 1 + + - variable: resources + label: "" + group: Resources Configuration + schema: + type: dict + attrs: + - variable: limits + label: Limits + schema: + type: dict + attrs: + - variable: cpu + label: CPU + description: CPU limit for Invidious. + schema: + type: string + max_length: 6 + valid_chars: '^(0\.[1-9]|[1-9][0-9]*)(\.[0-9]|m?)$' + valid_chars_error: | + Valid CPU limit formats are
+ - Plain Integer - eg. 1
+ - Float - eg. 0.5
+ - Milicpu - eg. 500m + default: "4000m" + required: true + - variable: memory + label: Memory + description: Memory limit for Invidious. + schema: + type: string + max_length: 12 + valid_chars: '^[1-9][0-9]*([EPTGMK]i?|e[0-9]+)?$' + valid_chars_error: | + Valid Memory limit formats are
+ - Suffixed with E/P/T/G/M/K - eg. 1G
+ - Suffixed with Ei/Pi/Ti/Gi/Mi/Ki - eg. 1Gi
+ - Plain Integer in bytes - eg. 1024
+ - Exponent - eg. 134e6 + default: "8Gi" + required: true diff --git a/community/invidious/1.0.0/templates/NOTES.txt b/community/invidious/1.0.0/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/community/invidious/1.0.0/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/community/invidious/1.0.0/templates/_configuration.tpl b/community/invidious/1.0.0/templates/_configuration.tpl new file mode 100644 index 0000000000..761daeac6e --- /dev/null +++ b/community/invidious/1.0.0/templates/_configuration.tpl @@ -0,0 +1,62 @@ +{{- define "invidious.configuration" -}} + + {{- $fullname := (include "ix.v1.common.lib.chart.names.fullname" $) -}} + + {{- $dbHost := (printf "%s-postgres" $fullname) -}} + {{- $dbUser := "kemal" -}} {{/* User is hardcoded */}} + {{- $dbName := "invidious" -}} + + {{- $dbPass := (randAlphaNum 32) -}} + {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-postgres-creds" $fullname)) -}} + {{- $dbPass = ((index .data "POSTGRES_PASSWORD") | b64dec) -}} + {{- end -}} + + {{- $hmacKey := (randAlphaNum 64) -}} + {{- with (lookup "v1" "Secret" .Release.Namespace (printf "%s-invidious-creds" $fullname)) -}} + {{- $hmacKey = ((index .data "INVIDIOUS_HMAC_KEY") | b64dec) -}} + {{- end -}} + + {{/* Temporary set dynamic db details on values, + so we can print them on the notes */}} + {{- $_ := set .Values "invidiousDbPass" $dbPass -}} + {{- $_ := set .Values "invidiousDbHost" $dbHost -}} + + {{- $dbURL := (printf "postgres://%s:%s@%s:5432/%s?sslmode=disable" $dbUser $dbPass $dbHost $dbName) }} +secret: + postgres-creds: + enabled: true + data: + POSTGRES_USER: {{ $dbUser }} + POSTGRES_DB: {{ $dbName }} + POSTGRES_PASSWORD: {{ $dbPass }} + POSTGRES_HOST: {{ $dbHost }} + POSTGRES_URL: {{ $dbURL }} + # Used by invidious init script + PGPASSWORD: {{ $dbPass }} + PGHOST: {{ $dbHost }} + PGPORT: "5432" + + + 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 }} +{{- end -}} diff --git a/community/invidious/1.0.0/templates/_invidious.tpl b/community/invidious/1.0.0/templates/_invidious.tpl new file mode 100644 index 0000000000..dbe1bc9aba --- /dev/null +++ b/community/invidious/1.0.0/templates/_invidious.tpl @@ -0,0 +1,117 @@ +{{- define "invidious.workload" -}} +workload: + invidious: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: false + containers: + invidious: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + envFrom: + - secretRef: + name: invidious-creds + {{ with .Values.invidiousConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: http + path: /api/v1/comments/jNQXAC9IVRw + port: {{ .Values.invidiousNetwork.webPort }} + readiness: + enabled: true + type: http + path: /api/v1/comments/jNQXAC9IVRw + port: {{ .Values.invidiousNetwork.webPort }} + startup: + enabled: true + type: http + path: /api/v1/comments/jNQXAC9IVRw + port: {{ .Values.invidiousNetwork.webPort }} + initContainers: + {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions" + "UID" 1000 + "GID" 1000 + "mode" "check" + "type" "install") | nindent 8 }} + {{- include "ix.v1.common.app.postgresWait" (dict "name" "01-postgres-wait" + "secretName" "postgres-creds") | nindent 8 }} + 02-fetch-seed: + enabled: {{ .Release.IsInstall }} + type: init + imageSelector: gitImage + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + command: + - /bin/sh + - -c + args: + - | + echo "Fetching DB Seed..." + mkdir -p /shared/invidious + cd /shared/invidious + + git init && \ + git remote add invidious https://github.com/iv-org/invidious.git && \ + git fetch invidious && \ + # Fetch config and docker dirs + git checkout invidious/master -- docker config + + # Move config into docker dir + echo "Preparing directory structure..." + mv -fv config docker + echo "Done." + 03-init-db: + enabled: {{ .Release.IsInstall }} + type: init + imageSelector: postgresImage + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + envFrom: + - secretRef: + name: postgres-creds + command: + - /bin/sh + - -c + args: + - | + echo "Initializing Invidious DB..." + cd /shared/invidious/docker + ./init-invidious-db.sh + echo "Done." + 04-init-config: + enabled: true + type: init + imageSelector: image + securityContext: + runAsUser: 1000 + runAsGroup: 1000 + envFrom: + - secretRef: + name: postgres-creds + command: + - /bin/sh + - -c + args: + - | + if [ ! -f /config/config.yaml ]; then + echo "Initializing Invidious Config..." + cp -v /invidious/config/config.yml /config/config.yaml + exit 0 + fi + echo "Config already exists, skipping." +{{- end -}} diff --git a/community/invidious/1.0.0/templates/_persistence.tpl b/community/invidious/1.0.0/templates/_persistence.tpl new file mode 100644 index 0000000000..2faf16f80f --- /dev/null +++ b/community/invidious/1.0.0/templates/_persistence.tpl @@ -0,0 +1,52 @@ +{{- define "invidious.persistence" -}} +persistence: + config: + enabled: true + {{- include "ix.v1.common.app.storageOptions" (dict "storage" .Values.invidiousStorage.config) | nindent 4 }} + targetSelector: + invidious: + invidious: + mountPath: /config + 04-init-config: + mountPath: /config + {{- if and (eq .Values.invidiousStorage.config.type "ixVolume") + (not (.Values.invidiousStorage.config.ixVolumeConfig | default dict).aclEnable) }} + 01-permissions: + mountPath: /mnt/directories/config + {{- end }} + shared: + enabled: true + type: emptyDir + targetSelector: + invidious: + 02-fetch-seed: + mountPath: /shared + 03-init-db: + mountPath: /shared + tmp: + enabled: true + type: emptyDir + targetSelector: + invidious: + invidious: + mountPath: /tmp + + {{- range $idx, $storage := .Values.invidiousStorage.additionalStorages }} + {{ printf "invidious-%v:" (int $idx) }} + enabled: true + {{- include "ix.v1.common.app.storageOptions" (dict "storage" $storage) | nindent 4 }} + targetSelector: + invidious: + invidious: + mountPath: {{ $storage.mountPath }} + {{- if and (eq $storage.type "ixVolume") (not ($storage.ixVolumeConfig | default dict).aclEnable) }} + 01-permissions: + mountPath: /mnt/directories{{ $storage.mountPath }} + {{- end }} + {{- end }} + + {{- include "ix.v1.common.app.postgresPersistence" + (dict "pgData" .Values.invidiousStorage.pgData + "pgBackup" .Values.invidiousStorage.pgBackup + ) | nindent 2 }} +{{- end -}} diff --git a/community/invidious/1.0.0/templates/_portal.tpl b/community/invidious/1.0.0/templates/_portal.tpl new file mode 100644 index 0000000000..34ecd67b78 --- /dev/null +++ b/community/invidious/1.0.0/templates/_portal.tpl @@ -0,0 +1,12 @@ +{{- define "invidious.portal" -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: portal +data: + port: {{ .Values.invidiousNetwork.webPort | quote }} + path: "/" + protocol: http + host: $node_ip +{{- end -}} diff --git a/community/invidious/1.0.0/templates/_postgres.tpl b/community/invidious/1.0.0/templates/_postgres.tpl new file mode 100644 index 0000000000..0c050b6ca0 --- /dev/null +++ b/community/invidious/1.0.0/templates/_postgres.tpl @@ -0,0 +1,6 @@ +{{- define "postgres.workload" -}} +workload: +{{- include "ix.v1.common.app.postgres" (dict "secretName" "postgres-creds" + "resources" .Values.resources + "ixChartContext" .Values.ixChartContext) | nindent 2 }} +{{- end -}} diff --git a/community/invidious/1.0.0/templates/_service.tpl b/community/invidious/1.0.0/templates/_service.tpl new file mode 100644 index 0000000000..20d68e87ed --- /dev/null +++ b/community/invidious/1.0.0/templates/_service.tpl @@ -0,0 +1,17 @@ +{{- define "invidious.service" -}} +service: + invidious: + enabled: true + primary: true + type: NodePort + targetSelector: invidious + ports: + webui: + enabled: true + primary: true + port: {{ .Values.invidiousNetwork.webPort }} + nodePort: {{ .Values.invidiousNetwork.webPort }} + targetSelector: invidious + {{- include "ix.v1.common.app.postgresService" $ | nindent 2 }} + +{{- end -}} diff --git a/community/invidious/1.0.0/templates/common.yaml b/community/invidious/1.0.0/templates/common.yaml new file mode 100644 index 0000000000..730f7da691 --- /dev/null +++ b/community/invidious/1.0.0/templates/common.yaml @@ -0,0 +1,13 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "invidious.configuration" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "invidious.service" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "invidious.persistence" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "invidious.workload" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "postgres.workload" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "invidious.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/community/invidious/1.0.0/upgrade_strategy_disabled b/community/invidious/1.0.0/upgrade_strategy_disabled new file mode 100755 index 0000000000..696b64e6e3 --- /dev/null +++ b/community/invidious/1.0.0/upgrade_strategy_disabled @@ -0,0 +1,31 @@ +#!/usr/bin/python3 +import json +import re +import sys + +from catalog_update.upgrade_strategy import semantic_versioning + + +RE_STABLE_VERSION = re.compile(r'\d+\.\d+\.\d+') + + +def newer_mapping(image_tags): + key = list(image_tags.keys())[0] + tags = {t.strip("-apache"): t for t in image_tags[key] if RE_STABLE_VERSION.fullmatch(t)} + version = semantic_versioning(list(tags)) + if not version: + return {} + + return { + 'tags': {key: tags[version]}, + 'app_version': version, + } + + +if __name__ == '__main__': + try: + versions_json = json.loads(sys.stdin.read()) + except ValueError: + raise ValueError('Invalid json specified') + + print(json.dumps(newer_mapping(versions_json))) diff --git a/community/invidious/item.yaml b/community/invidious/item.yaml new file mode 100644 index 0000000000..4679248cec --- /dev/null +++ b/community/invidious/item.yaml @@ -0,0 +1,12 @@ +icon_url: https://media.sys.truenas.net/apps/invidious/icons/icon.svg +categories: + - media +screenshots: + - https://media.sys.truenas.net/apps/invidious/screenshots/screenshot1.png + - https://media.sys.truenas.net/apps/invidious/screenshots/screenshot2.png + - https://media.sys.truenas.net/apps/invidious/screenshots/screenshot3.png + - https://media.sys.truenas.net/apps/invidious/screenshots/screenshot4.png + - https://media.sys.truenas.net/apps/invidious/screenshots/screenshot5.png + - https://media.sys.truenas.net/apps/invidious/screenshots/screenshot6.png +tags: + - youtube