feat(invidious): Invidious port (#9283)

**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
Porting Invidious to new common.

⚒️ Fixes  # <!--(issue)-->

**⚙️ 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?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->
Tested on CI within my fork before creating the PR.

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ 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>
This commit is contained in:
MaverickD650 2023-06-01 21:51:19 +01:00 committed by GitHub
parent 617f9d8aa8
commit 5ae271374f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 88 additions and 98 deletions

View File

@ -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

View File

@ -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

View File

@ -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 -}}

View File

@ -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" . }}

View File

@ -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