-
-
Save lgfa29/25dbd35a5231491f20cd06ad49a2525f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
job "traefik" { | |
region = "global" | |
datacenters = ["dc1"] | |
type = "service" | |
group "traefik" { | |
count = 1 | |
network { | |
port "http" { | |
static = 8080 | |
} | |
port "api" { | |
static = 8081 | |
} | |
} | |
service { | |
name = "traefik" | |
check { | |
name = "alive" | |
type = "tcp" | |
port = "http" | |
interval = "10s" | |
timeout = "2s" | |
} | |
} | |
task "traefik" { | |
driver = "docker" | |
config { | |
image = "traefik:v2.2" | |
ports = ["api", "http"] | |
volumes = [ | |
"local/traefik.toml:/etc/traefik/traefik.toml", | |
] | |
} | |
template { | |
data = <<EOF | |
[entryPoints] | |
[entryPoints.http] | |
address = ":8080" | |
[entryPoints.traefik] | |
address = ":8081" | |
[api] | |
dashboard = true | |
insecure = true | |
[providers] | |
[providers.file] | |
directory = "/etc/traefik" | |
[http] | |
[http.routers] | |
[http.routers.http] | |
rule = "Path(`/myapp`)" | |
service = "demo-webapp" | |
[http.services] | |
[http.services.demo-webapp.loadBalancer] | |
{{ range service "demo-webapp" }} | |
[[http.services.demo-webapp.loadBalancer.servers]] | |
url = "http://host.docker.internal:{{ .Port }}/" | |
{{ end }} | |
EOF | |
destination = "local/traefik.toml" | |
} | |
resources { | |
cpu = 100 | |
memory = 128 | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment