traefik for all hosts - yeah to constraints
This commit is contained in:
82
_sys/traefik.hcl
Normal file
82
_sys/traefik.hcl
Normal file
@@ -0,0 +1,82 @@
|
||||
job "traefik" {
|
||||
region = "global"
|
||||
datacenters = ["nummer5"]
|
||||
type = "service"
|
||||
|
||||
group "traefik" {
|
||||
count = 5
|
||||
|
||||
constraint {
|
||||
operator = "distinct_hosts"
|
||||
value = "true"
|
||||
}
|
||||
network {
|
||||
port "http" {
|
||||
static = 80
|
||||
}
|
||||
|
||||
port "api" {
|
||||
static = 81
|
||||
}
|
||||
}
|
||||
|
||||
service {
|
||||
name = "traefik"
|
||||
|
||||
check {
|
||||
name = "alive"
|
||||
type = "tcp"
|
||||
port = "http"
|
||||
interval = "10s"
|
||||
timeout = "2s"
|
||||
}
|
||||
tags = [
|
||||
"traefik.enable=true",
|
||||
"traefik.http.routers.traefik.rule=Host(`traefik.service.consul`)",
|
||||
]
|
||||
}
|
||||
|
||||
task "traefik" {
|
||||
driver = "podman"
|
||||
|
||||
config {
|
||||
image = "docker.io/library/traefik:latest"
|
||||
network_mode = "host"
|
||||
|
||||
volumes = [
|
||||
"local/traefik.toml:/etc/traefik/traefik.toml",
|
||||
]
|
||||
}
|
||||
|
||||
template {
|
||||
data = <<EOF
|
||||
[entryPoints]
|
||||
[entryPoints.http]
|
||||
address = ":80"
|
||||
[entryPoints.traefik]
|
||||
address = ":81"
|
||||
|
||||
[api]
|
||||
dashboard = true
|
||||
insecure = true
|
||||
|
||||
# Enable Consul Catalog configuration backend.
|
||||
[providers.consulCatalog]
|
||||
prefix = "traefik"
|
||||
exposedByDefault = false
|
||||
|
||||
[providers.consulCatalog.endpoint]
|
||||
address = "127.0.0.1:8500"
|
||||
scheme = "http"
|
||||
EOF
|
||||
|
||||
destination = "local/traefik.toml"
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 100
|
||||
memory = 128
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user