From 5ae271374fde1c1ba9e3f480ef0fe4834ba78aa3 Mon Sep 17 00:00:00 2001 From: MaverickD650 <92877124+MaverickD650@users.noreply.github.com> Date: Thu, 1 Jun 2023 21:51:19 +0100 Subject: [PATCH] feat(invidious): Invidious port (#9283) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Porting Invidious to new common. ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [X] 🪛 Bugfix - [X] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** Tested on CI within my fork before creating the PR. **📃 Notes:** **✔️ Checklist:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [X] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [X] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- charts/incubator/invidious/Chart.yaml | 8 +- .../incubator/invidious/templates/_config.tpl | 19 +--- .../incubator/invidious/templates/_dbseed.tpl | 42 ------- .../incubator/invidious/templates/common.yaml | 12 +- charts/incubator/invidious/values.yaml | 105 ++++++++++++------ 5 files changed, 88 insertions(+), 98 deletions(-) delete mode 100644 charts/incubator/invidious/templates/_dbseed.tpl diff --git a/charts/incubator/invidious/Chart.yaml b/charts/incubator/invidious/Chart.yaml index 2b5780b3e7a..59d9c8b6962 100644 --- a/charts/incubator/invidious/Chart.yaml +++ b/charts/incubator/invidious/Chart.yaml @@ -3,11 +3,7 @@ appVersion: "latest" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 11.1.2 - - condition: postgresql.enabled - name: postgresql - repository: https://deps.truecharts.org/ - version: 11.0.31 + version: 12.10.4 description: Open source alternative front-end to YouTube. home: https://truecharts.org/charts/incubator/invidious icon: https://truecharts.org/img/hotlink-ok/chart-icons/invidious.png @@ -25,7 +21,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/invidious - https://github.com/iv-org/invidious - https://docs.invidious.io/installation/#docker -version: 3.0.0 +version: 4.0.0 annotations: truecharts.org/catagories: | - media diff --git a/charts/incubator/invidious/templates/_config.tpl b/charts/incubator/invidious/templates/_config.tpl index f93f15a0249..77632e1fe14 100644 --- a/charts/incubator/invidious/templates/_config.tpl +++ b/charts/incubator/invidious/templates/_config.tpl @@ -1,7 +1,6 @@ {{/* Define the configmap */}} {{- define "invidious.config" -}} -{{- $configName := printf "%s-invidious-config" (include "tc.common.names.fullname" .) }} {{- $vNet := .Values.invidious.network }} {{- $vLog := .Values.invidious.logging }} {{- $vFeat := .Values.invidious.features }} @@ -16,22 +15,16 @@ {{- $vVidPlay := .Values.invidious.default_user_preferences.video_playback_settings }} {{- $vSubFeed := .Values.invidious.default_user_preferences.subscription_feed }} {{- $vUserMisc := .Values.invidious.default_user_preferences.miscellaneous }} ---- -apiVersion: v1 -kind: Secret -metadata: - name: {{ $configName }} - labels: - {{- include "tc.common.labels" . | nindent 4 }} -stringData: +enabled: true +data: INVIDIOUS_CONFIG: | # Database check_tables: true db: - user: {{ .Values.postgresql.postgresqlUsername }} - dbname: {{ .Values.postgresql.postgresqlDatabase }} - password: {{ .Values.postgresql.postgresqlPassword | trimAll "\"" }} - host: {{ .Values.postgresql.url.plain | trimAll "\"" }} + user: {{ .Values.cnpg.main.user }} + dbname: {{ .Values.cnpg.main.database }} + password: {{ .Values.cnpg.main.creds.password }} + host: {{ .Values.cnpg.main.creds.host }} port: 5432 # Network diff --git a/charts/incubator/invidious/templates/_dbseed.tpl b/charts/incubator/invidious/templates/_dbseed.tpl deleted file mode 100644 index 8c96bc4238c..00000000000 --- a/charts/incubator/invidious/templates/_dbseed.tpl +++ /dev/null @@ -1,42 +0,0 @@ -{{- define "invidious.dbseed" -}} -image: "{{ .Values.ubuntuImage.repository }}:{{ .Values.ubuntuImage.tag }}" -env: - - name: POSTGRES_DB - value: {{ .Values.postgresql.postgresqlDatabase }} - - name: POSTGRES_USER - value: {{ .Values.postgresql.postgresqlUsername }} -{{/* PG* variables are for the psql client */}} - - name: PGPORT - value: "5432" - - name: PGHOST - valueFrom: - secretKeyRef: - name: dbcreds - key: plainhost - - name: PGPASSWORD - valueFrom: - secretKeyRef: - name: dbcreds - key: postgresql-password -command: - - /bin/sh - - -c - - | - echo "Starting DB Seed..." - mkdir -p invidious && cd invidious - - echo "Fetching seed files..." - 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 "Performing the seed..." - cd docker - ./init-invidious-db.sh -{{- end -}} diff --git a/charts/incubator/invidious/templates/common.yaml b/charts/incubator/invidious/templates/common.yaml index 83290053c0d..572b59322e4 100644 --- a/charts/incubator/invidious/templates/common.yaml +++ b/charts/incubator/invidious/templates/common.yaml @@ -1,9 +1,11 @@ {{/* Make sure all variables are set properly */}} -{{- include "tc.common.loader.init" . }} +{{- include "tc.v1.common.loader.init" . }} -{{- include "invidious.config" . }} - -{{- $_ := set .Values.installContainers "dbseed" (include "invidious.dbseed" . | fromYaml) -}} +{{/* Render configmap for invidious */}} +{{- $configmapFile := include "invidious.config" . | fromYaml -}} +{{- if $configmapFile -}} + {{- $_ := set .Values.configmap "invidious-config" $configmapFile -}} +{{- end -}} {{/* Render the templates */}} -{{ include "tc.common.loader.apply" . }} +{{ include "tc.v1.common.loader.apply" . }} diff --git a/charts/incubator/invidious/values.yaml b/charts/incubator/invidious/values.yaml index af330208516..531f4d12a33 100644 --- a/charts/incubator/invidious/values.yaml +++ b/charts/incubator/invidious/values.yaml @@ -3,13 +3,72 @@ image: pullPolicy: IfNotPresent tag: latest@sha256:3bb9e44e7d69baf91728c0a88115ef5fdb3adc91432b851e11e4d0e78bbe6e7a -podSecurityContext: - runAsGroup: 0 - runAsUser: 0 - securityContext: - readOnlyRootFilesystem: false - runAsNonRoot: false + container: + readOnlyRootFilesystem: false + runAsNonRoot: false + runAsGroup: 0 + runAsUser: 0 + +service: + main: + ports: + main: + port: 10594 + protocol: http + +workload: + main: + podSpec: + initContainers: + dbseed: + type: install + enabled: true + imageSelector: postgresClientImage + env: + POSTGRES_DB: + secretKeyRef: + name: cnpg-main-urls + key: std + POSTGRES_USER: "{{ .Values.cnpg.main.user }}" + # PG* variables are for the psql client + PGPORT: "5432" + PGPASSWORD: + secretKeyRef: + name: cnpg-main-user + key: password + command: ["sh", "-c"] + args: + - | + echo "Starting DB Seed..." + mkdir -p invidious && cd invidious + + echo "Fetching seed files..." + 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 "Performing the seed..." + cd docker + ./init-invidious-db.sh + containers: + main: + probes: + liveness: + type: http + readiness: + type: http + startup: + type: http + envFrom: + - configMapRef: + name: invidious-config invidious: network: @@ -105,32 +164,14 @@ invidious: automatic_instance_redirect: false extend_desc: false -envFrom: - - secretRef: - name: '{{ include "tc.common.names.fullname" . }}-invidious-config' - -service: +cnpg: main: - ports: - main: - port: 10594 - protocol: HTTP - -probes: - liveness: - type: HTTP - readiness: - type: HTTP - startup: - type: HTTP - -postgresql: - enabled: true - existingSecret: dbcreds - postgresqlDatabase: invidious - # DB User cannot be changed - # hardcoded from upstream - postgresqlUsername: kemal + enabled: true + database: invidious + # DB User cannot be changed + # hardcoded from upstream + username: kemal portal: - enabled: true + open: + enabled: true