83 lines
1.9 KiB
HCL
83 lines
1.9 KiB
HCL
job "[[ .instance ]]" {
|
|
|
|
[[ template "common/job_start" . ]]
|
|
|
|
group "miniflux" {
|
|
[[- $c := merge .miniflux . ]]
|
|
[[ template "common/group_start" $c ]]
|
|
|
|
network {
|
|
mode = "bridge"
|
|
[[- if conv.ToBool .prometheus.enabled ]]
|
|
port "metrics" {}
|
|
[[- end ]]
|
|
}
|
|
|
|
service {
|
|
name = "[[ .instance ]][[ .consul.suffix ]]"
|
|
port = 8085
|
|
|
|
[[ template "common/service_meta" $c ]]
|
|
[[ template "common/connect" $c ]]
|
|
|
|
check {
|
|
type = "http"
|
|
path = "/healthcheck"
|
|
expose = true
|
|
interval = "[[ $c.consul.check.interval ]]"
|
|
timeout = "[[ $c.consul.check.timeout ]]"
|
|
|
|
check_restart {
|
|
limit = 20
|
|
grace = "20s"
|
|
}
|
|
}
|
|
|
|
tags = [
|
|
[[ template "common/traefik_tags" $c ]]
|
|
]
|
|
}
|
|
|
|
[[ template "common/task.metrics_proxy" $c ]]
|
|
[[ template "common/task.wait_for" $c ]]
|
|
[[ template "common/task.pgpooler" $c ]]
|
|
|
|
task "miniflux" {
|
|
driver = "[[ $c.nomad.driver ]]"
|
|
|
|
config {
|
|
[[ template "common/image" $c ]]
|
|
pids_limit = 100
|
|
}
|
|
|
|
[[ template "common/vault.policies" $c ]]
|
|
|
|
env {
|
|
LISTEN_ADDR = "127.0.0.1:8085"
|
|
BASE_URL = "[[ .miniflux.public_url ]]"
|
|
[[- if conv.ToBool $c.prometheus.enabled ]]
|
|
METRICS_COLLECTOR = 1
|
|
[[- end ]]
|
|
}
|
|
|
|
[[ template "common/file_env" $c ]]
|
|
|
|
template {
|
|
data =<<_EOT
|
|
DATABASE_URL=postgresql://
|
|
[[- if ne $c.postgres.pooler.engine "none" -]]
|
|
[[ .instance ]]:{{ env "NOMAD_ALLOC_ID" }}@127.0.0.1:[[ $c.postgres.pooler.port ]]/[[ $c.postgres.database ]]?sslmode=disable
|
|
[[- else -]]
|
|
[[ $c.postgres.user ]]:[[ $c.postgres.password | regexp.Replace "\\.Data\\.password" "urlquery .Data.password" ]]@[[ $c.postgres.host ]]:[[ $c.postgres.port ]]/[[ $c.postgres.database ]]?sslmode=disable
|
|
[[- end ]]
|
|
_EOT
|
|
destination = "secrets/.db.env"
|
|
perms = 400
|
|
env = true
|
|
}
|
|
|
|
[[ template "common/resources" $c ]]
|
|
}
|
|
}
|
|
}
|