Traefik + Docker + ZNC

Original post on reddit:

I want to set up a ZNC container to keep me logged in to all my IRC channels and I can remotely connect from other devices.

As far as I can tell, ZNC requires TCP connections to actually do the message protocol. I don't care about accessing the dashboard remotely, so I shouldn't need HTTP/S theoretically.

Here is the relevant section of my docker-compose file:

version: '3'
services:

   traefik:
      image: "traefik:v2.1"
      container_name: "traefik"
      command:
         - "--log.level=DEBUG"
         - "--api.insecure=true"
         - "--providers.docker=true"
         - "--providers.docker.exposedbydefault=false"
         - "--entrypoints.web.address=:80"
         - "--entrypoints.websecure.address=:443"
         - "--entrypoints.irc.address=:6501"
         - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
         - "--certificatesresolvers.mytlschallenge.acme.email=me@mydomain.com"
         - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
      ports:
         - "80:80"
         - "6969:8080" # Admin dashboard
         - "443:443"
         - "6501:6501"
      volumes:
         - "/var/run/docker.sock:/var/run/docker.sock:ro"
         - "$HOME/Data/Programs/Docker/TraefikV2/letsencrypt:/letsencrypt"
      networks:
         - traefik
      restart: unless-stopped
  znc:
    image: linuxserver/znc
    container_name: znc_test
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Los_Angeles
    volumes:
      - /home/me/Data/Programs/Docker/ZNC/config/:/config
    ports:
      - 6501:6501
      - 6697:6697
      - 7894:7894
    labels:
      - "traefik.enable=true"
      - "traefik.tcp.routers.znc.rule=HostSNI(`irc.mydomain.com`)"
      - "traefik.tcp.routers.znc.entrypoints=irc"
      - "traefik.tcp.routers.znc.service=znc"
      - "traefik.tcp.services.znc.loadbalancer.server.port=6501" 
    networks:
      - "traefik"

networks:
  traefik:
    external: true

I was told to create a separate entrypoint for IRC traffic, which I did on port 6501. I told Traefik to load route ZNC traffic through that entrypoint. I told ZNC to listen on its own port 6501. something is wrong though. Here are some shots of my Traefik dashboard.

Here you can see the entrypoint is IRC on port 6501. I was warned against using SNI with ZNC and IRC in general, but Traefik gives me an error about "unknown rules" if I remove the SNI bit.


Is is the server status that is the issue here? I'm assuming 192.168.32.2 is a docker network address? I am given no error message so I have no clue what's actually going wrong.

ZNC itself seems to be working ok. I can point an IRC client at the local IP and connect to it fine, and it remembers all my channels and stuff. But when I try to connect to it from the outside internet, my clients all just hang and fail to connect.

Hello Raijin.

Looks like traefik don`t connect to container network.
Please enable log and debug to see more.
Also may be you need:

command: 
.... 
   - "--providers.docker.network=traefik"
...   
   - "--log.level=DEBUG"
  - "--log=true"
  - "--log.filepath=/var/log/traefik.log"
  - "--accesslog=true"
  - "--accesslog.filepath=/var/log/traefik_access.log"