Hi all,
I was playing around with Traefik as reverse proxy for my Nomad cluster. I want to make use of Nomad its new service discovery functionalities as described here (Traefik Proxy Integrates with Hashicorp Nomad | Traefik Labs) to host my home-assistant container. So this setup is running without Consul (sorry, I could not select Nomad as tag only Consul)
The only problem is that I cannot get the Traefik routing to work. The Traefik task is defined as in the example
job "traefik" {
datacenters = ["dc1"]
type = "service"
group "traefik" {
count = 1
network {
port "http"{
static = 80
host_network = "wlan"
}
port "admin"{
static = 8080
host_network = "wlan"
}
}
service {
name = "traefik-http"
provider = "nomad"
port = "http"
}
task "server" {
driver = "docker"
config {
image = "traefik:2.8"
ports = ["admin", "http"]
args = [
"--api.dashboard=true",
"--api.insecure=true", ### For Test only, please do not use that in production
"--entrypoints.web.address=:${NOMAD_PORT_http}",
"--entrypoints.traefik.address=:${NOMAD_PORT_admin}",
"--providers.nomad=true",
"--providers.nomad.endpoint.address=http://192.168.178.XX:4646" ### IP to your nomad server
]
}
}
}
}
The home-assistant container is defined as follows
variable "homeassistant_password" {
type = string
}
job "home-assistant" {
datacenters = ["dc1"]
type = "service"
group "home-assistant" {
count = 1
network {
port "http" {
to = 8123
static = 8123
host_network = "wlan"
}
port "http-tailscale" {
to = 8123
static = 8123
host_network = "tailscale"
}
}
volume "home-assistant-config" {
type = "host"
read_only = false
source = "home-assistant-config"
}
task "home-assistant" {
driver = "docker"
volume_mount {
volume = "home-assistant-config"
destination = "/config"
read_only = false
}
config {
image = "ghcr.io/home-assistant/home-assistant:latest"
ports = ["http", "http-tailscale"]
}
template {
data = <<EOF
{{- range nomadService "postgres" }}
POSTGRES_URL=REDACTED{{- end }}
EOF
destination = "local/file.env"
env = true
}
service {
name = "home-assistant"
port = "http"
provider = "nomad"
tags = [
"traefik.enable=true",
"traefik.http.routers.http.rule=Path(`/ha`)",
]
}
}
}
}
The problem is however that I dont see the HTTP Router picking this up in the dashboard. When I use Host()
instead of Path()
I do see the HTTP Router picking it up, but without me being able to resolve it. Can some more experienced Traefik users maybe give me some pointers here?
Setup: intel nuc running arch linux.
Thanks!