Migrate Traefik

This commit is contained in:
Quentin 2020-12-28 11:02:33 +01:00
parent a2f8e11d06
commit fc518df1c1

View file

@ -4,6 +4,13 @@ job "frontend" {
priority = 80 priority = 80
group "traefik" { group "traefik" {
network {
port "http_port" { static = 80 }
port "https_port" { static = 443 }
port "admin_port" { static = 8082 }
}
task "server" { task "server" {
driver = "docker" driver = "docker"
@ -14,21 +21,36 @@ job "frontend" {
volumes = [ volumes = [
"secrets/traefik.toml:/etc/traefik/traefik.toml", "secrets/traefik.toml:/etc/traefik/traefik.toml",
] ]
ports = [ "http_port", "https_port", "admin_port" ]
} }
resources { resources {
memory = 265 memory = 265
} }
template {
data = file("../config/configuration/traefik/traefik.toml")
destination = "secrets/traefik.toml"
}
service { service {
tags = [ name = "traefik-http"
"https", port = "http_port"
"frontend", tags = [ "(diplonat (tcp_port 80))" ]
"(diplonat (tcp_port 80 443))" address_mode = "host"
] }
port = 443
address_mode = "driver" service {
name = "traefik" name = "traefik-https"
port = "https_port"
tags = [ "(diplonat (tcp_port 443))" ]
address_mode = "host"
}
service {
name = "traefik-admin"
port = "admin_port"
address_mode = "host"
check { check {
type = "http" type = "http"
protocol = "http" protocol = "http"
@ -44,11 +66,6 @@ job "frontend" {
} }
} }
} }
template {
data = "{{ key \"configuration/traefik/traefik.toml\" }}"
destination = "secrets/traefik.toml"
}
} }
} }
} }