job "[[ .instance ]]" { [[- $c := merge .miniflux . ]] [[ 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/service_meta" $c ]] [[ template "common/connect" $c ]] check { type = "http" path = "/healthcheck" expose = true interval = "10s" timeout = "3s" 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 { image = "[[ .miniflux.image ]]" pids_limit = 100 readonly_rootfs = true } [[ template "common/vault.policies" $c ]] env { LISTEN_ADDR = "127.0.0.1:8085" BASE_URL = "[[ .miniflux.public_url ]]" [[- if $c.prometheus.enabled ]] METRICS_COLLECTOR = 1 [[- end ]] } 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/file_env" $c ]] [[ template "common/resources" $c ]] } } }