melkortf / tf2-servers

TF2 server in Docker container - multiple images for various purposes
MIT License
37 stars 11 forks source link

Unable to connect to server #124

Closed nukelet closed 10 months ago

nukelet commented 10 months ago

Hi,

First of all, thanks for your work on this project. The packages you're providing are very high quality and the setup is very convenient.

However, I'm having some trouble with the container setup (I'm trying to run the tf2-competitive package, but I'm having the same issue with tf2-base as well). I am currently unable to connect to the containerized servers, despite having tried various different network setups (connecting through the in-game console doesn't work, adding the server through Community Servers -> Favorites -> Add a Server doesn't work either). Here are the environment variables I defined, according to the README:

IP=0.0.0.0
PORT=27015
CLIENT_PORT=27016
STEAM_PORT=27018
STV_PORT=27020
RCON_PASSWORD="<redacted>"
SERVER_HOSTNAME="Competitive TF2 server"
SERVER_PASSWORD="<redacted>"
STV_NAME="Source TV"
STV_TITLE="A Team Fortress 2 server Source TV"
STV_PASSWORD="<redacted>"
DOWNLOAD_URL="https://dl.serveme.tf/"

Here's what I tried so far:

For all of them, I can see the ports being used by the TF2 server; for example, when running with host network mode in a box within my LAN, netstat -antpu shows:

tcp        0      0 0.0.0.0:27015           0.0.0.0:*               LISTEN      64694/./srcds_linux 
tcp        0      0 127.0.0.1:45082         127.0.0.1:27015         TIME_WAIT   -                   
tcp        0      0 192.168.15.14:53745     155.133.227.34:27038    ESTABLISHED 64694/./srcds_linux 
tcp        0      0 127.0.0.1:60290         127.0.0.1:27015         TIME_WAIT   -                   
udp        0      0 0.0.0.0:27015           0.0.0.0:*                           64694/./srcds_linux 
udp        0      0 0.0.0.0:27016           0.0.0.0:*                           64694/./srcds_linux 
udp        0      0 0.0.0.0:27020           0.0.0.0:*                           64694/./srcds_linux 

I can't see any serious errors in the container logs (logs.txt), and the server does seem to be running (there's even a SourceTV bot connected to it).

Are there any SteamCMD particularities I'm missing? Thanks in advance!

nukelet commented 10 months ago

Also, this is the compose.yaml I'm using to deploy the server:

services:
  tf2-competitive:
    container_name: tf2
    image: "ghcr.io/melkortf/tf2-competitive"
    env_file: "./.env"
    network_mode: host
    volumes:
      - "./maps:/home/tf2/server/tf/maps"
nukelet commented 10 months ago

Actually, I just managed to make it work by applying the following port config in compose.yml, instead of using network_mode: host:

services:
  tf2-competitive:
    container_name: tf2
    image: "ghcr.io/melkortf/tf2-competitive"
    env_file: "./.env"
    ports:
      - "0.0.0.0:27015:27015/tcp"
      - "0.0.0.0:27015:27015/udp"
      - "0.0.0.0:27020:27020/tcp"
      - "0.0.0.0:27020:27020/udp"
    volumes:
      - "./maps:/home/tf2/server/tf/maps"

Very weird, since it seems that the server in the container is listening only to the loopback interface (127.0.0.1), unless we explicitly bind the port to all the host interfaces. Closing this since it's probably an issue with my machine configuration; sorry for the inconvenience.