miniflux/miniflux.nomad.hcl

93 lines
2.6 KiB
HCL

[[- $c := merge .miniflux . -]]
job [[ .instance | toJSON ]] {
[[ template "common/job_start" $c ]]
group "miniflux" {
count = [[ .miniflux.count ]]
network {
mode = "bridge"
[[- if $c.prometheus.enabled ]]
port "metrics" {}
[[- end ]]
}
ephemeral_disk {
size = 101
}
service {
name = "[[ .instance ]][[ .consul.suffix ]]"
port = 8085
[[ template "common/prometheus_meta" $c ]]
[[ template "common/connect" $c ]]
check {
type = "http"
path = "/healthcheck"
expose = true
interval = "10s"
timeout = "3s"
check_restart {
limit = 20
grace = "20s"
}
}
tags = [
"[[ $c.traefik.instance ]].enable=true",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].rule=Host(`[[ (urlParse .miniflux.public_url).Hostname ]]`)
[[- if not (regexp.Match "^/?$" (urlParse .miniflux.public_url).Path) ]] && PathPrefix(`[[ (urlParse .miniflux.public_url).Path ]]`)[[ end ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].entrypoints=[[ join $c.traefik.entrypoints "," ]]",
[[- if not (regexp.Match "^/?$" (urlParse .miniflux.public_url).Path) ]]
"[[ $c.traefik.instance ]].http.middlewares.[[ .instance ]][[ .consul.suffix ]]-prefix.stripprefix.prefixes=[[ (urlParse .miniflux.public_url).Path ]]",
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ .instance ]][[ .consul.suffix ]]-prefix,[[ template "common/traefik_middlewares" $c.traefik ]]",
[[- else ]]
"[[ $c.traefik.instance ]].http.routers.[[ .instance ]][[ .consul.suffix ]].middlewares=[[ template "common/traefik_middlewares" $c.traefik ]]",
[[- end ]]
]
}
[[- if $c.prometheus.enabled ]]
[[ template "common/task.metrics_proxy" $c ]]
[[- end ]]
[[ template "common/task.wait_for" $c ]]
task "miniflux" {
driver = [[ $c.nomad.driver | toJSON ]]
config {
image = [[ .miniflux.image | toJSON ]]
pids_limit = 100
readonly_rootfs = true
}
vault {
policies = ["[[ .instance ]][[ .consul.suffix ]]"]
env = false
disable_file = true
}
env {
LISTEN_ADDR = "127.0.0.1:8085"
BASE_URL = [[ .miniflux.public_url | toJSON ]]
[[- if $c.prometheus.enabled ]]
METRICS_COLLECTOR = 1
[[- end ]]
[[ template "common/proxy_env" $c ]]
}
[[ template "common/file_env" $c.env ]]
[[ template "common/resources" .miniflux.resources ]]
}
}
}