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
898 stars 151 forks source link

[Bug Report] Container exits with code 1 if unable to set backup directory permissions #198

Closed nomad64 closed 4 months ago

nomad64 commented 4 months ago

Have you read the Important information text above

Current behavior

My current docker-compose.yaml file defines the following (I removed the game options for simplicity):

version: '3.9'
services:
  palword-server-jnk:
    container_name: palworld-server-jnk
    image: jammsen/palworld-dedicated-server:latest
    restart: unless-stopped
    hostname: palworld-server
    ports:
      - 8211:8211/udp
      - 27015:27015/udp
    environment:
      - TZ=America/Chicago
      - PUID=1000
      - PGID=1000
      - ALWAYS_UPDATE_ON_START=true
      - MULTITHREAD_ENABLED=true
      - COMMUNITY_SERVER=true
      - BACKUP_ENABLED=true
      - BACKUP_CRON_EXPRESSION=0 * * * *
      - BACKUP_RETENTION_POLICY=true
      - BACKUP_RETENTION_AMOUNT_TO_KEEP=45
      - SERVER_SETTINGS_MODE=auto
      - STEAMCMD_VALIDATE_FILES=false
      - NETSERVERMAXTICKRATE=120
      - RCON_ENABLED=true
      - RCON_PORT=25575
    volumes:
      - /palworld:/palworld
      - /mnt/palworld_bkups/backups:/palworld/backups

Note that I export the backup volume to a different path. The destination is a Synology NAS NFS share that does not permit chown operations. The user running the container (1000) has permissions to write into that directory. When the container starts up, it tries to chown the app directory, which includes the backup path. This operation fails and the container exits.

Desired behavior

While the container files should be chown'd at startup to match PUID and PGID, failures for the backup path should not cause the container to exit.

Links to screenshots

No response

To Reproduce

Steps to reproduce the behavior:

  1. Create container with the /palworld/backups directory redirected to a file system that does not allow chown operations. This can be done via all_squash or root_squash.
  2. Set BACKUP_ENABLED to true
  3. Start container

Software setup

Hardware setup

Additional context

Container output:

> Current steam user PUID is '1000' and PGID is '1000'
> PUID and PGID matching what is requested for user steam
chown: changing ownership of '/palworld/backups/palworld-save-2024-01-26_20-22-34.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/palworld-save-2024-01-26_22-49-56.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_090000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_100000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_110000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_120000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_130000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_140000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_150000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_180000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_190000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_200000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_210000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240203_220000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240204_090000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240204_100000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240204_110000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240204_120000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240204_130000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240204_140000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240204_200000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240204_210000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240204_220000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240206_070000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240206_123014.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240206_150000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240206_160000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240206_200000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240207_180000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240207_190000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240207_200000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240207_210000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240207_220000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240208_190000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240208_200000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240208_210000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240208_220000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240209_090000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240209_100000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240209_130000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240210_090000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240210_100000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240210_110000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240211_100000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240211_110000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240211_190000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240212_150000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups/saved-20240212_160000.tar.gz': Operation not permitted
chown: changing ownership of '/palworld/backups': Operation not permitted
jammsen commented 4 months ago

Hey @nomad64 - This change was to support dynamic UID/GID switching for other problems with QNAP and Synology NAS'ses.

If you now go ahead and create an edge-case thats based upon that 1 directory doesnt support no permission-changes im not sure how to help here. Im really trying to help everyone out, but some edge-cases are just to weird to be supported in a docker-image to be honest.

Possible solution: You could just go ahead and leave the directory local and the retention-policy mor conservative and use a cron/hourly to move the backups to the desired location.

jammsen commented 4 months ago

Hey @nomad64 - Can this issue be closed?

nomad64 commented 4 months ago

@jammsen Sorry for the delay in getting back to you, life has been busy lately.

I understand the situation and that my setup is more of an edge case. I honestly can't remember why I setup squash for that mount and will have to revisit that config. In the interim, I simply removed the volume export for /palworld/backups and will make some Ansible changes to move the files to the correct place on server shutdown.

Keep up the great work on this container! :+1:

jammsen commented 4 months ago

Thanks, good luck, Happy to help!