Use new traefik_tags template

This commit is contained in:
Daniel Berteaud 2024-01-26 23:51:31 +01:00
parent 18bb99d0d0
commit ec49bfc004
2 changed files with 14 additions and 10 deletions

View File

@ -36,6 +36,17 @@ job "paperless" {
}
}
sidecar_task {
config {
args = [
"-c",
"${NOMAD_SECRETS_DIR}/envoy_bootstrap.json",
"-l",
"${meta.connect.log_level}",
"--concurrency",
"${meta.connect.proxy_concurrency}",
"--disable-hot-restart"
]
}
resources {
cpu = 50
@ -48,10 +59,12 @@ job "paperless" {
tags = [
"traefik.enable=true",
"traefik.http.routers.paperless.rule=Host(`paperless.example.org`)",
"traefik.http.routers.paperless.entrypoints=https",
"traefik.http.routers.paperless.middlewares=rate-limit-std@file,inflight-std@file,security-headers@file,hsts@file",
]
}

View File

@ -37,16 +37,7 @@ job "[[ .instance ]]" {
[[ $c = merge .paperless.webserver .paperless . ]]
tags = [
"[[ $c.traefik.instance ]].enable=[[ if $c.traefik.enabled ]]true[[ else ]]false[[ end ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].rule=Host(`[[ (urlParse $c.public_url).Hostname ]]`)
[[- if not (regexp.Match "^/?$" (urlParse $c.public_url).Path) ]] && PathPrefix(`[[ (urlParse $c.public_url).Path ]]`)[[ end ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].entrypoints=[[ join $c.traefik.entrypoints "," ]]",
[[- if not (regexp.Match "^/?$" (urlParse $c.public_url).Path) ]]
"[[ $c.traefik.instance ]].http.middlewares.[[ .instance ]][[ .consul.suffix ]]-prefix.stripprefix.prefixes=[[ (urlParse .paperless.public_url).Path ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ .instance ]][[ $c.consul.suffix ]]-prefix,[[ template "common/traefik_middlewares" $c ]]",
[[- else ]]
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ template "common/traefik_middlewares" $c ]]",
[[- end ]]
[[ template "common/traefik_tags" $c ]]
]
}