From fc518df1c1a5d68fc8c05ed65b70a386a043b198 Mon Sep 17 00:00:00 2001 From: Quentin Date: Mon, 28 Dec 2020 11:02:33 +0100 Subject: [PATCH] Migrate Traefik --- app/deployment/traefik.hcl | 43 ++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/app/deployment/traefik.hcl b/app/deployment/traefik.hcl index 641187f..d0dc129 100644 --- a/app/deployment/traefik.hcl +++ b/app/deployment/traefik.hcl @@ -4,6 +4,13 @@ job "frontend" { priority = 80 group "traefik" { + + network { + port "http_port" { static = 80 } + port "https_port" { static = 443 } + port "admin_port" { static = 8082 } + } + task "server" { driver = "docker" @@ -14,21 +21,36 @@ job "frontend" { volumes = [ "secrets/traefik.toml:/etc/traefik/traefik.toml", ] + ports = [ "http_port", "https_port", "admin_port" ] } resources { memory = 265 } + template { + data = file("../config/configuration/traefik/traefik.toml") + destination = "secrets/traefik.toml" + } + service { - tags = [ - "https", - "frontend", - "(diplonat (tcp_port 80 443))" - ] - port = 443 - address_mode = "driver" - name = "traefik" + name = "traefik-http" + port = "http_port" + tags = [ "(diplonat (tcp_port 80))" ] + address_mode = "host" + } + + service { + 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 { type = "http" protocol = "http" @@ -44,11 +66,6 @@ job "frontend" { } } } - - template { - data = "{{ key \"configuration/traefik/traefik.toml\" }}" - destination = "secrets/traefik.toml" - } } } }