diff --git a/library/ix-dev/community/navidrome/Chart.lock b/library/ix-dev/community/navidrome/Chart.lock new file mode 100644 index 0000000000..5b29c2142e --- /dev/null +++ b/library/ix-dev/community/navidrome/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: common + repository: file://../../../common + version: 1.0.8 +digest: sha256:254efaa1285f634b7a80b7baadeadbd20a680f7fee49d1d9d3c4618aa0d657ad +generated: "2023-06-23T20:43:05.276871905+03:00" diff --git a/library/ix-dev/community/navidrome/Chart.yaml b/library/ix-dev/community/navidrome/Chart.yaml new file mode 100644 index 0000000000..958a8a1262 --- /dev/null +++ b/library/ix-dev/community/navidrome/Chart.yaml @@ -0,0 +1,26 @@ +name: navidrome +description: Navidrome is a personal streaming service +annotations: + title: Navidrome +type: application +version: 1.0.0 +apiVersion: v2 +appVersion: '0.49.3' +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.0.8 +home: https://www.navidrome.org/ +icon: https://github.com/navidrome/navidrome/raw/master/resources/logo-192x192.png +sources: + - https://hub.docker.com/r/deluan/navidrome + - https://github.com/truenas/charts/tree/master/community/navidrome + - https://github.com/navidrome/navidrome/ +keywords: + - media + - music diff --git a/library/ix-dev/community/navidrome/README.md b/library/ix-dev/community/navidrome/README.md new file mode 100644 index 0000000000..00338e154d --- /dev/null +++ b/library/ix-dev/community/navidrome/README.md @@ -0,0 +1,11 @@ +# Navidrome + +[Navidrome](https://www.navidrome.org/) is a personal streaming service + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `Navidrome` directories. +> Afterward, the `Navidrome` container will run as a **non**-root user (Default: `568`). +> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user. + +Additional configuration options can be defined via environment variables. +See more information on the [Navidrome Documentation](https://www.navidrome.org/docs/usage/configuration-options) diff --git a/library/ix-dev/community/navidrome/app-readme.md b/library/ix-dev/community/navidrome/app-readme.md new file mode 100644 index 0000000000..00338e154d --- /dev/null +++ b/library/ix-dev/community/navidrome/app-readme.md @@ -0,0 +1,11 @@ +# Navidrome + +[Navidrome](https://www.navidrome.org/) is a personal streaming service + +> When application is installed, a container will be launched with **root** privileges. +> This is required in order to apply the correct permissions to the `Navidrome` directories. +> Afterward, the `Navidrome` container will run as a **non**-root user (Default: `568`). +> All mounted storage(s) will be `chown`ed only if the parent directory does not match the configured user. + +Additional configuration options can be defined via environment variables. +See more information on the [Navidrome Documentation](https://www.navidrome.org/docs/usage/configuration-options) diff --git a/library/ix-dev/community/navidrome/charts/common-1.0.8.tgz b/library/ix-dev/community/navidrome/charts/common-1.0.8.tgz new file mode 100644 index 0000000000..aa83a82783 Binary files /dev/null and b/library/ix-dev/community/navidrome/charts/common-1.0.8.tgz differ diff --git a/library/ix-dev/community/navidrome/ci/basic-values.yaml b/library/ix-dev/community/navidrome/ci/basic-values.yaml new file mode 100644 index 0000000000..af21d50315 --- /dev/null +++ b/library/ix-dev/community/navidrome/ci/basic-values.yaml @@ -0,0 +1,10 @@ +navidromeStorage: + data: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/data + music: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/music + +navidromeConfig: + uiWelcomeMessage: 'Welcome to Navidrome!' diff --git a/library/ix-dev/community/navidrome/ci/other-user-values.yaml b/library/ix-dev/community/navidrome/ci/other-user-values.yaml new file mode 100644 index 0000000000..8b95c42cd7 --- /dev/null +++ b/library/ix-dev/community/navidrome/ci/other-user-values.yaml @@ -0,0 +1,11 @@ +navidromeStorage: + data: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/data + music: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/music + +navidromeRunAs: + user: 1000 + group: 1000 diff --git a/library/ix-dev/community/navidrome/item.yaml b/library/ix-dev/community/navidrome/item.yaml new file mode 100644 index 0000000000..d5b234bad6 --- /dev/null +++ b/library/ix-dev/community/navidrome/item.yaml @@ -0,0 +1,7 @@ +icon_url: https://github.com/navidrome/navidrome/raw/master/resources/logo-192x192.png +categories: + - media +screenshots: + - https://noted.lol/content/images/size/w1000/2022/05/navidrome-self-hosted-main-1.png +tags: + - music diff --git a/library/ix-dev/community/navidrome/metadata.yaml b/library/ix-dev/community/navidrome/metadata.yaml new file mode 100644 index 0000000000..51d3433303 --- /dev/null +++ b/library/ix-dev/community/navidrome/metadata.yaml @@ -0,0 +1,8 @@ +runAsContext: + - userName: navidrome + groupName: navidrome + gid: 568 + uid: 568 + description: Navidrome can run as any non-root user. +capabilities: [] +hostMounts: [] diff --git a/library/ix-dev/community/navidrome/questions.yaml b/library/ix-dev/community/navidrome/questions.yaml new file mode 100644 index 0000000000..0d97c51ca5 --- /dev/null +++ b/library/ix-dev/community/navidrome/questions.yaml @@ -0,0 +1,262 @@ +groups: + - name: Navidrome Configuration + description: Configure Navidrome + - name: User and Group Configuration + description: Configure User and Group for Navidrome + - name: Network Configuration + description: Configure Network for Navidrome + - name: Storage Configuration + description: Configure Storage for Navidrome + - name: Resources Configuration + description: Configure Resources for Navidrome + +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: navidromeConfig + label: "" + group: Navidrome Configuration + schema: + type: dict + attrs: + - variable: uiWelcomeMessage + label: Login Screen Welcome Message + description: The welcome message to display on the Navidrome Login Screen. + schema: + type: string + default: "" + - variable: additionalEnvs + label: Additional Environment Variables + description: Configure additional environment variables for Navidrome. + 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: navidromeRunAs + label: "" + group: User and Group Configuration + schema: + type: dict + attrs: + - variable: user + label: User ID + description: The user id that Navidrome will run as. + schema: + type: int + min: 2 + default: 568 + required: true + - variable: group + label: Group ID + description: The group id that Navidrome will run as. + schema: + type: int + min: 2 + default: 568 + required: true + + - variable: navidromeNetwork + label: "" + group: Network Configuration + schema: + type: dict + attrs: + - variable: webPort + label: Web Port + description: The port for the Navidrome Web UI. + schema: + type: int + default: 30043 + min: 9000 + max: 65535 + required: true + - variable: hostNetwork + label: Host Network + description: | + Bind to the host network. It's recommended to keep this disabled.
+ schema: + type: boolean + default: false + + - variable: navidromeStorage + label: "" + group: Storage Configuration + schema: + type: dict + attrs: + - variable: data + label: Navidrome Data Storage + description: The path to store Navidrome 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 + 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: datasetName + label: Dataset Name + schema: + type: string + show_if: [["type", "=", "ixVolume"]] + required: true + hidden: true + immutable: true + default: "data" + $ref: + - "normalize/ixVolume" + - variable: hostPath + label: Host Path + schema: + type: hostpath + show_if: [["type", "=", "hostPath"]] + immutable: true + required: true + - variable: music + label: Navidrome Music Storage + description: The path to store Navidrome Music. + 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 + 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: datasetName + label: Dataset Name + schema: + type: string + show_if: [["type", "=", "ixVolume"]] + required: true + hidden: true + immutable: true + default: "music" + $ref: + - "normalize/ixVolume" + - variable: hostPath + label: Host Path + schema: + type: hostpath + show_if: [["type", "=", "hostPath"]] + immutable: true + required: true + - variable: additionalStorages + label: Additional Storage + description: Additional storage for Navidrome. + 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. + schema: + type: string + required: 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: mountPath + label: Mount Path + description: The path inside the container to mount the storage. + schema: + type: path + required: true + - variable: hostPath + label: Host Path + description: The host path to use for storage. + schema: + type: hostpath + show_if: [["type", "=", "hostPath"]] + required: true + - variable: datasetName + label: Dataset Name + description: The name of the dataset to use for storage. + schema: + type: string + show_if: [["type", "=", "ixVolume"]] + required: true + immutable: true + default: "storage_entry" + $ref: + - "normalize/ixVolume" + + - variable: resources + group: Resources Configuration + label: "" + schema: + type: dict + attrs: + - variable: limits + label: Limits + schema: + type: dict + attrs: + - variable: cpu + label: CPU + description: CPU limit for Navidrome. + schema: + type: string + default: "4000m" + required: true + - variable: memory + label: Memory + description: Memory limit for Navidrome. + schema: + type: string + default: "8Gi" + required: true diff --git a/library/ix-dev/community/navidrome/templates/NOTES.txt b/library/ix-dev/community/navidrome/templates/NOTES.txt new file mode 100644 index 0000000000..ba4e01146c --- /dev/null +++ b/library/ix-dev/community/navidrome/templates/NOTES.txt @@ -0,0 +1 @@ +{{ include "ix.v1.common.lib.chart.notes" $ }} diff --git a/library/ix-dev/community/navidrome/templates/_navidrome.tpl b/library/ix-dev/community/navidrome/templates/_navidrome.tpl new file mode 100644 index 0000000000..18b3b836ea --- /dev/null +++ b/library/ix-dev/community/navidrome/templates/_navidrome.tpl @@ -0,0 +1,51 @@ +{{- define "navidrome.workload" -}} +workload: + navidrome: + enabled: true + primary: true + type: Deployment + podSpec: + hostNetwork: {{ .Values.navidromeNetwork.hostNetwork }} + containers: + navidrome: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: {{ .Values.navidromeRunAs.user }} + runAsGroup: {{ .Values.navidromeRunAs.group }} + env: + ND_MUSICFOLDER: /music + ND_DATAFOLDER: /data + ND_PORT: {{ .Values.navidromeNetwork.webPort | quote }} + ND_UIWELCOMEMESSAGE: {{ .Values.navidromeConfig.uiWelcomeMessage }} + {{ with .Values.navidromeConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: true + type: http + port: "{{ .Values.navidromeNetwork.webPort }}" + path: /ping + readiness: + enabled: true + type: http + port: "{{ .Values.navidromeNetwork.webPort }}" + path: /ping + startup: + enabled: true + type: http + port: "{{ .Values.navidromeNetwork.webPort }}" + path: /ping + initContainers: + {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions" + "UID" .Values.navidromeRunAs.user + "GID" .Values.navidromeRunAs.group + "mode" "check" + "type" "init") | nindent 8 }} +{{- end -}} diff --git a/library/ix-dev/community/navidrome/templates/_persistence.tpl b/library/ix-dev/community/navidrome/templates/_persistence.tpl new file mode 100644 index 0000000000..4f000a2e1b --- /dev/null +++ b/library/ix-dev/community/navidrome/templates/_persistence.tpl @@ -0,0 +1,38 @@ +{{- define "navidrome.persistence" -}} +persistence: + data: + enabled: true + type: {{ .Values.navidromeStorage.data.type }} + datasetName: {{ .Values.navidromeStorage.data.datasetName | default "" }} + hostPath: {{ .Values.navidromeStorage.data.hostPath | default "" }} + targetSelector: + navidrome: + navidrome: + mountPath: /data + 01-permissions: + mountPath: /mnt/directories/data + music: + enabled: true + type: {{ .Values.navidromeStorage.music.type }} + datasetName: {{ .Values.navidromeStorage.music.datasetName | default "" }} + hostPath: {{ .Values.navidromeStorage.music.hostPath | default "" }} + targetSelector: + navidrome: + navidrome: + mountPath: /music + 01-permissions: + mountPath: /mnt/directories/music + {{- range $idx, $storage := .Values.navidromeStorage.additionalStorages }} + {{ printf "navidrome-%v" (int $idx) }}: + enabled: true + type: {{ $storage.type }} + datasetName: {{ $storage.datasetName | default "" }} + hostPath: {{ $storage.hostPath | default "" }} + targetSelector: + navidrome: + navidrome: + mountPath: {{ $storage.mountPath }} + 01-permissions: + mountPath: /mnt/directories{{ $storage.mountPath }} + {{- end }} +{{- end -}} diff --git a/library/ix-dev/community/navidrome/templates/_portal.tpl b/library/ix-dev/community/navidrome/templates/_portal.tpl new file mode 100644 index 0000000000..1b3a317dfb --- /dev/null +++ b/library/ix-dev/community/navidrome/templates/_portal.tpl @@ -0,0 +1,12 @@ +{{- define "navidrome.portal" -}} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: portal +data: + path: "/" + port: {{ .Values.navidromeNetwork.webPort | quote }} + protocol: http + host: $node_ip +{{- end -}} diff --git a/library/ix-dev/community/navidrome/templates/_service.tpl b/library/ix-dev/community/navidrome/templates/_service.tpl new file mode 100644 index 0000000000..06b239d97b --- /dev/null +++ b/library/ix-dev/community/navidrome/templates/_service.tpl @@ -0,0 +1,15 @@ +{{- define "navidrome.service" -}} +service: + navidrome: + enabled: true + primary: true + type: NodePort + targetSelector: navidrome + ports: + webui: + enabled: true + primary: true + port: {{ .Values.navidromeNetwork.webPort }} + nodePort: {{ .Values.navidromeNetwork.webPort }} + targetSelector: navidrome +{{- end -}} diff --git a/library/ix-dev/community/navidrome/templates/common.yaml b/library/ix-dev/community/navidrome/templates/common.yaml new file mode 100644 index 0000000000..f8b1cc2b79 --- /dev/null +++ b/library/ix-dev/community/navidrome/templates/common.yaml @@ -0,0 +1,11 @@ +{{- include "ix.v1.common.loader.init" . -}} + +{{/* Merge the templates with Values */}} +{{- $_ := mustMergeOverwrite .Values (include "navidrome.workload" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "navidrome.persistence" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "navidrome.service" $ | fromYaml) -}} + +{{/* Create the configmap for portal manually*/}} +{{- include "navidrome.portal" $ -}} + +{{- include "ix.v1.common.loader.apply" . -}} diff --git a/library/ix-dev/community/navidrome/upgrade_info.json b/library/ix-dev/community/navidrome/upgrade_info.json new file mode 100644 index 0000000000..767388094a --- /dev/null +++ b/library/ix-dev/community/navidrome/upgrade_info.json @@ -0,0 +1 @@ +{"filename": "values.yaml", "keys": ["image"]} diff --git a/library/ix-dev/community/navidrome/upgrade_strategy b/library/ix-dev/community/navidrome/upgrade_strategy new file mode 100755 index 0000000000..af685230a1 --- /dev/null +++ b/library/ix-dev/community/navidrome/upgrade_strategy @@ -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: 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/library/ix-dev/community/navidrome/values.yaml b/library/ix-dev/community/navidrome/values.yaml new file mode 100644 index 0000000000..ff520c8065 --- /dev/null +++ b/library/ix-dev/community/navidrome/values.yaml @@ -0,0 +1,30 @@ +image: + repository: deluan/navidrome + pullPolicy: IfNotPresent + tag: '0.49.3' + +resources: + limits: + cpu: 4000m + memory: 8Gi + +navidromeConfig: + uiWelcomeMessage: '' + additionalEnvs: [] + +navidromeNetwork: + webPort: 30043 + hostNetwork: false + +navidromeRunAs: + user: 568 + group: 568 + +navidromeStorage: + data: + type: ixVolume + datasetName: data + music: + type: ixVolume + datasetName: music + additionalStorages: []