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

Environment Variables Behave Differently When Deploying Image to TrueNAS Application (K3s Cluster) With scripts/start.sh #120

Closed clarkent86 closed 6 months ago

clarkent86 commented 9 months ago

Describe the bug

As directed in the readme, I've updated the environment variables, but /Pal/Saved/Config/LinuxServer/PalWorldSettings.ini continues to show default values.

To Reproduce

Steps to reproduce the behavior:

  1. Both deleting PalWorldSettings.ini while the server is running or powered off and starting the server again with the specified env. vars, the PalWorldSettings.ini file regenerates to default values.

Expected behavior

I expect the env. var values like SERVER_NAME to populate in PalWorldSettings.ini, but it remains default:

; This configuration file is a sample of the default server settings.
; Changes to this file will NOT be reflected on the server.
; To change the server settings, modify Pal/Saved/Config/LinuxServer/PalWorldSettings.ini.
[/Script/Pal.PalGameWorldSettings]
OptionSettings=(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName="Default Palworld Server",ServerDescription="",AdminPassword="",ServerPassword="",PublicPort=8211,PublicIP="",RCONEnabled=true,RCONPort=25575,Region="",bUseAuth=True,BanListURL="https://api.palworldgame.com/api/banlist.txt")

Screenshots

n/a

Desktop (please complete the following information)

docker-compose.yml contents

root@truenas[~]# k3s kubectl -n ix-palworld describe pod palworld-ix-chart-64577                                         5d9cf-5v5tr
Name:             palworld-ix-chart-645775d9cf-5v5tr
Namespace:        ix-palworld
Priority:         0
Service Account:  default
Node:             ix-truenas/192.168.1.30
Start Time:       Thu, 25 Jan 2024 19:38:59 -0600
Labels:           app.kubernetes.io/instance=palworld
                  app.kubernetes.io/name=ix-chart
                  pod-template-hash=645775d9cf
Annotations:      k8s.v1.cni.cncf.io/network-status:
                    [{
                        "name": "ix-net",
                        "interface": "eth0",
                        "ips": [
                            "172.16.0.53"
                        ],
                        "mac": "e2:dd:02:b3:31:84",
                        "default": true,
                        "dns": {},
                        "gateway": [
                            "172.16.0.1"
                        ]
                    }]
                  rollme: IIzTP
Status:           Running
IP:               172.16.0.53
IPs:
  IP:           172.16.0.53
Controlled By:  ReplicaSet/palworld-ix-chart-645775d9cf
Containers:
  ix-chart:
    Container ID:   containerd://5ca905068d9d98200c92ea94619188c3e53b702437b6842                                         d13f6f065f1d41a0b
    Image:          thijsvanloef/palworld-server-docker:latest
    Image ID:       docker.io/thijsvanloef/palworld-server-docker@sha256:0a88e6b                                         edaa1510817c52f987404f450921818c529cd67ade7705333b8d642d7
    Ports:          10826/TCP, 27015/TCP, 25575/TCP
    Host Ports:     0/TCP, 0/TCP, 0/TCP
    State:          Running
      Started:      Thu, 25 Jan 2024 19:39:02 -0600
    Ready:          True
    Restart Count:  0
    Limits:
      amd.com/gpu:         0
      gpu.intel.com/i915:  2
      nvidia.com/gpu:      0
    Requests:
      amd.com/gpu:         0
      gpu.intel.com/i915:  2
      nvidia.com/gpu:      0
    Environment:
      PORT:             ****
      MULTITHREADING:   true
      COMMUNITY:        true
      UPDATE_ON_BOOT:   true
      PLAYERS:          16
      SERVER_PASSWORD:  ****
      ADMIN_PASSWORD:   ****
      TZ:               CST
      SERVER_NAME:      ****
      PUBLIC_PORT:      8221
      PUBLIC_IP:        ****
    Mounts:
      /palworld from ix-host-path-palworld-0 (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-qqm9c (                                         ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             True
  ContainersReady   True
  PodScheduled      True
Volumes:
  ix-host-path-palworld-0:
    Type:          HostPath (bare host directory volume)
    Path:          /mnt/Canonball/set1/Palworld
    HostPathType:
  kube-api-access-qqm9c:
    Type:                    Projected (a volume that contains injected data fro                                         m multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
Tolerations:                 node.kubernetes.io/not-ready:NoExecute op=Exists fo                                         r 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists                                          for 300s
Events:
  Type    Reason          Age   From               Message
  ----    ------          ----  ----               -------
  Normal  Scheduled       10m   default-scheduler  Successfully assigned ix-palw                                         orld/palworld-ix-chart-645775d9cf-5v5tr to ix-truenas
  Normal  AddedInterface  10m   multus             Add eth0 [172.16.0.53/16] fro                                         m ix-net
  Normal  Pulled          10m   kubelet            Container image "thijsvanloef                                         /palworld-server-docker:latest" already present on machine
  Normal  Created         10m   kubelet            Created container ix-chart
  Normal  Started         10m   kubelet            Started container ix-chart

Container/Host Logs

2024-01-25 19:39:02.115105-06:00*****EXECUTING USERMOD*****
2024-01-25 19:39:02.116874-06:00usermod: no changes
2024-01-25 19:39:02.693311-06:00*****STARTING INSTALL/UPDATE*****
2024-01-25 19:39:32.067025-06:00tid(22) burning pthread_key_t == 0 so we never use it
2024-01-25 19:39:32.067139-06:00Redirecting stderr to '/home/steam/Steam/logs/stderr.txt'
2024-01-25 19:39:32.067166-06:00Logging directory: '/home/steam/Steam/logs'
2024-01-25 19:39:32.067199-06:00[  0%] Checking for available updates...
2024-01-25 19:39:32.067216-06:00[----] Verifying installation...
2024-01-25 19:39:32.067231-06:00[  0%] Downloading update...
2024-01-25 19:39:32.067247-06:00[  0%] Checking for available updates...
2024-01-25 19:39:32.067262-06:00[----] Download complete.
2024-01-25 19:39:32.067276-06:00[----] Extracting package...
2024-01-25 19:39:32.067291-06:00[----] Extracting package...
2024-01-25 19:39:32.067316-06:00[----] Extracting package...
2024-01-25 19:39:32.067332-06:00[----] Extracting package...
2024-01-25 19:39:32.067347-06:00[----] Installing update...
2024-01-25 19:39:32.067362-06:00[----] Installing update...
2024-01-25 19:39:32.067377-06:00[----] Installing update...
2024-01-25 19:39:32.067391-06:00[----] Installing update...
2024-01-25 19:39:32.067406-06:00[----] Installing update...
2024-01-25 19:39:32.067430-06:00[----] Installing update...
2024-01-25 19:39:32.067446-06:00[----] Installing update...
2024-01-25 19:39:32.067461-06:00[----] Installing update...
2024-01-25 19:39:32.067476-06:00[----] Cleaning up...
2024-01-25 19:39:32.067491-06:00[----] Update complete, launching Steamcmd...
2024-01-25 19:39:33.216766-06:00tid(34) burning pthread_key_t == 0 so we never use it
2024-01-25 19:39:33.216797-06:00Redirecting stderr to '/home/steam/Steam/logs/stderr.txt'
2024-01-25 19:39:33.216804-06:00Logging directory: '/home/steam/Steam/logs'
2024-01-25 19:39:33.216809-06:00[  0%] Checking for available updates...
2024-01-25 19:39:33.216815-06:00[----] Verifying installation...
2024-01-25 19:39:33.216820-06:00Steam Console Client (c) Valve Corporation - version 1705108307
2024-01-25 19:39:33.216826-06:00-- type 'quit' to exit --
2024-01-25 19:39:33.440522-06:00Loading Steam API...OK
2024-01-25 19:39:33.440555-06:002024-01-25T19:39:33.440555166-06:00
2024-01-25 19:39:35.621949-06:00Connecting anonymously to Steam Public...OK
2024-01-25 19:39:35.622116-06:00Waiting for client config...OK
2024-01-25 19:39:46.037128-06:00Waiting for user info...OK
2024-01-25 19:39:46.037212-06:00Update state (0x3) reconfiguring, progress: 0.00 (0 / 0)
2024-01-25 19:39:46.037238-06:00Update state (0x5) verifying install, progress: 0.09 (2097152 / 2248053389)
2024-01-25 19:39:46.037280-06:00Update state (0x5) verifying install, progress: 43.67 (981679719 / 2248053389)
2024-01-25 19:39:46.037302-06:00Update state (0x5) verifying install, progress: 92.88 (2087997601 / 2248053389)
2024-01-25 19:39:46.037323-06:00Success! App '2394010' fully installed.
2024-01-25 19:39:46.205966-06:00*****CHECKING FOR EXISTING CONFIG*****
2024-01-25 19:39:46.206038-06:00*****GENERATING CONFIG*****
2024-01-25 19:39:46.559439-06:00setrlimit() failed with error 22 (Invalid argument)
2024-01-25 19:39:46.559478-06:00- Max per-process value allowed is 1 (we wanted infinity).
2024-01-25 19:39:46.957546-06:00[S_API] SteamAPI_Init(): Loaded local 'steamclient.so' OK.
2024-01-25 19:39:47.088337-06:00CAppInfoCacheReadFromDiskThread took 2 milliseconds to initialize
2024-01-25 19:39:47.112534-06:00Setting breakpad minidump AppID = 2394010
2024-01-25 19:39:47.113460-06:00[S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded.
2024-01-25 19:39:47.113477-06:00[S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded.
2024-01-25 19:39:47.569036-06:00[S_API FAIL] Tried to access Steam interface STEAMAPPS_INTERFACE_VERSION008 before SteamAPI_Init succeeded.
2024-01-25 19:39:47.634163-06:00[S_API FAIL] Tried to access Steam interface SteamNetworkingUtils004 before SteamAPI_Init succeeded.
2024-01-25 19:40:06.235191-06:00RCON_ENABLED=true
2024-01-25 19:40:06.245243-06:00RCON_PORT=25575
2024-01-25 19:40:06.258161-06:00*****STARTING SERVER*****
2024-01-25 19:40:06.258260-06:00./PalServer.sh -port=10826 -players=16 EpicApp=PalServer -publicip=24.152.167.16 -publicport=8221 -servername=Them Bucky Boys -serverpassword=**** -adminpassword=**** -queryport=27015 -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS
2024-01-25 19:40:06.659776-06:00setrlimit() failed with error 22 (Invalid argument)
2024-01-25 19:40:06.659808-06:00- Max per-process value allowed is 1 (we wanted infinity).
2024-01-25 19:40:06.991414-06:00Shutdown handler: initalize.
2024-01-25 19:40:06.991447-06:00Increasing per-process limit of core file size to infinity.
2024-01-25 19:40:06.991421-06:00[S_API] SteamAPI_Init(): Loaded local 'steamclient.so' OK.
2024-01-25 19:40:07.118884-06:00CAppInfoCacheReadFromDiskThread took 2 milliseconds to initialize
2024-01-25 19:40:07.137265-06:00Setting breakpad minidump AppID = 2394010
2024-01-25 19:40:07.138266-06:00[S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded.
2024-01-25 19:40:07.138282-06:00[S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded.
2024-01-25 19:40:07.590220-06:00[S_API FAIL] Tried to access Steam interface STEAMAPPS_INTERFACE_VERSION008 before SteamAPI_Init succeeded.
2024-01-25 19:40:07.646441-06:00[S_API FAIL] Tried to access Steam interface SteamNetworkingUtils004 before SteamAPI_Init succeeded.

Additional context

the blank values in the PalWorldSettings.ini were not intentionally removed, that is the state of the file after deleting and rebooting or powering off, deleting, and booting

clarkent86 commented 9 months ago

Oh and I forgot to mention, you can see in my logs that some of the env vars are getting set as program arguments, but not certain ones like SERVER_NAME. The ones that aren't, like SERVER_NAME, are getting default values in the .ini and not the values I have set in the environment vars. There just seems to be a disconnect in k3s sourcing the env vars correctly for .ini, but the program arguments are working fine. I am able to connect directly with the set password via environment variables.

fryfrog commented 9 months ago

When I was looking at the startup scripts, every server control from env vars was startup args. There was no sed-fu on the .ini file.

https://github.com/thijsvanloef/palworld-server-docker/blob/main/scripts/start.sh#L25-L26

^ This is how server name is done.

clarkent86 commented 9 months ago

I think I see the issue, the server startup command isn't in quotes, so spaces wouldn't be supported. I'm going to submit a pull request to encapsulate those in quotes. I'll test it first though.

clarkent86 commented 9 months ago

Yup, that was exactly it. For some reason, it's not showing up in Community servers, but it shows up in Recent Servers. When I had spaces it shows as "Them"

clarkent86 commented 9 months ago

124

clarkent86 commented 9 months ago

Unfortunately it looks like my issue persists. I assumed it was consistent across deployments, but this looks to be a k8s issue vs. docker, specifically k3s running on TrueNAS. There must be some subtle difference in bash versions in how they are handling start.sh and the STARTCMD. I'll continue to debug.

As an FYI, I have published my personal repo image to docker hub so I can verify directly against what's ran in TrueNAS vs. docker compose...which is what I should've done in the first place. Apologies for my laziness along the way here.

xHyperElectric commented 6 months ago

I'm sure this has been fixed by now. His deployment sounds a little different, but I've been running this server on an iX Systems custom docker image on TrueNAS since week 1 of Palworld release and I have no issues. It runs k3s in the background. It sounds like this deployment may be directly k3s instead of via docker, and I imagine there was some misconfiguring or simply the bug has already been fixed.

clarkent86 commented 6 months ago

Update: This comment is based on an outdated image/perhaps previously to iX updating libraries to execute the start script in an updated fashion, or a bug fix that was not communicated back to this issue.

@xHyperElectric If you're going to claim that, please provide evidence, or how you're able to use spaces?

The server runs fine, but it does not allow for spaces in configuration values which should allow them, like the server name or password.

See my above comment that explicitly shows this in the output from the startup script:

2024-01-25 19:40:06.258260-06:00./PalServer.sh -port=10826 -players=16 EpicApp=PalServer -publicip=24.152.167.16 -publicport=8221 -servername=Them Bucky Boys -serverpassword=**** -adminpassword=**** -queryport=27015 -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS
clarkent86 commented 6 months ago

Closing this as @xHyperElectric was correct, spaces are now honored in environment variables.

It's totally possible that iX systems updated their libraries that execute the start script and this was entirely unrelated to any changes here.

For what it's worth, I have also been running this since week 1 of palworld and this was an issue long after. Thanks for bringing it back to my attention to check if the issue persisted, as it does not for one reason or another!