This commit is contained in:
Daniel Berteaud 2023-12-21 23:00:10 +01:00
parent fc6dd54ff7
commit b75f21b3fb
5 changed files with 25 additions and 25 deletions

View File

@ -1,3 +1,3 @@
Kind = "service-defaults"
Name = "[[ .navidrome.instance ]][[ .consul.suffix ]]"
Name = "[[ .instance ]][[ .consul.suffix ]]"
Protocol = "http"

View File

@ -1,9 +1,8 @@
[[- $c := merge .navidrome . -]]
Kind = "service-intentions"
Name = "[[ $c.instance ]][[ $c.consul.suffix ]]"
Name = "[[ .instance ]][[ .consul.suffix ]]"
Sources = [
{
Name = "[[ $c.traefik.instance ]]"
Name = "[[ (merge .navidrome .).traefik.instance ]]"
Permissions = [
{
Action = "allow"

View File

@ -1,8 +1,8 @@
[[ $c := merge .navidrome . -]]
job [[ $c.instance | toJSON ]] {
job [[ .instance | toJSON ]] {
[[- template "common/job_start.tpl" $c ]]
[[- template "common/job_start" $c ]]
group "navidrome" {
@ -44,12 +44,12 @@ job [[ $c.instance | toJSON ]] {
[[- end ]]
service {
name = "[[ $c.instance ]][[ .consul.suffix ]]"
name = "[[ .instance ]][[ .consul.suffix ]]"
port = 4533
[[ template "common/prometheus_meta.tpl" $c ]]
[[ template "common/prometheus_meta" $c ]]
[[ template "common/connect.tpl" $c ]]
[[ template "common/connect" $c ]]
check {
name = "health"
@ -87,17 +87,17 @@ job [[ $c.instance | toJSON ]] {
tags = [
"[[ $c.traefik.instance ]].enable=true",
"[[ $c.traefik.instance ]].http.routers.[[ $c.instance ]][[ .consul.suffix ]].rule=Host(`[[ (urlParse $c.public_url).Hostname ]]`)",
"[[ $c.traefik.instance ]].http.routers.[[ $c.instance ]][[ .consul.suffix ]].tls=true",
"[[ $c.traefik.instance ]].http.routers.[[ $c.instance ]][[ .consul.suffix ]].entrypoints=[[ join $c.traefik.entrypoints "," ]]",
"[[ $c.traefik.instance ]].http.middlewares.[[ $c.instance ]]-app[[ .consul.suffix ]].redirectregex.regex=^(https://[^/]+)/?$",
"[[ $c.traefik.instance ]].http.middlewares.[[ $c.instance ]]-app[[ .consul.suffix ]].redirectregex.replacement=/app/",
"[[ $c.traefik.instance ]].http.routers.[[ $c.instance ]][[ .consul.suffix ]].middlewares=[[ $c.instance ]]-app[[ .consul.suffix ]],[[ template "common/traefik_middlewares.tpl" $c.traefik ]]"
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].rule=Host(`[[ (urlParse $c.public_url).Hostname ]]`)",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].tls=true",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].entrypoints=[[ join $c.traefik.entrypoints "," ]]",
"[[ $c.traefik.instance ]].http.middlewares.[[ .instance ]]-app[[ .consul.suffix ]].redirectregex.regex=^(https://[^/]+)/?$",
"[[ $c.traefik.instance ]].http.middlewares.[[ .instance ]]-app[[ .consul.suffix ]].redirectregex.replacement=/app/",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ .instance ]]-app[[ .consul.suffix ]],[[ template "common/traefik_middlewares" $c.traefik ]]"
]
}
[[- if $c.prometheus.enabled ]]
[[- template "common/task.metrics_proxy.tpl" $c ]]
[[- template "common/task.metrics_proxy" $c ]]
[[- end ]]
task "navidrome" {
@ -117,8 +117,8 @@ job [[ $c.instance | toJSON ]] {
[[- if and $c.prometheus.enabled (not has $c.env "ND_PROMETHEUS_ENABLED") ]]
ND_PROMETHEUS_ENABLED = "true"
[[- end ]]
[[- template "common/proxy_env.tpl" $c ]]
[[- template "common/env.tpl" $c.env -]]
[[- template "common/proxy_env" $c ]]
[[- template "common/env" $c.env -]]
}
volume_mount {
@ -132,7 +132,7 @@ job [[ $c.instance | toJSON ]] {
destination = "/data"
}
[[ template "common/resources.tpl" $c.resources ]]
[[ template "common/resources" $c.resources ]]
}
[[- if and .navidrome.backup.enabled (not (eq .navidrome.backup.cron "")) ]]
@ -174,7 +174,7 @@ _EOT
volume = "backup"
destination = "/backup"
}
[[ template "common/resources.tpl" .navidrome.backup.resources ]]
[[ template "common/resources" .navidrome.backup.resources ]]
}
[[- end ]]
}

View File

@ -1 +1 @@
[[ template "common/mv_conf.sh.tpl" dict "ctx" . "services" (dict "navidrome" .navidrome.instance) ]]
[[ template "common/mv_conf.sh" dict "ctx" . "services" (dict "navidrome" .instance) ]]

View File

@ -1,8 +1,9 @@
---
# Name of the Nomad job
instance: navidrome
navidrome:
# Name of the Nomad job
instance: navidrome
# The Docker image to use
image: deluan/navidrome:0.50.2
@ -33,10 +34,10 @@ navidrome:
source: music
navidrome:
type: csi
source: '[[ .navidrome.instance ]]-data'
source: '[[ .instance ]]-data'
backup:
type: csi
source: '[[ .navidrome.instance ]]-backup'
source: '[[ .instance ]]-backup'
# Optional env vars to pass to the container
env: