Tcp Router not working properly for Teamspeak

Hi,

I want to run teamspeak behind docker. Teamspeak needs a tcp connection on Port 30033 for file transfers. I can connect to the server fine, and speaking works, but file transfers don't work. Sometimes teamspeak gives me an error, sometimes teamspeak says it's fine but the files are always emtpy (0 bytes). If I don't route this ports over traefik but with

    ports:
      - "30033:30033"
      - "10011:10011"

directly into the teamspeak container it works fine. So the problem is probably somewhere around traefik, but the dashboard says everything is fine. Does anybody have an Idea?

Traefik Dashboard


Teamspeak docker-compose.yml with Traefik
version: '3.1'
services:
  teamspeak:
    image: teamspeak
    restart: unless-stopped
    environment:
      - TS3SERVER_LICENSE=accept
      - TS3SERVER_DB_PLUGIN=ts3db_mariadb
      - TS3SERVER_DB_SQLCREATEPATH=create_mariadb
      - TS3SERVER_DB_HOST=teamspeak_db
      - TS3SERVER_DB_USER=teamspeak
      - TS3SERVER_DB_PASSWORD=$DB_PASSWORD
      - TS3SERVER_DB_NAME=teamspeakdb
      - TS3SERVER_DB_WAITUNTILREADY=30
    labels:
      - "traefik.enable=true"
      # Port 30033
      - "traefik.tcp.routers.teamspeakft.entrypoints=p30033"
      - "traefik.tcp.routers.teamspeakft.rule=HostSNI(`*`)"
      #Port 10011
      - "traefik.tcp.routers.teamspeak.entrypoints=p10011"
      - "traefik.tcp.routers.teamspeak.rule=HostSNI(`*`)"
      # Port 9987
      - "traefik.udp.routers.teamspeakudp.entrypoints=p9987"
    volumes:
      - ./teamspeak:/var/ts3server
    depends_on:
      - teamspeak_db
    networks:
      - traefik
      - default

  teamspeak_db:
    image: mariadb
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD
      - MYSQL_PASSWORD=$DB_PASSWORD
      - MYSQL_DATABASE=teamspeakdb
      - MYSQL_USER=teamspeak
    volumes:
      - ./db:/var/lib/mysql/
networks:
  traefik:
    name: traefik_network
    external: true
traefik.yml
log:
  level: DEBUG
accessLog: {}
providers:
  docker:
    exposedByDefault: false
    network: traefik_network
entryPoints:
  web:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https
  websecure:
    address: ":443"
    http:
      tls:
        certResolver: letsencrypt
  p30033:
    address: ":30033"
  p9987:
    address: ":9987/udp"
  p10011:
    address: ":10011"
certificatesResolvers:
  letsencrypt:
    acme:
      storage: /data/acme.json
      email: xxxxx
      httpchallenge:
        entrypoint: web
api:
  dashboard: true
  insecure: true
traefik docker-compose.yml
version: "3.3"

services:

  traefik:
    image: docker.io/traefik:latest
    ports:
      - "80:80"
      - "443:443"
      - "9987:9987/udp"
      - "10011:10011"
      - "30033:30033"
      - "127.0.0.1:8080:8080"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "./data:/data"
      - "./traefik.yml:/etc/traefik/traefik.yml:ro"
    restart: unless-stopped
networks:
  default:
    name: traefik_network

I would use a dedicated Docker network, see simple Traefik example.

What protocol is Teamspeak using? Do you need to enable TLS? What about the UDP port?

It just says TCP: https://support.teamspeak.com/hc/en-us/articles/360002712257-Which-ports-does-the-TeamSpeak-3-server-use-

The UDP-Port is the one responsible for voice communication.

For the teamspeak service I would add and assign services for each router with the appropriate loadbalancer.server.port. (Make sure to use .tcp.)

version: "3"
services:
  my-container:
    # ...
    labels:
      - traefik.http.routers.www-router.rule=Host(`example-a.com`)
      - traefik.http.routers.www-router.service=www-service
      - traefik.http.services.www-service.loadbalancer.server.port=8000
      - traefik.http.routers.admin-router.rule=Host(`example-b.com`)
      - traefik.http.routers.admin-router.service=admin-service
      - traefik.http.services.admin-service.loadbalancer.server.port=9000

Docs

1 Like

Thanks that solves it! Now the filetransfer is working.

And if I read the docs it also becomes clear why:

By default, Traefik uses the first exposed port of a container.

Setting the label traefik.http.services.xxx.loadbalancer.server.port overrides that behavior.

That is why 9987 works for the voice but the other ports weren't working.

For anybody else having a problem with Teamspeak File Transfers with Dockers and Traefik this docker-compose.yml works with the other configs in the original post.

docker-compose.yml
version: '3.1'
services:
  teamspeak:
    image: teamspeak
    restart: unless-stopped
    environment:
      - TS3SERVER_LICENSE=accept
      - TS3SERVER_DB_PLUGIN=ts3db_mariadb
      - TS3SERVER_DB_SQLCREATEPATH=create_mariadb
      - TS3SERVER_DB_HOST=teamspeak_db
      - TS3SERVER_DB_USER=teamspeak
      - TS3SERVER_DB_PASSWORD=$DB_PASSWORD
      - TS3SERVER_DB_NAME=teamspeakdb
      - TS3SERVER_DB_WAITUNTILREADY=30
    labels:
      - "traefik.enable=true"
      # Port 30033
      - "traefik.tcp.routers.teamspeakft.entrypoints=p30033"
      - "traefik.tcp.routers.teamspeakft.rule=HostSNI(`*`)"
      - "traefik.tcp.services.teamspeakftlb.loadbalancer.server.port=30033"
      - "traefik.tcp.routers.teamspeakft.service=teamspeakftlb"
      #Port 10011
      - "traefik.tcp.routers.teamspeak.entrypoints=p10011"
      - "traefik.tcp.routers.teamspeak.rule=HostSNI(`*`)"
      - "traefik.tcp.services.teamspeaklb.loadbalancer.server.port=10011"
      - "traefik.tcp.routers.teamspeak.service=teamspeaklb"
      # Port 9987
      - "traefik.udp.routers.teamspeakudp.entrypoints=p9987"
    volumes:
      - ./teamspeak:/var/ts3server
    depends_on:
      - teamspeak_db
    networks:
      - traefik
      - default

  teamspeak_db:
    image: mariadb
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=$DB_ROOT_PASSWORD
      - MYSQL_PASSWORD=$DB_PASSWORD
      - MYSQL_DATABASE=teamspeakdb
      - MYSQL_USER=teamspeak
    volumes:
      - ./db:/var/lib/mysql/


networks:
  traefik:
    name: traefik_network
    external: true

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.