NAS-122621 / 23.10 / Add navidrome to community train (#1291)

* navidrome initial commit

* update questions

* fix func name

* fix UI and some typos
This commit is contained in:
Stavros Kois
2023-06-27 21:44:56 +03:00
committed by GitHub
parent 56a05b9f75
commit 4a360ed4be
19 changed files with 542 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,8 @@
runAsContext:
- userName: navidrome
groupName: navidrome
gid: 568
uid: 568
description: Navidrome can run as any non-root user.
capabilities: []
hostMounts: []

View File

@@ -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.</br>
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.</br>
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.</br>
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.</br>
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

View File

@@ -0,0 +1 @@
{{ include "ix.v1.common.lib.chart.notes" $ }}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1 @@
{"filename": "values.yaml", "keys": ["image"]}

View File

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

View File

@@ -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: []