Need Help with Traefik and routing reddit / selfhosted ---------------------------------------------------------------------- twotwigz · 2023-12-07 15:43 Im trying to setup Traefik in a docker enviroment with Sonarr, Radarr, Prowlarr, Jellyseer, Jellyfin and NGINX. I have them all running on the network proxy which does exist. The part that is COMPLETLLY baffling me, is when i restart the container, or even just NGINX, services that where working start giving me a bad gateway when trying to go to their domain, if i restart NGINX the domain might resolve, but another will break, or sometimes I need to restart NGINX a couple times to get to a specific domain but a different one will break. Ive been proof reading and trying to figure out what is causing this, but my smooth brain doesnt understand whats causing this. Traefik Docker-compose.yml version: '3.5' services: traefik: image: traefik:latest container_name: traefik restart: unless-stopped security_opt: - no-new-privileges:true networks: proxy: ports: - 80:80 - 443:443 environment: - CF_API_EMAIL=MY_EMAIL - CF_DNS_API_TOKEN=MY_TOKEN # - CF_API_KEY=YOU_API_KEY volumes: - /etc/localtime:/etc/localtime:ro - /var/run/docker.sock:/var/run/docker.sock:ro - /home/user/traefik/data/traefik.yml:/traefik.yml:ro - /home/user/traefik/data/acme.json:/acme.json - /home/user/traefik/data/config.yml:/config.yml:ro - /home/user/traefik/logs:/var/log/traefik labels: - "traefik.enable=true" - "traefik.http.routers.traefik.entrypoints=http" - "traefik.http.routers.traefik.rule=Host(`traefik.domain.org`)" - "traefik.http.middlewares.traefik- auth.basicauth.users=USER:PASS - "traefik.http.middlewares.traefik-https- redirect.redirectscheme.scheme=https" - "traefik.http.middlewares.sslheader.headers.customrequesth eaders.X-Forwarded-Proto=https" - "traefik.http.routers.traefik.middlewares=traefik-https- redirect" - "traefik.http.routers.traefik-secure.entrypoints=https" - "traefik.http.routers.traefik- secure.rule=Host(`traefik.domain.org`)" - "traefik.http.routers.traefik-secure.middlewares=traefik- auth" - "traefik.http.routers.traefik-secure.tls=true" - "traefik.http.routers.traefik- secure.tls.certresolver=cloudflare" - "traefik.http.routers.traefik- secure.tls.domains[0].main=domain.org" - "traefik.http.routers.traefik- secure.tls.domains[0].sans=*.domain.org" - "traefik.http.routers.traefik-secure.service=api@internal" networks: proxy: name: proxy external: true Traefik config.yml http: # region routers routers: glados: entryPoints: - "https" rule: "Host(`glados.domain.org`)" middlewares: - default-headers - https-redirectscheme tls: {} service: glados pihole1: entryPoints: - "https" rule: "Host(`pihole1.domain.org`)" middlewares: - redirectregex-pihole - default-headers - addprefix-pihole - https-redirectscheme tls: {} service: pihole1 pihole2: entryPoints: - "https" rule: "Host(`pihole2.domain.org`)" middlewares: - redirectregex-pihole - default-headers - addprefix-pihole - https-redirectscheme tls: {} service: pihole2 idrac: entryPoints: - "https" rule: "Host(`idrac.domain.org`)" middlewares: - idrac - https-redirectscheme tls: {} service: idrac idrac-console: entryPoints: - "idrac" # REQUIRED for iDRAC virtual console: Create a new TCP entry point in traefik on port 5900 rule: "Host(`idrac.domain.org`)" middlewares: - idrac - https-redirectscheme tls: {} service: idrac-console jellyfin: entryPoints: - "https" rule: "Host(`jellyfin.domain.org`)" middlewares: - default-headers - https-redirectscheme tls: {} service: jellyfin jellyseerr: entryPoints: - "https" rule: "Host(`jellyseerr.domain.org`)" middlewares: - default-headers - https-redirectscheme tls: {} service: jellyseerr radarr: entryPoints: - "https" rule: "Host(`radarr.domain.org`)" middlewares: - default-headers - https-redirectscheme tls: {} service: radarr sonarr: entryPoints: - "https" rule: "Host(`sonarr.domain.org`)" middlewares: - default-headers - https-redirectscheme tls: {} service: sonarr prowlarr: entryPoints: - "https" rule: "Host(`prowlarr.domain.org`)" middlewares: - default-headers - https-redirectscheme tls: {} service: prowlarr truenas: entryPoints: - "https" rule: "Host(`truenas.domain.org`)" middlewares: - default-headers - https-redirectscheme tls: {} service: truenas # endregion # region services services: glados: loadBalancer: servers: - url: "https://192.168.1.5:8006" passHostHeader: true pihole1: loadBalancer: servers: - url: "http://192.168.1.3:80" passHostHeader: true pihole2: loadBalancer: servers: - url: "http://192.168.1.4:80" passHostHeader: true idrac: loadBalancer: servers: - url: "https://192.168.1.254" passHostHeader: true idrac-console: loadBalancer: servers: - url: "https://192.168.1.254:5900" passHostHeader: true jellyfin: loadBalancer: servers: - url: "https://192.168.1.10:8096" passHostHeader: true jellyseerr: loadBalancer: servers: - url: "https://192.168.1.10:5055" # Replace with the actual IP address and port of your Jellyseerr instance passHostHeader: true radarr: loadBalancer: servers: - url: "https://192.168.1.10:7878" # Replace with the actual IP address and port of your Radarr instance passHostHeader: true sonarr: loadBalancer: servers: - url: "https://192.168.1.10:8989" # Replace with the actual IP address and port of your Sonarr instance passHostHeader: true prowlarr: loadBalancer: servers: - url: "https://192.168.1.10:9696" # Replace with the actual IP address and port of your Prowlarr instance passHostHeader: true truenas: loadBalancer: servers: - url: "https://192.168.1.11" passHostHeader: true # endregion middlewares: addprefix-pihole: addPrefix: prefix: "/admin" https-redirectscheme: redirectScheme: scheme: https permanent: true redirectregex-pihole: redirectRegex: regex: /admin/$ replacement: "/" default-headers: headers: frameDeny: true browserXssFilter: true contentTypeNosniff: true forceSTSHeader: true stsIncludeSubdomains: true stsPreload: true stsSeconds: 15552000 customFrameOptionsValue: SAMEORIGIN customRequestHeaders: X-Forwarded-Proto: https idrac: headers: frameDeny: true browserXssFilter: true forceSTSHeader: true stsIncludeSubdomains: true stsSeconds: 15552000 customFrameOptionsValue: SAMEORIGIN customRequestHeaders: X-Forwarded-Proto: https Arr Stack docker-compose.yml version: '3.8' services: sonarr: image: linuxserver/sonarr container_name: sonarr environment: - PUID=1000 - PGID=1000 - TZ=America/New_York volumes: - "/mnt/Warehouse/Media/TV Shows:/TV Shows" - "/home/user/plunder/downloads:/downloads" restart: unless-stopped labels: - "traefik.enable=true" - "traefik.http.routers.sonarr.entrypoints=http" - "traefik.http.routers.sonarr.rule=Host(`sonarr.domain.org`)" - "traefik.http.middlewares.traefik- auth.basicauth.users=USER:PASSWORD" - "traefik.http.middlewares.sonarr-https- redirect.redirectscheme.scheme=https" - "traefik.http.routers.sonarr.middlewares=sonarr-https- redirect" - "traefik.http.routers.sonarr-secure.entrypoints=https" - "traefik.http.routers.sonarr- secure.rule=Host(`sonarr.domain.org`)" - "traefik.http.routers.sonarr-secure.tls=true" - "traefik.http.routers.sonarr-secure.service=sonarr" - "traefik.http.services.sonarr.loadbalancer.server.port=8989" - "traefik.docker.network=proxy" networks: - proxy security_opt: - no-new-privileges:true radarr: image: linuxserver/radarr container_name: radarr environment: - PUID=1000 - PGID=1000 - TZ=America/New_York volumes: - "/mnt/Warehouse/Media/Movies:/Movies" - "/home/user/plunder/downloads:/downloads" restart: unless-stopped labels: - "traefik.enable=true" - "traefik.http.routers.radarr.entrypoints=http" - "traefik.http.routers.radarr.rule=Host(`radarr.domain.org`)" - "traefik.http.middlewares.traefik- auth.basicauth.users=USER:PASSWORD" - "traefik.http.middlewares.radarr-https- redirect.redirectscheme.scheme=https" - "traefik.http.routers.radarr.middlewares=radarr-https- redirect" - "traefik.http.routers.radarr-secure.entrypoints=https" - "traefik.http.routers.radarr- secure.rule=Host(`radarr.domain.org`)" - "traefik.http.routers.radarr-secure.tls=true" - "traefik.http.routers.radarr-secure.service=radarr" - "traefik.http.services.radarr.loadbalancer.server.port=7878" - "traefik.docker.network=proxy" networks: - proxy security_opt: - no-new-privileges:true prowlarr: image: lscr.io/linuxserver/prowlarr:latest container_name: prowlarr environment: - PUID=1000 - PGID=1000 - TZ=America/New_York volumes: - "/home/user/plunder/config/prowlarr:/config" restart: unless-stopped labels: - "traefik.enable=true" - "traefik.http.routers.prowlarr.entrypoints=http" - "traefik.http.routers.prowlarr.rule=Host(`prowlarr.domain.org`)" - "traefik.http.middlewares.traefik- auth.basicauth.users=USER:PASSWORD" - "traefik.http.middlewares.prowlarr-https- redirect.redirectscheme.scheme=https" - "traefik.http.routers.prowlarr.middlewares=prowlarr-https- redirect" - "traefik.http.routers.prowlarr-secure.entrypoints=https" - "traefik.http.routers.prowlarr- secure.rule=Host(`prowlarr.domain.org`)" - "traefik.http.routers.prowlarr-secure.tls=true" - "traefik.http.routers.prowlarr-secure.service=prowlarr" - "traefik.http.services.prowlarr.loadbalancer.server.port=9696" - "traefik.docker.network=proxy" networks: - proxy security_opt: - no-new-privileges:true jellyseerr: image: fallenbagel/jellyseerr:latest container_name: jellyseerr environment: - LOG_LEVEL=debug - TZ=America/New_York volumes: - "/home/user/plunder/config/jellyseerr:/app/config" restart: unless-stopped labels: - "traefik.enable=true" - "traefik.http.routers.jellyseerr.entrypoints=http" - "traefik.http.routers.jellyseerr.rule=Host(`jellyseerr.domain.org`)" - "traefik.http.middlewares.jellyseerr-https- redirect.redirectscheme.scheme=https" - "traefik.http.routers.jellyseerr.middlewares=jellyseerr- https-redirect" - "traefik.http.routers.jellyseerr-secure.entrypoints=https" - "traefik.http.routers.jellyseerr- secure.rule=Host(`jellyseerr.domain.org`)" - "traefik.http.routers.jellyseerr-secure.tls=true" - "traefik.http.routers.jellyseerr- secure.service=jellyseerr" - "traefik.http.services.jellyseerr.loadbalancer.server.port=5055" - "traefik.docker.network=proxy" networks: - proxy security_opt: - no-new-privileges:true networks: proxy: external: true ​ ---------------------------------------------------------------------- twotwigz · 2023-12-07 15:45 Both pihole1 and pihole2, portainer and traefik never have issues resolving. and if you see something wrong, please elia5. Im not a programmer, and this is a new hobby. So please me gently if you see a glaring mistake. ---------------------------------------------------------------------- wplinge1 · 2023-12-07 15:53 The `proxy` network is only given a custom name in one of the yaml files, in the other I'd expect it to get an autogenerated name something like `dirname_proxy` and be a different thing. I can't quite get from there to the symptoms you're seeing but definitely something I'd probe with `docker network ls` and `docker network inspect` commands. ---------------------------------------------------------------------- twotwigz · 2023-12-07 15:58 Its not autogenerating a new network, everything is being put onto the network proxy, and ive verified this in portainer. The docker network inspect for proxy spits this out. [ { "Name": "proxy", "Id": "fbf27ae16eed0ea850d3499f26af2260e9fd0141e0dd8fd66fb7dc523197070a", "Created": "2023-12-06T17:06:49.519032725Z", "Scope": "local", "Driver": "bridge", "EnableIPv6": false, "IPAM": { "Driver": "default", "Options": {}, "Config": [ { "Subnet": "172.18.0.0/16", "Gateway": "172.18.0.1" } ] }, "Internal": false, "Attachable": false, "Ingress": false, "ConfigFrom": { "Network": "" }, "ConfigOnly": false, "Containers": { "1c37211cc09773c26ebc1daf15c07cd3a3ba7b169e9f7bf3a36bdf85cf3020bf": { "Name": "prowlarr", "EndpointID": "46bf6bb54c4d676f6a87433913bedb39e3369bc69b68abfaa6bccf2821789e7f", "MacAddress": "02:42:ac:12:00:07", "IPv4Address": "172.18.0.7/16", "IPv6Address": "" }, "57a24de2d5f1d2fe745bacfdc48424f6a5e6effbce7eebab68901bbc548748fb": { "Name": "nginx", "EndpointID": "072134e6d6e3775e1fbc655ffad27f6cf67b248456defcbfc566c6dbc4fd9e0f", "MacAddress": "02:42:ac:12:00:09", "IPv4Address": "172.18.0.9/16", "IPv6Address": "" }, "59028c2578ea7427eecadd3626a62c3e30cf045cf953db8603a552e78939891f": { "Name": "jellyfin", "EndpointID": "88ed0dfae1b137b1ad0f03ab7d7d7117f4c231442a0fb76789ac5f61980b8afb", "MacAddress": "02:42:ac:12:00:08", "IPv4Address": "172.18.0.8/16", "IPv6Address": "" }, "6576730a899fde79d4674521e8bc7705a591c986728cb23ab3c109f03727043d": { "Name": "traefik", "EndpointID": "84a700d87f0b0a10bf4c103a659c8e58c85020f6de54488e6acc3e68d6b359d8", "MacAddress": "02:42:ac:12:00:03", "IPv4Address": "172.18.0.3/16", "IPv6Address": "" }, "98bff1e79fc8338a8c228efd568ef7c47536139f902413d997c8200111c3159f": { "Name": "sonarr", "EndpointID": "b229b781836f4fa0a682500dd1b7670f80b5afd02d0b21bb9e7d136716710af6", "MacAddress": "02:42:ac:12:00:05", "IPv4Address": "172.18.0.5/16", "IPv6Address": "" }, "a14d01cee41d4cac8c80c4256abc4613ddec20d02c19633da8f1dfc23110cdbc": { "Name": "jellyseerr", "EndpointID": "788179e2e45d62b28b99e8441327d1af8c4ef6ab3d1e00f2b30635c0d400cae6", "MacAddress": "02:42:ac:12:00:04", "IPv4Address": "172.18.0.4/16", "IPv6Address": "" }, "ac39a7e6f5a6c58cc4fd1bff4a6867cd0d8a83fce1679d54ab9dd5ac83f91c84": { "Name": "radarr", "EndpointID": "3db9096ebdabe3560e0233edd955f4a2d60b06dbafd96d35dc85e6340e16a85c", "MacAddress": "02:42:ac:12:00:06", "IPv4Address": "172.18.0.6/16", "IPv6Address": "" }, "f63c4903eb211953ba69a75581ec54e7dc919e0afdcf0486902bd312ed0178d7": { "Name": "portainer", "EndpointID": "2c6e5fb2999d493beac6f032b1552c0b549fd308e14b10ec8abc1640d5c087c7", "MacAddress": "02:42:ac:12:00:02", "IPv4Address": "172.18.0.2/16", "IPv6Address": "" } }, "Options": {}, "Labels": {} } ] ---------------------------------------------------------------------- thekrautboy · 2023-12-07 16:53 --> /r/Traefik ---------------------------------------------------------------------- Vapourium · 2023-12-07 17:20 It's not gonna autogenerate a new network if you specify as external, have you manually created one?