diff --git a/services/service/service_template.nomad b/services/service/service_template.nomad index 2357a95..e557136 100644 --- a/services/service/service_template.nomad +++ b/services/service/service_template.nomad @@ -9,37 +9,34 @@ job "${name}" { mode = "bridge" %{ if service_port != null ~} port "main" { - %{ if ingress ~} + %{ if ingress } host_network = "loopback" - %{ endif ~} + %{~ endif } to = ${service_port} } - %{ endif ~} + %{ endif } } - %{ if length(group_meta) > 0 ~} + %{ if length(group_meta) > 0 } meta = { - %{ for k, v in group_meta ~} + %{ for k, v in group_meta } ${k} = ${jsonencode(v)} - %{ endfor ~} + %{ endfor } } - - %{ endif ~} - %{ if sticky_disk ~} + %{~ endif } + %{ if sticky_disk } ephemeral_disk { migrate = true sticky = true } - - %{ endif ~} - %{ for host_volume in host_volumes ~} + %{~ endif } + %{ for host_volume in host_volumes } volume "${host_volume.name}" { type = "host" read_only = ${host_volume.read_only} source = "${host_volume.name}" } - - %{ endfor ~} + %{ endfor } %{ if service_port != null ~} service { name = "${replace(name, "_", "-")}" @@ -86,8 +83,8 @@ job "${name}" { } } - %{ endif ~} - %{ if healthcheck_path != null ~} + %{~ endif } + %{ if healthcheck_path != null } check { type = "http" path = "${healthcheck_path}" @@ -104,7 +101,7 @@ job "${name}" { %{ endif ~} tags = [ - %{ if ingress ~} + %{ if ingress } "traefik.enable=true", "traefik.http.routers.${name}.entryPoints=websecure", %{ if try(ingress_rule, null) != null ~} @@ -112,8 +109,8 @@ job "${name}" { %{ endif ~} %{ for middleware in ingress_middlewares ~} "traefik.http.routers.${name}.middlewares=${middleware}", - %{ endfor ~} - %{ endif ~} + %{~ endfor } + %{~ endif } ] }