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 = <Local Services - HTTP/HTTPS

{{range services}} {{range $i, $s :=service .Name}} {{ if eq $i 0 }} {{end}} {{end}} {{end}}
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" }}

EOH destination = "local/data/index.html" change_mode = "noop" } resources { cpu = 100 # 100 MHz memory = 64 # 128 MB } service { name = "nginx" tags = ["nginx", "web", "urlprefix-/nginx", "backend"] port = "http" check { type = "tcp" interval = "10s" timeout = "2s" } } } network { port "http" { to = 8080 } // port "https" { // to = 443 // } } } }