TS3 in Docker behind Traefik. Can't upload files (all files have 0 bytes)

Hi,

I have a ts3 server in a Docker behind traefik, with docker compose on a vps. The tcp ports 30033, 10011 and the udp port 9987 are connected via traefik and traefik dashboard shows this working. I can connect to the server and speak but uploading files is not working correctly.

It’s about a 50/50 chance if it will say (lost file transfer connection) or it will say it was successfull but the result is the same. An empty file will be created on the server with 0 bytes.

Anybody know what I do wrong?

traefik dashboard



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(`*`)"
      #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

I think the problem is that Traefik only correctly handles HTTP traffic, while TeamSpeak does not use HTTP but its own custom protocol. I recommend bypassing Traefik and ingesting port 30033 directly into the TeamSpeak docker container.

You sure? You can have HTTP-Routers but they also have just tcp-Routers which I used and which should work here, I think?

From how I understood this, traefik can handle HTTP-like protocols, but still somehow mangles the data. You might get it to work, but honestly I don’t see a reason to. You need to pipe the data through traefik 1:1 for everything to work, so why not just bypass it.

So it was a problem with traefik because with bypassing traefik everything worked.

The folks in the traefik forum helped me to the solution.

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

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

docs

Thats probably why the voice worked because that is the first port but the other routers didn’t not route to the needed ports.

If somebody else has the problem here is a docker-compose.yml that at least works for me

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