2022-04-24 10:47:41 +00:00
|
|
|
job "traefik-local" {
|
|
|
|
datacenters = ["homelab"]
|
|
|
|
type = "service"
|
|
|
|
|
|
|
|
group "traefik-local" {
|
|
|
|
network {
|
|
|
|
mode = "host"
|
|
|
|
port "http" {
|
|
|
|
static = 80
|
|
|
|
}
|
|
|
|
port "https" {
|
|
|
|
static = 443
|
|
|
|
}
|
|
|
|
port "admin" {
|
|
|
|
static = 9080
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
task "server" {
|
|
|
|
driver = "docker"
|
|
|
|
service {
|
2022-04-24 13:23:26 +00:00
|
|
|
name = "traefik-local"
|
2022-04-24 10:47:41 +00:00
|
|
|
|
|
|
|
tags = ["traefik"]
|
|
|
|
port = "https"
|
|
|
|
}
|
|
|
|
|
|
|
|
service {
|
2022-04-24 13:23:26 +00:00
|
|
|
name = "traefi-local-admin"
|
2022-04-24 10:47:41 +00:00
|
|
|
port = "admin"
|
|
|
|
tags = [
|
|
|
|
"traefik.enable=true",
|
|
|
|
"traefik.http.routers.${NOMAD_JOB_NAME}_insecure.rule=Host(`${NOMAD_JOB_NAME}.ducamps.win`)",
|
|
|
|
"traefik.http.routers.${NOMAD_JOB_NAME}.tls.domains[0].sans=${NOMAD_JOB_NAME}.ducamps.win",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
config {
|
|
|
|
image = "traefik"
|
|
|
|
ports = [
|
|
|
|
"http",
|
|
|
|
"https",
|
|
|
|
"admin"
|
|
|
|
]
|
|
|
|
volumes =[
|
|
|
|
"local/traefik.toml:/etc/traefik/traefik.toml"
|
|
|
|
#"/mnt/diskstation/nomad/traefik/acme.json:acme.json"
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
# vault{
|
|
|
|
#}
|
|
|
|
env {
|
|
|
|
}
|
|
|
|
template{
|
|
|
|
data= <<EOH
|
|
|
|
[entryPoints]
|
|
|
|
[entryPoints.web]
|
|
|
|
address = ":80"
|
|
|
|
[entryPoints.websecure]
|
|
|
|
address = ":443"
|
|
|
|
[entryPoints.traefik]
|
|
|
|
address = ":9080"
|
|
|
|
[http.middlewares]
|
|
|
|
[http.middlewares.https-redirect.redirectscheme]
|
|
|
|
scheme = "https"
|
|
|
|
[providers.consulCatalog]
|
|
|
|
exposedByDefault = false
|
|
|
|
[providers.consulCatalog.endpoint]
|
|
|
|
address = "127.0.0.1:8500"
|
|
|
|
[log]
|
|
|
|
[api]
|
|
|
|
dashboard = true
|
|
|
|
insecure = true
|
|
|
|
[ping]
|
|
|
|
|
|
|
|
EOH
|
|
|
|
destination = "local/traefik.toml"
|
|
|
|
env = false
|
|
|
|
change_mode = "noop"
|
|
|
|
left_delimiter = "{{{"
|
|
|
|
right_delimiter = "}}}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|