docker-palworld-dedicated-server
docker-palworld-dedicated-server copied to clipboard
Properly auto-detect `PUBLIC_IP` when omitting from docker-compose.yml
Have you read the Important information text above
- [X] Yes i did
Current behavior
When omitting PUBLIC_IP from docker-compose.yml, it is not auto-detected and instead the PublicIp value in /game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini set to 10.0.0.1.
For users, it is a bit hard to follow what the actual behavior of the container will be since the docs for PUBLIC_IP contradicts itself by stating auto-detect if not specified while also stating that the default value is 10.0.0.1. No auto-detection is taking place.
Desired behavior
Proper auto-detection of PUBLIC_IP
Two steps to this below.
Remove default value for PUBLIC_IP
Remove 10.0.0.1 as the default value from Dockerfile:
https://github.com/jammsen/docker-palworld-dedicated-server/blob/ee23b8807b280d2787af71ab18cfb7a0cc51b577/Dockerfile#L16
Reasons for this:
10.0.0.1is slightly misleading as a defaultPUBLIC_IPsince the10.0.0.0/8IP ranges are specially reserved for private networks. It's not a sensible default. In general, there really is no sensible default forPUBLIC_IP, which is why I'm opting for it to be removed as a default entirely.- Omitting
PUBLIC_IPwill line up with the Setup for community server. instructions:
You can manually specify the global IP address of the network on which the server running. If not specified, it will be detected automatically. If it does not work well, try manual configuration.
- Instead of defining a default, the value can be dynamically populated when the container starts (see below).
Allow PUBLIC_IP to be detected and set dynamically
Add ability to set PUBLIC_IP environment variable to auto and make this the default value/behavior as currently noted in the README. This will automatically detect the network's public IP and set it in the game config. This is particularly useful for networks that do not have static IPs, as it removes the manual effort of reflecting changes to the public IP in docker-compose.yml. Even for networks with static IPs, it removes a manual step in the initial setup process.
General flow can go like this:
- Container is started and
servermanager.shscript is run. startServer()is called and checks ifPUBLIC_IPis either not set or set to the stringauto.
- If either of these expressions are true, execute command
curl ifconfig.meto retrieve public IP address and replacePublicIpconfig value with this IP in/game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini. - If something other than
autois defined forPUBLIC_IP, use that for thePublicIpconfig value.
Links to screenshots
No response
To Reproduce
Steps to reproduce the behavior:
- Fresh clone or install of the repo, or remove cached images for the docker-compose project and set
PublicIpto""ingame/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini. - Remove
PUBLIC_IPenv variable fromdocker-compose.yml docker-compose up -dwait for server to start (monitor withdocker-compose logs -f)- Run command
cat /game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini(or wherever your config file is located),PublicIpwill have been overridden to10.0.0.1.
Software setup
- OS:
Slackware 15.0 x86_64 (post 15.0 -current)- i.e.
Unraid 6.12.6
- i.e.
- Docker:
Docker version 20.10.24, build 297e128
Hardware setup
- vCPU: 12
- RAM: 104 GiB
- Disk: 1 TB
Additional context
I'm happy to write a PR for this but I wanted to get your input beforehand.
Hey @Jarvl What you need to set is:
environment:
...
- PUBLIC_IP=
- PUBLIC_PORT=8211
...
This works flawless, when i just tested this. Of course the default set of the Dockerfile will be used when you dont set something else in Docker-Compose, thats suppose to happen.
@Jarvl Did this help?
Please keep in mind that the community server search is limited to 200. It querys only the 200 search entrys, so you may need to load the next 200 entrys (bottom right Button). This is a known bug in Palworld.
This issue should be solved