From d8a29b7679f38fe886ae9647a7bad8473610933d Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Tue, 29 Aug 2023 13:13:31 -0400 Subject: [PATCH] feat(romm) add redis and auth support (#11923) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Add redis and auth to enable user control panel ⚒️ Fixes # **⚙️ Type of change** - [X] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 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 - [ ] ⚠️ 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: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> --- charts/stable/romm/Chart.yaml | 6 +++- charts/stable/romm/questions.yaml | 33 +++++++++++++++++ charts/stable/romm/templates/_secrets.tpl | 13 +++++++ charts/stable/romm/templates/common.yaml | 12 ++++++- charts/stable/romm/values.yaml | 43 ++++++++++++++++++----- 5 files changed, 96 insertions(+), 11 deletions(-) create mode 100644 charts/stable/romm/templates/_secrets.tpl diff --git a/charts/stable/romm/Chart.yaml b/charts/stable/romm/Chart.yaml index 49e22046b45..2f466328960 100644 --- a/charts/stable/romm/Chart.yaml +++ b/charts/stable/romm/Chart.yaml @@ -8,6 +8,10 @@ dependencies: name: mariadb repository: https://deps.truecharts.org/ version: 7.0.70 + - condition: redis.enabled + name: redis + repository: https://deps.truecharts.org + version: 7.0.6 deprecated: false description: game library manager focused in retro gaming home: https://truecharts.org/charts/stable/romm @@ -25,7 +29,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/stable/romm - https://github.com/zurdi15/romm type: application -version: 2.0.2 +version: 2.0.3 annotations: truecharts.org/catagories: | - media diff --git a/charts/stable/romm/questions.yaml b/charts/stable/romm/questions.yaml index a121d7bb98b..52245b8d940 100644 --- a/charts/stable/romm/questions.yaml +++ b/charts/stable/romm/questions.yaml @@ -42,6 +42,31 @@ questions: # Include{containerBasic} # Include{containerAdvanced} + - variable: romm + group: App Configuration + label: Romm + schema: + additional_attrs: true + type: dict + attrs: + - variable: auth + label: Auth Credentials + schema: + additional_attrs: true + type: dict + attrs: + - variable: user + label: Auth User + schema: + type: string + default: "" + - variable: pass + label: Auth Password + schema: + type: string + private: true + default: "" + # Include{containerConfig} # Include{serviceRoot} # Include{serviceMain} @@ -79,6 +104,14 @@ questions: additional_attrs: true type: dict attrs: +# Include{persistenceBasic} + - variable: logs + label: App Logs Storage + description: Stores the Application Logs. + schema: + additional_attrs: true + type: dict + attrs: # Include{persistenceBasic} # Include{persistenceList} # Include{ingressRoot} diff --git a/charts/stable/romm/templates/_secrets.tpl b/charts/stable/romm/templates/_secrets.tpl new file mode 100644 index 00000000000..efcd7715118 --- /dev/null +++ b/charts/stable/romm/templates/_secrets.tpl @@ -0,0 +1,13 @@ +{{/* Define the secrets */}} +{{- define "romm.secrets" -}} +{{- $secretName := (printf "%s-romm-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) }} + +{{- $authKey := randAlphaNum 64 -}} + + {{- with lookup "v1" "Secret" .Release.Namespace $secretName -}} + {{- $authKey = index .data "ROMM_AUTH_SECRET_KEY" | b64dec -}} + {{- end }} +enabled: true +data: + ROMM_AUTH_SECRET_KEY: {{ $authKey }} +{{- end -}} diff --git a/charts/stable/romm/templates/common.yaml b/charts/stable/romm/templates/common.yaml index b51394e00a4..39d94da9407 100644 --- a/charts/stable/romm/templates/common.yaml +++ b/charts/stable/romm/templates/common.yaml @@ -1 +1,11 @@ -{{ include "tc.v1.common.loader.all" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . -}} + +{{/* Render secrets for romm */}} +{{- $secrets := include "romm.secrets" . | fromYaml -}} +{{- if $secrets -}} + {{- $_ := set .Values.secret "romm-secrets" $secrets -}} +{{- end -}} + +{{/* Render the templates */}} +{{- include "tc.v1.common.loader.apply" . -}} diff --git a/charts/stable/romm/values.yaml b/charts/stable/romm/values.yaml index 69bc03a23be..9a93ab02a10 100644 --- a/charts/stable/romm/values.yaml +++ b/charts/stable/romm/values.yaml @@ -10,6 +10,18 @@ securityContext: runAsUser: 0 runAsGroup: 0 +service: + main: + ports: + main: + protocol: http + port: 10680 + +romm: + auth: + user: "admin" + pass: "admin" + workload: main: podSpec: @@ -23,12 +35,13 @@ workload: startup: type: http env: + VITE_BACKEND_DEV_PORT: "{{ .Values.service.main.ports.main.port }}" + ROMM_BASE_PATH: /romm ROMM_DB_DRIVER: mariadb # IGDB client id CLIENT_ID: "" # IGDB client secret CLIENT_SECRET: "" - # WIP STEAMGRIDDB_API_KEY: "" DB_PORT: 3306 DB_NAME: "{{ .Values.mariadb.mariadbDatabase }}" @@ -43,14 +56,20 @@ workload: expandObjectName: false name: '{{ printf "%s-%s" .Release.Name "mariadbcreds" }}' key: mariadb-password - -service: - main: - ports: - main: - protocol: http - targetPort: 80 - port: 10680 + REDIS_HOST: + secretKeyRef: + expandObjectName: false + name: '{{ printf "%s-%s" .Release.Name "rediscreds" }}' + key: plainhost + REDIS_PORT: 6379 + ROMM_AUTH_SECRET_KEY: + secretKeyRef: + name: romm-secrets + key: ROMM_AUTH_SECRET_KEY + ROMM_AUTH_ENABLED: true + ENABLE_EXPERIMENTAL_REDIS: true + ROMM_AUTH_USERNAME: "{{ .Values.romm.auth.user}}" + ROMM_AUTH_PASSWORD: "{{ .Values.romm.auth.pass}}" persistence: library: @@ -59,12 +78,18 @@ persistence: resources: enabled: true mountPath: /romm/resources + logs: + enabled: true + mountPath: /romm/logs mariadb: enabled: true mariadbUsername: romm mariadbDatabase: romm +redis: + enabled: true + portal: open: enabled: true