job "nginx" {
datacenters = ["dc1"]
type = "service"
group "nginx" {
count = 1
task "nginx" {
driver = "docker"
config {
image = "nginx"
ports = ["http"]
volumes = [
"custom/default.conf:/etc/nginx/conf.d/default.conf",
]
}
template {
data = <
| Service Name | Traefik | Direct |
|---|---|---|
| {{.Name}} | {{.Name}}.service.dc1.consul | {{ if eq .Name "unifi" }}https{{else}}http{{end}}://{{.Name}}.service.dc1.consul:{{.Port}} |
Node Environment Information:
node_id: {{ env "node.unique.id" }}
datacenter: {{ env "NOMAD_DC" }}