jammsen / docker-palworld-dedicated-server

Docker container to easily provision and manage Palworld Dedicated Server
https://hub.docker.com/r/jammsen/palworld-dedicated-server
MIT License
907 stars 157 forks source link

ENV variables are ignored, and the game is starting with default config. #32

Closed Nevaehni closed 7 months ago

Nevaehni commented 7 months ago

Have you read the Important information text above

Current behavior

The env variables in my docker compose is being ignored, and the game is set up using the default config. I am running this on ubuntu server 22.04, with portainer.

How I know that it gets ignored is:

  1. I can enter the game without a password.
  2. When I type ingame /AdminPassword test, the game tells me that there's no admin password set.
  3. I can see in the ubuntu server htop that this is using all 4 cores, while I want to run this on 1 core.
  4. /dockerdata/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini exists, but it is empty.

This is my docker compose:

 version: '3.9'
  services:
    palworld-dedicated-server:
      build: .
      container_name: palworld-dedicated-server
      image: jammsen/palworld-dedicated-server:latest
      restart: unless-stopped
      network_mode: bridge
      ports:
        - target: 8211
          published: 8211
          protocol: udp
          mode: host
      environment:
        - ALWAYS_UPDATE_ON_START=true
        - MAX_PLAYERS=16
        - MULTITHREAD_ENABLED=false
        - COMMUNITY_SERVER=false
        - PUBLIC_PORT=8211
        - SERVER_NAME="RER"
        - SERVER_DESCRIPTION="Palworld Dedicated Server"
        - SERVER_PASSWORD="112211"
        - ADMIN_PASSWORD="test"
      volumes:
        - /dockerdata/palworld:/palworld

Desired behavior

That the server is picking up the env variables.

Links to screenshots

.ini file is empty: image

To Reproduce

Steps to reproduce the behavior:

  1. Go to portainer
  2. Click on create new stack from stacks
  3. Scroll down to click on deploy stack
  4. Enter the game, and see that your env variables are ignored

Software setup

Hardware setup

Additional context

No response

ComputersWithTimo commented 7 months ago

Hi @Nevaehni,

can you check the contents of DefaultPalWorldSettings.ini? It should be in the root of your bind at /dockerdata/palworld/DefaultPalWorldSettings.ini

If this file is empty, the steamcmd probably didn't download the server correctly. The easiest fix would be to empty the folder and restart the container.

For reference, the script in ths container copies the Default Config to the correct folder

And then replaces the values with the variables you have supplied.

gchai commented 7 months ago

I think this is related to #10 Editing DefaultPalWorldSettings.ini does not persist a startup.

ComputersWithTimo commented 7 months ago

Editing DefaultPalWorldSettings.ini does not persist a startup.

You're not supposed to edit an example ^^ But since his target file is completely empty, I think the issues are unrelated.

Nevaehni commented 7 months ago

@ComputersWithTimo DefaultPalWorldSettings.ini is not empty. image image

gchai commented 7 months ago

Editing DefaultPalWorldSettings.ini does not persist a startup.

You're not supposed to edit an example ^^ But since his target file is completely empty, I think the issues are unrelated.

Editing PalWorldSettings.ini doesn't persist either. I thought since the script copies DefaultPalWorldSettings.ini to PalWorldSettings.ini, editing Default... would work as editing the PalWorldSettings doesn't persist either.

ComputersWithTimo commented 7 months ago

Editing DefaultPalWorldSettings.ini does not persist a startup.

You're not supposed to edit an example ^^ But since his target file is completely empty, I think the issues are unrelated.

Editing PalWorldSettings.ini doesn't persist either. I thought since the script copies DefaultPalWorldSettings.ini to PalWorldSettings.ini, editing Default... would work as editing the PalWorldSettings doesn't persist either.

I think you missed the following part of the container: https://github.com/jammsen/docker-palworld-dedicated-server/blob/de32bb5917635d92529e12a370d2930920d453b4/servermanager.sh#L93-L95 https://github.com/jammsen/docker-palworld-dedicated-server/blob/de32bb5917635d92529e12a370d2930920d453b4/servermanager.sh#L13-L14

iirc this should always reset the DefaultPalWorldSettings.ini file cause steamcmd always thinks it got changed and pulls it again.

Try setting ALWAYS_UPDATE_ON_START=false

ComputersWithTimo commented 7 months ago

@ComputersWithTimo DefaultPalWorldSettings.ini is not empty.

@Nevaehni Can you try deleting the /dockerdata/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini file and restarting the container?

You should see the following entry in the containers log https://github.com/jammsen/docker-palworld-dedicated-server/blob/de32bb5917635d92529e12a370d2930920d453b4/servermanager.sh#L27

Also you might want to do an docker pull jammsen/palworld-dedicated-server since the image got updated only 4 hours ago on Docker Hub and some of the changes might not be included in your version

jammsen commented 7 months ago

Small correction i already published again, its now 34m 😎 added Backup functionality.

You're not supposed to edit an example ^^

This is right, your default is there and copied so when Pocketpair updates the config, you already get a new version out of the box. The copy gets then searched and replaced based on your settings in your Docker-Compose file or the default values in the Dockerfile that you should overload.

You can check your settings either via explorer on gamePal/Saved/Config/LinuxServer/PalWorldSettings.ini or using the command in the readme

Zer0mis commented 7 months ago

Is there any way to get the game specific settings to stick in the game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini file? The ones not covered by environmental variables I mean. At the moment they get wiped on restart.

jammsen commented 7 months ago

Is there any way to get the game specific settings to stick in the game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini file? The ones not covered by environmental variables I mean. At the moment they get wiped on restart.

Please see https://github.com/jammsen/docker-palworld-dedicated-server/issues/10#issuecomment-1906496277

Sectimus commented 7 months ago

I'll jump in on this one to say that I have the exact same issue. It doesn't look like gameserver/palworld/game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini ever gets reset either, it has the correct values. Even starting the container I get:

>>> Starting the gameserver
Checking if config exists
Setting public ip to 0.0.0.0
Setting public port to 8211
Setting server name to Starlight
Setting server description to Palworld-Dedicated-Server running in Docker by jammsen
Setting server password to -redacted-
Setting server admin password to -redacted-
Setting max-players to 32
sh: 1: xdg-user-dir: not found
[S_API] SteamAPI_Init(): Loaded local 'steamclient.so' OK.
Shutdown handler: initalize.
...
...

image

My gameserver/palworld/game/DefaultPalWorldSettings.ini remains unchanged also.

ComputersWithTimo commented 7 months ago

gameserver/palworld/game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini

@Sectimus your PalWorldSettings.ini is empty too?

Maybe a quick copy of gameserver/palworld/game/DefaultPalWorldSettings.ini to gameserver/palworld/game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini will fix it. The Script itself will update the settings once the container restarts

ComputersWithTimo commented 7 months ago

@Sectimus your PalWorldSettings.ini is empty too?

If that is the case, then the copy might be flaky on the container.

What Version OS and Docker are u running?

Sectimus commented 7 months ago

image

My PalWorldSettings.ini is not empty. I'll try the copy in an hour or so, don't want to kick off the other players prematurely.

ComputersWithTimo commented 7 months ago

My PalWorldSettings.ini is not emptym i'll try the copy in an hour or so, don't want to kick off the other players prematurely.

@Sectimus I'm going to guess the settings in PalWorldSettings.ini don't correspond with the settings you set as an environment variable.

Which makes it an interesting thing: the sed doesn't appear to work. ^^

Sectimus commented 7 months ago

Maybe a quick copy of gameserver/palworld/game/DefaultPalWorldSettings.ini to gameserver/palworld/game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini will fix it.

I've now copied the DefaultPalWorldSettings.ini to PalWorldSettings.ini and that seemed to do the trick. PalWorldSettings.ini was not autogenerated so I built it based on some templates on the wiki. Perhaps an update to the documentation to use the format provided in DefaultPalWorldSettings.ini and not any other.

Not sure if this is the same as OP, but resolved for me! 🎉

Nevaehni commented 7 months ago

@ComputersWithTimo DefaultPalWorldSettings.ini is not empty.

@Nevaehni Can you try deleting the /dockerdata/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini file and restarting the container?

You should see the following entry in the containers log

https://github.com/jammsen/docker-palworld-dedicated-server/blob/de32bb5917635d92529e12a370d2930920d453b4/servermanager.sh#L27

Also you might want to do an docker pull jammsen/palworld-dedicated-server since the image got updated only 4 hours ago on Docker Hub and some of the changes might not be included in your version

After deleting it, it recreated the PalWorldSettings.ini with all the keys, but it didn't copy the env variables into it. These are the default settings. Also, when I edit these files and restart with ALWAYS_UPDATE_ON_START=false, it doesn't have any effect. My server is still not password protected, even if I have a password set.

image

jammsen commented 7 months ago

@Sectimus @Nevaehni you guys might want to update the docker-compose file and the image i pushed serveral times yesterday and today, also "all" vars to set is in the work from one of your people in the community - See #40

Nevaehni commented 7 months ago

@jammsen I've removed all palworld volumes/images and host folders. Updated docker compose and ran a fresh pull/install. I can see in the logs which values he's updating/adding. I can also see those ENV variables being inserted into /dockerdata/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini file. But the those aren't loaded in. I can still enter the game without a password, and the game tells me that I don't have an admin password set. The changes aren't reflected in the game.

I started the server first with ALWAYS_UPDATE_ON_START=true after that turned of the server and updated it to ALWAYS_UPDATE_ON_START=false and ran the server again.

Docker compose:

version: '3.9'
services:
  palworld-dedicated-server:
    container_name: palworld-dedicated-server
    image: jammsen/palworld-dedicated-server:latest
    restart: unless-stopped
    network_mode: bridge
    ports:
      - target: 8211
        published: 8211
        protocol: udp
        mode: host
      - target: 25575
        published: 25575 
        protocol: tcp
        mode: host
    environment:
      - ALWAYS_UPDATE_ON_START=false
      - MAX_PLAYERS=16
      - MULTITHREAD_ENABLED=false
      - COMMUNITY_SERVER=false
      - RCON_ENABLED=true
      - RCON_PORT=25575
      - PUBLIC_IP=10.0.0.5
      - PUBLIC_PORT=8211
      - SERVER_NAME="ROCvA"
      - SERVER_DESCRIPTION="Palworld Dedicated Server"
      - SERVER_PASSWORD="112211"
      - ADMIN_PASSWORD="Test"
      - BACKUP_ENABLED=false
      - BACKUP_CRON_EXPRESSION=0 * * * *
    volumes:
      - /dockerdata/palworld:/palworld

Container log:

>>>>>> Starting the gameserver
Checking if config exists
Setting rcon-enabled to true
Setting public ip to 10.0.0.5
Setting public port to 8211
Setting server name to "ROCvA"
Setting server description to "Palworld Dedicated Server"
Setting server password to "112211"
Setting server admin password to "Test"
Setting max-players to 16
Shutdown handler: initalize.
- Existing per-process limit (soft=1048576, hard=1048576) is enough for us (need only 1048576)
Increasing per-process limit of core file size to infinity.
- Existing per-process limit (soft=18446744073709551615, hard=18446744073709551615) is enough for us (need only 18446744073709551615)
[S_API] SteamAPI_Init(): Loaded local 'steamclient.so' OK.
CAppInfoCacheReadFromDiskThread took 0 milliseconds to initialize
Setting breakpad minidump AppID = 2394010
[S_API FAIL] Tried to access Steam interface SteamUser021 before SteamAPI_Init succeeded.
[S_API FAIL] Tried to access Steam interface SteamFriends017 before SteamAPI_Init succeeded.
[S_API FAIL] Tried to access Steam interface STEAMAPPS_INTERFACE_VERSION008 before SteamAPI_Init succeeded.
[S_API FAIL] Tried to access Steam interface SteamNetworkingUtils004 before SteamAPI_Init succeeded.
jammsen commented 7 months ago

@Nevaehni thats really weird, i might need to take a look at this over Discord tomorrow sometime you are available.

TinFoilFox commented 7 months ago

I've found out why changing /Pal/Saved/Config/LinuxServer/PalWorldSettings.ini didn't work for me. The server appears to save current settings on exit. So if you change settings while the server is running and then restart the container, the server will overwrite your settings with the current game settings before restarting. To change settings in the ini file you need to first stop the server and then make changes to your settings before starting the server again.

jammsen commented 7 months ago

Thats on almost every dedicated server this way, especially with Unreal Engine, ASE ASA etc.

xiaoshaoxiaoshao commented 7 months ago

我找到一个项目可以自动生成config github: https://github.com/DysonCheng/PalWorldSettingGenerator web: https://dysoncheng.github.io/PalWorldSettingGenerator/setting.html 我昨天生成 config.ini 以后删掉了 ServerPassword 字段(因为我没有设置密码,他配置文件中是这样的 ServerPassword="")以后就成功应用配置了 可以考虑用这个试试

ComputersWithTimo commented 7 months ago

After deleting it, it recreated the PalWorldSettings.ini with all the keys, but it didn't copy the env variables into it. These are the default settings. Also, when I edit these files and restart with ALWAYS_UPDATE_ON_START=false, it doesn't have any effect. My server is still not password protected, even if I have a password set.

@Nevaehni Did you add the line breaks yourself? They are not allowed in the PalWorldSettings file. The "OptionsSettings" should just be a single line, otherwise it won't work.

See: https://tech.palworldgame.com/optimize-game-balance

Edit: Also, I think the region variable doesn't actually work in the game yet. I kept it default which is ,Region="", and it works fine. There is no region selection for community servers (yet?)

jammsen commented 7 months ago

After deleting it, it recreated the PalWorldSettings.ini with all the keys, but it didn't copy the env variables into it. These are the default settings. Also, when I edit these files and restart with ALWAYS_UPDATE_ON_START=false, it doesn't have any effect. My server is still not password protected, even if I have a password set.

@Nevaehni Did you add the line breaks yourself? They are not allowed in the PalWorldSettings file. The "OptionsSettings" should just be a single line, otherwise it won't work.

See: https://tech.palworldgame.com/optimize-game-balance

Edit: Also, I think the region variable doesn't actually work in the game yet. I kept it default which is ,Region="", and it works fine. There is no region selection for community servers (yet?)

I guess its reserved for the "official" server that working with theese files too. Maybe down the line for us, who knows 😄

jammsen commented 7 months ago

This issue should be solved with the commit and release from earlier today.

You can find it here https://github.com/jammsen/docker-palworld-dedicated-server/commit/8546c890a518c99ab9be13b35a876c01ddaa7bde#diff-3b41cd2eeb76ac64c4b71b9cc6b253b358ab737f50d54e333b631ca27357e98e

Im closing this issue als resolved, feel free to try it out and reopen again if needed.

If you like this project, please consider giving this repo and the docker-hub-repo a Star.