job "traefik" { datacenters = ["dc1"] type = "service" priority = 100 constraint { attribute = "${node.class}" value = "ingress" } constraint { distinct_hosts = true } update { max_parallel = 1 # canary = 1 # auto_promote = true auto_revert = true } group "traefik" { count = 2 network { port "web" { static = 80 } port "websecure" { static = 443 } port "syslog" { static = 514 } port "gitssh" { static = 2222 } dns { servers = [ "192.168.2.101", "192.168.2.102", "192.168.2.30", ] } } ephemeral_disk { migrate = true sticky = true } service { name = "traefik" provider = "nomad" port = "web" check { type = "http" path = "/ping" port = "web" interval = "10s" timeout = "2s" } tags = [ "traefik.enable=true", "traefik.http.routers.traefik.entryPoints=websecure", "traefik.http.routers.traefik.service=api@internal", ] } task "traefik" { driver = "docker" meta = { "diun.sort_tags" = "semver" "diun.watch_repo" = true "diun.include_tags" = "^[0-9]+\\.[0-9]+$" } config { image = "traefik:2.10" ports = ["web", "websecure"] network_mode = "host" mount { type = "bind" target = "/etc/traefik" source = "local/config" } mount { type = "bind" target = "/etc/traefik/usersfile" source = "secrets/usersfile" } mount { type = "bind" target = "/etc/traefik/certs" source = "secrets/certs" } } template { # Avoid conflict with TOML lists [[ ]] and Go templates {{ }} left_delimiter = "<<" right_delimiter = ">>" data = <><< .base_hostname >><< end >>`)" [providers.nomad.endpoint] address = "http://127.0.0.1:4646" EOH destination = "${NOMAD_TASK_DIR}/config/traefik.toml" } template { data = <