lloesche / valheim-server-docker

Valheim dedicated gameserver with automatic update, World backup, BepInEx and ValheimPlus mod support
https://hub.docker.com/r/lloesche/valheim-server
Apache License 2.0
1.89k stars 269 forks source link

TrueNas Scale -No Connection to server #628

Open armanivers opened 1 year ago

armanivers commented 1 year ago

Hello,

I'm running the server following the docker-compose instructions in this guide. The system is True Nas Scale. I've managed to install everything and get the server up and running (I see the Game Server Connected message). Trying to connect to the server through the local ip of the nas (192.168.1.17:2457) it doesn't appear neither through steam server browser nor on valheim connect screen, ends up in failed to connect (in-game) or not responding (from steam).

I can open the nas webpage, so port 80 is fine. Listening on port 2456 on my nas with "tcpdump -i enp3s0 port '(2456 or 2457)' " I see the packets from my pc reaching the nas server.

(from steam server browser) 16:35:24.486222 IP PC.55538 > unknown305a3a817080.2457: UDP, length 25 (from valheim client) 16:37:19.638687 IP PC.58889 > unknown305a3a817080.2457: UDP, length 512

Any suggestions? I'm not sure what the problem is. Thanks in advance

valheim-log.txt

armanivers commented 1 year ago

Docker PS File

DockerPS.txt

armanivers commented 1 year ago

After a lot of trying and reading around, I've found what the problem was. For anyone using TrueNas Scale for hosting this. The way TrueNas uses docker is kinda different, it converts them to kubernetes or something, I'm not very familiar with this so I can't explain in detail.

1. If trying to install valheim through docker-compose app on the catalog list -> in Global Pod Options (Advanced) menu before installing it, check the Expert-Pod Options and then the Host Networking. This makes your port accessable through lan. --> I didn't get it to work outside of my router for some reason, the ports are forwarded correctly.

2. If installing valheim through "Launch Docker Image" option in Applications menu you have two options:

  1. either forward the 2456 ip to port > 9000, for example what I did was I made it to 9456. You do in the Port Forwarding option. Container Port ist 2456 and the Node Port 9456 (could also be 9001, 9002... your choice) and ofcourse set the protocol to UDP Protocol. Do the same for the 2457 Port.
  2. OR in the Networking tab you set the Host Interface to your ethernet interface you're using. then in IPAM Type you choose either a static or dynamic ip, static makes more sense and set it to whatever you want, for example 192.168.1.99. This IP will be only for your valheim server. But then the ports used will be the default 2456+2457 ===> in both cases you have to set up the Container Environment Variables, atleast the server_pass and the server_public.

After all it worked on LAN. Portforwarding the ports on my router didn't give access to my friends, I don't know why, help here would be nice if anyone has any suggestions.

Also I have a problem, when restarting my nas, it isn't just one pod created for some reason, one is the old one, which I can't access anymore through shell it says failed state and a new pod which run the valheim docker image once again, instead of using the old files from pervious build. How do I make the valheim server files saved in permament storage? Couldn't figure it out.

barnhill commented 2 months ago

I only run into this on container startup in TrueNas and it appears that it wont allow connections till after the backup process is completed.

KasperHendrix commented 1 month ago

Pod Is an ephemeral kubernetes resource that have files inerithed by his deployment. If you want to override a file or some other things you must pass them to pod mounting a configmap as volume, declaring it into deployment manifest so at every pod restart, you will find your wanted configuration.