MinoMino / minqlx

Extends Quake Live's dedicated server with extra functionality and scripting.
GNU General Public License v3.0
112 stars 42 forks source link

issue with minqlx connecting to redis #111

Closed jamesla closed 2 years ago

jamesla commented 2 years ago

I think I have found a bug in minqlx's in relation to it's redis connection throwing the error:

ERROR: redis.exceptions.ConnectionError: Error -2 connecting to = redis:6379. Name or service not known.

I have tried everything and even created a reproducible demo to demonstrate this:

  1. ensure you have docker and docker-compose installed (
  2. create a file with the following contents called docker-compose.yaml (this docker compose file creates a ql server and a redis server).
  3. run docker-compose up
---
version: "3.8"

services:
  redis:
    image: redis:alpine
  quakelive:
    image: jamesla/quakelive:1.0.3
    stdin_open: true
    tty: true
    depends_on:
    - "redis"
    ports:
    - "27960:27960/udp"
    environment:
      ACCESS: |
        76561197961679861|admin
      SERVER_CFG: |
        set serverstartup "startrandommap"
        set sv_hostname "demo server"
        set sv_serverType "1"
        set qlx_redisAddress = "redis"
        set qlx_plugins "permission, motd"
      MAP_POOL: |
        overkill|ffa

After pulling the containers for the first time you will see that it throws a bunch of minqlx exceptions with the important one being arena1_1 | [minqlx.log_exception] ERROR: redis.exceptions.ConnectionError: Error -2 connecting to = redis:6379. Name or service not known.

At first glance you would think that this is a networking problem however that's not the case as I can demonstrate:

Proving that redis is accessible from the quakelive container:

  1. connect to the quake live container (while it's running in another terminal run docker-compose exec quakelive python3

  2. connect to the redis container:

    import socket
    socket.getaddrinfo("redis", 6379)

3.. alternatively you can connect from the quakelive container:

apt install redis-tools
redis-cli -h redis

I am certain I have cornered this problem to minqlx however I am completely stuck with this one and any assistance would be greatly appreciated.

PS I have also ruled out that this is a race condition between redis and the quakelive container starting - as if you run docker-compose restart quakelive after the redis container has been running for a while and it will still get the same error.

cstewart90 commented 2 years ago
set qlx_redisAddress = "redis"

Remove the = , otherwise qlx_redisAddress will get set to "= redis".

jamesla commented 2 years ago

legend @cstewart90 - so easy and working thank you - not sure how I missed that