thijsvanloef / palworld-server-docker

A Docker Container to easily run a Palworld dedicated server.
https://hub.docker.com/r/thijsvanloef/palworld-server-docker
MIT License
2.43k stars 295 forks source link

"" Around most config items is broken. #220

Closed Illydth closed 9 months ago

Illydth commented 9 months ago

Describe the bug

Specifically when using the environment options file with "env-file" option, most of the "" are incorrect. Specifically using "true" for "UPDATE_ON_BOOT" causes the IF check in the start.sh script to check ""true"" vs. "true" and fails, thus nothing downloads to your data directory. You can see the same behavior with the UID/GID 1000 which is "1000" in the env file by default. When you start the server you'll immediately see it complain about "1000" being a bad value.

To Reproduce

Steps to reproduce the behavior:

  1. Create an "env" file using the supplied ENV file, modify values as needed BUT LEAVE THE ""
  2. Start the Server
  3. Check the Logs

PalWorld_palworld.1.i2rm7a8eotn3@docker03 | /home/steam/server/init.sh: line 3: [[: "1000": syntax error: operand expected (error token is ""1000"") PalWorld_palworld.1.i2rm7a8eotn3@docker03 | /home/steam/server/init.sh: line 3: [[: "1000": syntax error: operand expected (error token is ""1000"") PalWorld_palworld.1.i2rm7a8eotn3@docker03 | EXECUTING USERMOD PalWorld_palworld.1.i2rm7a8eotn3@docker03 | usermod: invalid user ID '"1000"' PalWorld_palworld.1.i2rm7a8eotn3@docker03 | groupmod: invalid group ID '"1000"' PalWorld_palworld.1.i2rm7a8eotn3@docker03 | CHECKING FOR EXISTING CONFIG PalWorld_palworld.1.i2rm7a8eotn3@docker03 | GENERATING CONFIG PalWorld_palworld.1.i2rm7a8eotn3@docker03 | timeout: failed to run command './PalServer.sh': No such file or directory PalWorld_palworld.1.i2rm7a8eotn3@docker03 | cp: cannot stat '/palworld/DefaultPalWorldSettings.ini': No such file or directory

The initial error shows that the "" around the 1000 is being passed into the container directly so the PUID value isn't [1000] it's ["1000"] and an invalid value. If you extrapolate this to the first check of start.sh which is "${UPDATE_ON_BOOT}" = "true" it becomes obvious why PalServer.sh doesn't exist...it's never downloaded because the steamcmd command is never executed.

Expected behavior

Example ENV file is written in such a way that it is accepted (with modifications) out of the box. In other words, the default ENV file should not have "" around items that shouldn't have "" around them.

Desktop (please complete the following information)

Note, I'm running this as a docker stack service not as a container but that amounts to no real difference.

docker-compose.yml contents

version: '3.8'

services:
  palworld:
    image: thijsvanloef/palworld-server-docker:latest
    networks:
      - palservernet
    env_file:
      - <path>/palworld/env
    ports:
      # Game Connection Port - Game Client
      - 8211:8211/udp
      # Steam Server-List Port
      - 27015:27015/udp
      # Game RCON Management Port
      - 25575:25575/tcp
    volumes:
      - type: volume
        source: palworld_data
        target: /palworld
        volume:
          nocopy: true

networks:
  palservernet:
    driver: overlay
    attachable: true

volumes:
  # Palworld Data Mount
  palworld_data:
    driver: local
    driver_opts:
      type: "nfs"
      o: "nfsvers=3,addr=nas.dom,hard,intr,bg,rw"
      device: ":/<location>/palworld_data"

Container/Host Logs

Server Log Cut:

PalWorld_palworld.1.i2rm7a8eotn3@docker03 | /home/steam/server/init.sh: line 3: [[: "1000": syntax error: operand expected (error token is ""1000"") PalWorld_palworld.1.i2rm7a8eotn3@docker03 | /home/steam/server/init.sh: line 3: [[: "1000": syntax error: operand expected (error token is ""1000"") PalWorld_palworld.1.i2rm7a8eotn3@docker03 | EXECUTING USERMOD PalWorld_palworld.1.i2rm7a8eotn3@docker03 | usermod: invalid user ID '"1000"' PalWorld_palworld.1.i2rm7a8eotn3@docker03 | groupmod: invalid group ID '"1000"' PalWorld_palworld.1.i2rm7a8eotn3@docker03 | CHECKING FOR EXISTING CONFIG PalWorld_palworld.1.i2rm7a8eotn3@docker03 | GENERATING CONFIG PalWorld_palworld.1.i2rm7a8eotn3@docker03 | timeout: failed to run command './PalServer.sh': No such file or directory PalWorld_palworld.1.i2rm7a8eotn3@docker03 | cp: cannot stat '/palworld/DefaultPalWorldSettings.ini': No such file or directory

Additional context

I ass-u-me that the top content of the ENV file should be:

TZ="America/Chicago"
PLAYERS=8
PORT=8211
PUID=1000
PGID=1000
MULTITHREADING=true
COMMUNITY=true
PUBLIC_IP=""
PUBLIC_PORT=""
SERVER_NAME="horse_quest_palworld"
SERVER_DESCRIPTION="Horse Quest Private Palworld Server"
SERVER_PASSWORD="EternalGrind"
ADMIN_PASSWORD="ADMEternalGrind"
UPDATE_ON_BOOT=true
RCON_ENABLED=true
RCON_PORT=25575
QUERY_PORT=27015
BACKUP_CRON_EXPRESSION="0 1 * * *"

Where true/false and numeric values should not be quoted and text values should. If this doesn't work the ENTIRE file will need an overhaul.

thijsvanloef commented 9 months ago

@Illydth You're right, this needs to be changed.

dexterIshere commented 9 months ago

I wasn't sure but u confirmed my thoughts thx

jiannystein commented 9 months ago

I haven't delved into advanced configurations yet, but I currently utilize the ../Pal/Saved/Config/LinuxServer/PalWorldSettings.ini for settings while keeping the YAML file simple, this works for now...

thijsvanloef commented 9 months ago

@Illydth Thanks for the report, updated the .env.example with working variables. Closing the issue