Add rendered example

This commit is contained in:
Daniel Berteaud 2024-01-05 14:55:53 +01:00
parent b75f21b3fb
commit 98701ca33d
5 changed files with 171 additions and 0 deletions

0
example/.gitmodules vendored Normal file
View File

View File

@ -0,0 +1,3 @@
Kind = "service-defaults"
Name = "navidrome"
Protocol = "http"

View File

@ -0,0 +1,16 @@
Kind = "service-intentions"
Name = "navidrome"
Sources = [
{
Name = "traefik"
Permissions = [
{
Action = "allow"
HTTP {
PathPrefix = "/"
Methods = ["GET", "HEAD", "POST", "PUT", "DELETE"]
}
}
]
}
]

133
example/navidrome.nomad.hcl Normal file
View File

@ -0,0 +1,133 @@
job "navidrome" {
datacenters = ["dc1"]
group "navidrome" {
network {
mode = "bridge"
}
volume "music" {
type = "csi"
read_only = true
source = "music"
attachment_mode = "file-system"
access_mode = "multi-node-multi-writer"
}
volume "data" {
type = "csi"
source = "navidrome-data"
attachment_mode = "file-system"
access_mode = "single-node-writer"
}
service {
name = "navidrome"
port = 4533
connect {
sidecar_service {
}
sidecar_task {
resources {
cpu = 50
memory = 64
}
}
}
check {
name = "health"
type = "http"
path = "/ping"
expose = true
interval = "10s"
timeout = "3s"
check_restart {
limit = 20
grace = "20s"
}
}
# The music volume can be unavailable for several reason.
# One of them is if it's on a fuse volume and it starts getting "transport unavailable" errors
# In this case, the alloc should be restarted
check {
name = "music"
type = "script"
interval = "120s"
timeout = "7s"
task = "navidrome"
command = "sh"
args = [
"-c",
"ls /music/ > /dev/null"
]
check_restart {
limit = 5
grace = "30s"
}
}
tags = [
"traefik.enable=true",
"traefik.http.routers.navidrome.rule=Host(`navidrome.domain.tld`)",
"traefik.http.routers.navidrome.tls=true",
"traefik.http.routers.navidrome.entrypoints=https",
"traefik.http.middlewares.navidrome-app.redirectregex.regex=^(https://[^/]+)/?$",
"traefik.http.middlewares.navidrome-app.redirectregex.replacement=/app/",
"traefik.http.routers.navidrome.middlewares=navidrome-app,rate-limit-std@file,inflight-std@file,security-headers@file,hsts@file,compression@file,csp-relaxed@file"
]
}
task "navidrome" {
driver = "docker"
user = 4533
config {
image = "deluan/navidrome:0.50.2"
}
env {
ND_MUSICFOLDER = "/music"
ND_DATAFOLDER = "/data"
ND_BASEURL = ""
ND_ADDRESS = "127.0.0.1"
ND_REVERSEPROXYWHITELIST = "127.0.0.0/8"
LANG = "fr_FR.utf8"
ND_ENABLEGRAVATAR = "false"
ND_ENABLESHARING = "true"
ND_ENABLETRANSCODINGCONFIG = "true"
TZ = "Europe/Paris"
}
volume_mount {
volume = "music"
destination = "/music"
read_only = true
}
volume_mount {
volume = "data"
destination = "/data"
}
resources {
cpu = 200
memory = 512
}
}
}
}
# vim: syntax=hcl

19
example/prep.d/mv_conf.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
set -eu
if [ "navidrome" != "navidrome" ]; then
for DIR in vault consul nomad; do
if [ -d output/${DIR} ]; then
for FILE in $(find output/${DIR} -name "*navidrome*.hcl" -type f); do
NEW_FILE=$(echo "${FILE}" | sed -E "s/navidrome/navidrome/g")
mv "${FILE}" "${NEW_FILE}"
done
fi
done
fi