From 536febfefd7a9aa0dd3299b3b20302008e4f25e0 Mon Sep 17 00:00:00 2001 From: Xstar97 Date: Thu, 8 Dec 2022 12:47:44 -0500 Subject: [PATCH] fix(euterpe) set persistence & tagged ver (#4623) * fix(euterpe) set persistence & tagged ver * remove comment from repo * rar rofs * set protocol to http * set to 568 + ranr * rar + rofs false * set protocol TCP + probes * set probes * ranr * update values * set our image * Update charts/incubator/euterpe/values.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Update charts/incubator/euterpe/values.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Apply suggestions from code review Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * secret * empty * major bump * Update values.yaml * whoops * cast to int * clean * whoops * add gui options * Apply suggestions from code review Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Update charts/incubator/euterpe/questions.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Update charts/incubator/euterpe/questions.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Update charts/incubator/euterpe/questions.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Apply suggestions from code review Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Update charts/incubator/euterpe/questions.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Update charts/incubator/euterpe/questions.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Update charts/incubator/euterpe/questions.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Apply suggestions from code review Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * Update charts/incubator/euterpe/questions.yaml Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> * fixy fixy * fix spelling * hmm Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros kois --- charts/incubator/euterpe/Chart.yaml | 21 +-- charts/incubator/euterpe/questions.yaml | 149 +++++++++++++++--- .../incubator/euterpe/templates/_secret.tpl | 78 +++++++++ .../incubator/euterpe/templates/common.yaml | 8 +- charts/incubator/euterpe/values.yaml | 48 +++++- 5 files changed, 266 insertions(+), 38 deletions(-) create mode 100644 charts/incubator/euterpe/templates/_secret.tpl diff --git a/charts/incubator/euterpe/Chart.yaml b/charts/incubator/euterpe/Chart.yaml index 19f95eb7c86..8fd14f5bf28 100644 --- a/charts/incubator/euterpe/Chart.yaml +++ b/charts/incubator/euterpe/Chart.yaml @@ -1,18 +1,11 @@ -annotations: - truecharts.org/SCALE-support: "true" - truecharts.org/catagories: | - - Productivity - - Tools-Utilities - - MediaApp-Music - - MediaServer-Music apiVersion: v2 -appVersion: "latest" +appVersion: "1.5.2" dependencies: - name: common repository: https://library-charts.truecharts.org version: 11.0.4 deprecated: false -description: "Euterpe is self-hosted streaming service for music. Formerly known as HTTPMS (HTTP Media Server)." +description: Self-hosted streaming service for music, formerly known as HTTP Media Server. home: https://truecharts.org/docs/charts/incubator/euterpe icon: https://truecharts.org/img/hotlink-ok/chart-icons/euterpe.png keywords: @@ -32,4 +25,12 @@ sources: - https://github.com/ironsmile/euterpe - https://hub.docker.com/r/ironsmile/euterpe type: application -version: 2.0.3 +version: 3.0.0 +annotations: + truecharts.org/catagories: | + - Productivity + - Tools-Utilities + - MediaApp-Music + - MediaServer-Music + truecharts.org/SCALE-support: "true" + truecharts.org/grade: U diff --git a/charts/incubator/euterpe/questions.yaml b/charts/incubator/euterpe/questions.yaml index e63484a808a..21b28d5ac84 100644 --- a/charts/incubator/euterpe/questions.yaml +++ b/charts/incubator/euterpe/questions.yaml @@ -8,11 +8,122 @@ questions: # Include{replicas} # Include{replica1} # Include{controllerExpertExtraArgs} + - variable: euterpe + group: App Configuration + label: Discord GSM Configuration + schema: + additional_attrs: true + type: dict + attrs: + - variable: basic_authenticate + label: Enable Basic Authenticate + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: authentication + label: Authentication + schema: + additional_attrs: true + type: dict + attrs: + - variable: user + label: Basic Auth Username + schema: + type: string + required: true + default: "" + - variable: password + label: Basic Auth Password + schema: + type: string + required: true + default: "" + - variable: libraries + label: Libraries + description: The `/root/Music` library is automatically added. + schema: + type: list + default: [] + items: + - variable: libraryEntry + label: Library Entry + schema: + type: string + required: true + default: "" + - variable: library_scan + label: Library Scan + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: initial_wait_duration + label: Initial Wait Duration + schema: + type: string + default: 1s + - variable: files_per_operation + label: Files Per Operation + schema: + type: int + default: 1500 + - variable: sleep_after_operation + label: Sleep After Operation + schema: + type: string + default: 15ms + - variable: discogs + label: Discogs Settings + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: discogs_auth_token + label: Discogs Auth Token + schema: + type: string + default: "" + - variable: download_artwork + label: Download Artwork + schema: + type: boolean + default: false + - variable: danger_zone + label: Danger Zone Settings + schema: + type: boolean + default: false + show_subquestions_if: true + subquestions: + - variable: gzip + label: gzip + schema: + type: boolean + default: true + - variable: read_timeout + label: Read Timeout + schema: + type: int + default: 15 + - variable: write_timeout + label: Write Timeout + schema: + type: int + default: 1200 + - variable: max_header_bytes + label: Max Header Bytes + schema: + type: int + default: 1048576 # Include{containerConfig} # Include{serviceRoot} - variable: main - label: "Main Service" - description: "The Primary service on which the healthcheck runs, often the webUI" + label: Main Service + description: The Primary service on which the healthcheck runs, often the webUI schema: additional_attrs: true type: dict @@ -20,14 +131,14 @@ questions: # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: main - label: "Main Service Port Configuration" + label: Main Service Port Configuration schema: additional_attrs: true type: dict attrs: - variable: port - label: "Port" - description: "This port exposes the container port on the service" + label: Port + description: This port exposes the container port on the service schema: type: int default: 9996 @@ -37,9 +148,9 @@ questions: # Include{serviceExpert} # Include{serviceList} # Include{persistenceRoot} - - variable: storagelibrary - label: "storagelibrary Storage" - description: "This is your music library." + - variable: music + label: App Music Storage + description: Stores the Application Music. schema: additional_attrs: true type: dict @@ -48,7 +159,7 @@ questions: # Include{persistenceList} # Include{ingressRoot} - variable: main - label: "Main Ingress" + label: Main Ingress schema: additional_attrs: true type: dict @@ -60,41 +171,41 @@ questions: # Include{security} # Include{securityContextAdvancedRoot} - variable: privileged - label: "Privileged mode" + label: Privileged mode schema: type: boolean default: false - variable: readOnlyRootFilesystem - label: "ReadOnly Root Filesystem" + label: ReadOnly Root Filesystem schema: type: boolean default: false - variable: allowPrivilegeEscalation - label: "Allow Privilege Escalation" + label: Allow Privilege Escalation schema: type: boolean default: false - variable: runAsNonRoot - label: "runAsNonRoot" + label: runAsNonRoot schema: type: boolean default: false # Include{podSecurityContextRoot} - variable: runAsUser - label: "runAsUser" - description: "The UserID of the user running the application" + label: runAsUser + description: The UserID of the user running the application schema: type: int default: 0 - variable: runAsGroup - label: "runAsGroup" - description: The groupID this App of the user running the application" + label: runAsGroup + description: The groupID this App of the user running the application schema: type: int default: 0 - variable: fsGroup - label: "fsGroup" - description: "The group that should own ALL storage." + label: fsGroup + description: The group that should own ALL storage. schema: type: int default: 568 diff --git a/charts/incubator/euterpe/templates/_secret.tpl b/charts/incubator/euterpe/templates/_secret.tpl new file mode 100644 index 00000000000..d0e54ff1604 --- /dev/null +++ b/charts/incubator/euterpe/templates/_secret.tpl @@ -0,0 +1,78 @@ +{{/* Define the secret */}} +{{- define "euterpe.secret" -}} + +{{- $secretName := printf "%s-secret" (include "tc.common.names.fullname" .) }} +{{- $secretStorageName := printf "%s-storage-secret" (include "tc.common.names.fullname" .) }} + +{{- $secretKey := "" }} +{{- with (lookup "v1" "Secret" .Release.Namespace $secretStorageName) }} + {{- $secretKey = (index .data "secret") }} +{{- else }} + {{- $secretKey = randAlphaNum 32 }} +{{- end }} +--- +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: {{ $secretName }} + labels: + {{- include "tc.common.labels" . | nindent 4 }} +stringData: + config.json: | + { + "listen": {{ printf ":%v" .Values.service.main.ports.main.port | quote }}, + "ssl": false, + + "basic_authenticate": {{ .Values.euterpe.basic_authenticate }}, + "authentication": { + {{- with .Values.euterpe.authentication.user }} + "user": {{ . | quote }}, + {{- end }} + {{- with .Values.euterpe.authentication.password }} + "password": {{ . | quote }}, + {{- end }} + "secret": {{ $secretKey | quote }} + }, + + {{- $libraries := .Values.euterpe.libraries -}} + {{- $libraries = append $libraries .Values.persistence.music.mountPath }} + + "libraries": [ + {{- range initial $libraries }} + {{ . | quote }}, + {{- end }} + {{ last $libraries | quote }} + ], + + "library_scan": { + "initial_wait_duration": {{ .Values.euterpe.library_scan.initial_wait_duration | quote }}, + "files_per_operation": {{ .Values.euterpe.library_scan.files_per_operation }}, + "sleep_after_operation": {{ .Values.euterpe.library_scan.sleep_after_operation | quote }} + }, + + "download_artwork": {{ .Values.euterpe.discogs.download_artwork }}, + + {{- with .Values.euterpe.discogs.discogs_auth_token }} + "discogs_auth_token": {{ . | quote }}, + {{- end }} + + "gzip": {{ .Values.euterpe.danger_zone.gzip }}, + "log_file": {{ .Values.euterpe.danger_zone.log_file | quote }}, + "sqlite_database": {{ .Values.euterpe.danger_zone.sqlite_database | quote }}, + "read_timeout": {{ .Values.euterpe.danger_zone.read_timeout }}, + "write_timeout": {{ .Values.euterpe.danger_zone.write_timeout }}, + "max_header_bytes": {{ .Values.euterpe.danger_zone.max_header_bytes | int }} + } +--- +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: {{ $secretStorageName }} + labels: + {{- include "tc.common.labels" . | nindent 4 }} +data: + {{/* Store secretKey to reuse */}} + secret: {{ $secretKey | b64enc }} +{{- end }} diff --git a/charts/incubator/euterpe/templates/common.yaml b/charts/incubator/euterpe/templates/common.yaml index cbf66c20818..f6e5dafe8af 100644 --- a/charts/incubator/euterpe/templates/common.yaml +++ b/charts/incubator/euterpe/templates/common.yaml @@ -1,2 +1,8 @@ +{{/* Make sure all variables are set properly */}} +{{- include "tc.common.loader.init" . }} + +{{/* Render secret */}} +{{- include "euterpe.secret" . }} + {{/* Render the templates */}} -{{ include "tc.common.loader.all" . }} +{{ include "tc.common.loader.apply" . }} diff --git a/charts/incubator/euterpe/values.yaml b/charts/incubator/euterpe/values.yaml index b860b4de1b6..dd01f5e7299 100644 --- a/charts/incubator/euterpe/values.yaml +++ b/charts/incubator/euterpe/values.yaml @@ -1,25 +1,57 @@ -env: {} image: pullPolicy: IfNotPresent repository: tccr.io/truecharts/euterpe - tag: latest@sha256:5be892d3559100899f7b36a9bc3894448414b53dd6af885f3606fa0316b6b44a -persistence: - storagelibrary: - enabled: true - mountPath: /root/Music + tag: 1.5.2@sha256:5be892d3559100899f7b36a9bc3894448414b53dd6af885f3606fa0316b6b44a + podSecurityContext: runAsGroup: 0 runAsUser: 0 + securityContext: readOnlyRootFilesystem: false runAsNonRoot: false + +euterpe: + basic_authenticate: false + authentication: + user: "" + password: "" + libraries: [] + library_scan: + initial_wait_duration: 1s + files_per_operation: 1500 + sleep_after_operation: 15ms + discogs: + download_artwork: false + discogs_auth_token: "" + # Danger Zone + danger_zone: + gzip: true + log_file: euterpe.log + sqlite_database: euterpe.db + read_timeout: 15 + write_timeout: 1200 + max_header_bytes: 1048576 + service: main: ports: main: port: 9996 - protocol: TCP - targetPort: 9996 + protocol: HTTP + +persistence: + music: + enabled: true + mountPath: /root/Music + configfile: + enabled: true + type: secret + readOnly: true + defaultMode: "0600" + objectName: '{{ include "tc.common.names.fullname" . }}-secret' + mountPath: /root/.euterpe/config.json + subPath: config.json portal: enabled: true