I've been trying for a few days to make traefik work with homeassistant, but I can't.
I don't know if the problem is with traefik or homeassistant, so I'll start with making sure traefik is set up correctly.
Here's my setup: home wifi (no tls/https required), with a raspberry pi 4 (reserved ip 192.168.2.95) running ubuntu 20.04 and docker. I would like to access my containers via 192.168.2.95/servicename on any browser connected to the home wifi network. So I think traefik is the right tool.
I created an internal network with
docker network create pi and I have a single docker-compose file for traefik and homeassistant (which I will populate with other services in the future).
I have found tons of examples of traefik.toml and docker-compose.yml files with traefik and other services, but none has helped. Here is my current configuration:
[entryPoints] [entryPoints.web] address = ":80" [api] dashboard = true insecure = true [providers.docker] watch = true network = "web" # should this be "pi"? exposedByDefault = false
version: '3.4' services: traefik: image: 'traefik:2.3' container_name: 'traefik' restart: 'unless-stopped' ports: - '80:80' - '8080:8080' volumes: - /var/run/docker.sock:/var/run/docker.sock:ro - /home/ubuntu/traefik/traefik.toml:/etc/traefik/traefik.toml networks: - pi homeassistant: container_name: homeassistant image: homeassistant/raspberrypi4-homeassistant:stable volumes: - /home/ubuntu/homeassistant/config:/config - /etc/localtime:/etc/localtime:ro restart: unless-stopped labels: # do I need a Host rule? do I need middleware to edit the request? - 'traefik.enable=true' - 'traefik.http.routers.homeassistant.rule=PathPrefix(`/homeassistant`)' - 'traefik.http.services.homeassistant.loadbalancer.server.port=8123' networks: - pi networks: pi: external: true
When I navigate to 192.168.2.95/homeassistant the browser gives me a 404: Not Found error. I can access the traefik dashboard at 192.168.2.95:8080, but that's about it. What am I missing?