TeamSpeak-Systems / teamspeak-linux-docker-images

docker build files for TeamSpeak servers
Other
114 stars 52 forks source link

Issue with Hostname resolve for PSQL #77

Open computeralex92 opened 3 years ago

computeralex92 commented 3 years ago

Hello,

after testing the new PSQL support for the Teamspeak Server and the Docker image, i maybe found a bug in the image or Teamspeak itself. When trying to run PSQL and Teamspeak together in a Docker Swarm, Teamspeak is not able to resolve the hostname for the PSQL.

Warning - name 'query_ip_whitelist' from file /var/run/ts3server/ts3server.ini is deprecated (but understood), please use the new name 'query_ip_allowlist' instead.
Warning - name 'query_ip_blacklist' from file /var/run/ts3server/ts3server.ini is deprecated (but understood), please use the new name 'query_ip_denylist' instead.
2021-03-13 13:13:07.082245|INFO    |ServerLibPriv |   |TeamSpeak 3 Server 3.13.3 (2020-12-16 14:17:05)
2021-03-13 13:13:07.082488|INFO    |ServerLibPriv |   |SystemInformation: Linux 5.10.0-4-amd64 #1 SMP Debian 5.10.19-1 (2021-03-02) x86_64 Binary: 64bit
2021-03-13 13:13:07.082590|INFO    |ServerLibPriv |   |Using hardware aes
2021-03-13 13:13:07.092824|INFO    |DatabaseQuery |   |dbPlugin name:    PostgreSQL plugin, version 1, (c)TeamSpeak Systems GmbH
2021-03-13 13:13:07.092907|INFO    |DatabaseQuery |   |dbPlugin version: 1
2021-03-13 13:13:07.101203|ERROR   |DatabaseQuery |   |make_connection had broken connect could not parse network address "postgresql": Name does not resolve
2021-03-13 13:13:07.101264|CRITICAL|ServerLibPriv |   |Server() DatabaseError

Since the same setup is working perfectly for MariaDB, it seems that the docker container or Teamspeak itself have a issue to resolve correctly the DB.

Here is my config:

version: "3.2"

services:
  postgresql:
    image: postgres:13-alpine
    volumes:
      - /opt/docker/teamspeak/psql/data/:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=PASSWORD
      - POSTGRES_USER=teamspeak
  server:
    image: IMAGE
    ports:
            - 9987:9987/udp
            - 30033:30033
    volumes:
        - "/opt/docker/teamspeak/teamspeak/data:/var/ts3server:rw"
    environment:
      TS3SERVER_DB_PLUGIN: ts3db_postgresql
      TS3SERVER_DB_SQLCREATEPATH: create_postgresql
      TS3SERVER_DB_HOST: postgresql
      TS3SERVER_DB_CONNECTIONS: 50
      TS3SERVER_DB_USER: teamspeak
      TS3SERVER_DB_PASSWORD: "PASSWORD"
      TS3SERVER_DB_NAME: teamspeak
      TS3SERVER_DB_WAITUNTILREADY: 30
      TS3SERVER_LICENSE: accept

Note: The image for the Teamspeak Server is build out of master of this git repo because the images hosted at DockerHub do not contain the required fix for the PSQL Lib yet.

Hazmi35 commented 2 years ago

Any updates about this issue? having the same problem, do you find a workaround?

computeralex92 commented 2 years ago

Any updates about this issue? having the same problem, do you find a workaround?

Unfortunately no, but I didn't test it with a newer version of the server.

Dilergore commented 2 years ago

This is still an ongoing issue with the latest docker image.

Might be connected to: https://github.com/gliderlabs/docker-alpine/issues/539

thetredev commented 1 year ago

I created a Docker image based on AlmaLinux 9.1 Minimal and the issue persists. I'm starting to believe this has more to do with the TeamSpeak PostgreSQL plugin rather than Alpine Linux.

This gist of it:

FROM almalinux:9.1-minimal-20221201

ARG TEAMSPEAK_RELEASE_URL="https://files.teamspeak-services.com/releases/server/3.13.7/teamspeak3-server_linux_amd64-3.13.7.tar.bz2"

RUN microdnf install libpq # plus some more, not showing here for brevity

WORKDIR /app

RUN wget -O server.tar.bz2 ${TEAMSPEAK_RELEASE_URL} && \
    tar xfj server.tar.bz2 && \
    rm server.tar.bz2 && \
    mv teamspeak3-server_linux_amd64/* . && \
    rm -rf teamspeak3-server_linux_amd64 && \
    touch .ts3server_license_accepted

EXPOSE 9987/udp

Then starting it with /bin/sh -c "/app/ts3server_minimal_runscript.sh inifile=ts3server.ini" where that ini file as well as my PSQL ini file is mounted into the container. It still can't resolve DNS, whereas ping can...

Actually I'm using this on my Kubernetes cluster, where I have a separate PostgreSQL instance running in its own namespace. My GitLab deployment can connect to it no problem (from another namespace), so the hostname does work 100%. The TeamSpeak error message indicates I've configured it correctly. I'm out of ideas :(

thetredev commented 1 year ago

Update: works fine with TeamSpeak 5 Beta from https://github.com/TeamSpeak-Systems/ts-native (https://github.com/TeamSpeak-Systems/ts-native/releases/tag/beta-58rc12). I guess they just don't bother supporting PostgreSQL for TeamSpeak 3 anymore.

thetredev commented 1 year ago

Update 2: Of course the TeamSpeak 3 client doesn't work with a TeamSpeak 5 server. And the TeamSpeak 5 server requires a user account "for beta access". Guess we have to wait for the official TeamSpeak 5 release then or switch to MariaDB for TeamSpeak 3... Falling back to TeamSpeak 3 with SQLite for now.

qknight commented 1 year ago

@computeralex92 maybe one of these two things helps you:

in your docker-compose.yaml you need to add this to each service:

  postgresql:
    image: postgres:13-alpine
    restart: on-failure
    expose:
      - "5432"
    networks:
      ts-net:
  ...
  teamspeak:
    image: some_url
    networks:
      ts-net:
   ...

networks:
  ts-net:

And then you should be able to connect the two containers. And you have to make sure that the postgresql service is up before you try to connect to it.

thetredev commented 1 year ago

@qknight that would work if the DNS resolution worked in the TeamSpeak PostgreSQL plugin. Sadly it doesn't.