From 88787803218fc40531032ace51cc378873c74767 Mon Sep 17 00:00:00 2001 From: Donald Webster Date: Sat, 20 Jan 2024 22:08:00 -0800 Subject: [PATCH 1/3] Add PUID and PGID to palworld docker image. --- Dockerfile | 4 +++- scripts/init.sh | 18 ++++++++++++------ scripts/start.sh | 6 ++---- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index be1bd3e72..e7b707b2c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* ENV PORT=8211 \ + PUID=1000 \ + PGID=1000 \ PLAYERS=16 \ MULTITHREADING=false \ COMMUNITY=false \ @@ -23,4 +25,4 @@ RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh WORKDIR /home/steam/server EXPOSE ${PORT} -ENTRYPOINT ["/home/steam/server/init.sh"] \ No newline at end of file +ENTRYPOINT ["/home/steam/server/init.sh"] diff --git a/scripts/init.sh b/scripts/init.sh index 53918b8dd..ebf0a8d30 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,14 +1,20 @@ -#!/bin/sh +#!/bin/bash -mkdir -p /palworld +if [[ ! "${PUID}" -eq 0 ]] && [[ ! "${PGID}" -eq 0 ]]; then + echo "Executing usermod..." + usermod -o -u "${PUID}" steam + groupmod -o -g "${PGID}" steam +else + echo "Running as root is not supported, please fix your PUID and PGID!" + exit 1 +fi +mkdir -p /palworld chown -R steam:steam /palworld if [ "${UPDATE_ON_BOOT}" = true ]; then - printf "\e[0;32m*****STARTING INSTALL/UPDATE*****\e[0m" - /home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit - + su steam -c '/home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit' fi -./start.sh \ No newline at end of file +./start.sh diff --git a/scripts/start.sh b/scripts/start.sh index 6d0d92c9f..ecc6183b3 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,9 +1,7 @@ -#!/bin/sh - +#!/bin/bash STARTCOMMAND="./PalServer.sh -port=${PORT} -players=${PLAYERS}" - if [ "${COMMUNITY}" = true ]; then STARTCOMMAND="${STARTCOMMAND} EpicApp=PalServer" fi @@ -30,7 +28,7 @@ fi if [ "${MULTITHREADING}" = true ]; then STARTCOMMAND="${STARTCOMMAND} -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS" -fi +fi cd /palworld || exit From 7407ef922227aa4313ead632b4332fbfd339aaf1 Mon Sep 17 00:00:00 2001 From: Donald Webster Date: Sat, 20 Jan 2024 22:22:30 -0800 Subject: [PATCH 2/3] Update REAME.md and example docker-compose.yml file. --- README.md | 8 +++++++- docker-compose.yml | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a70ae03ae..e582184a1 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ services: - 27015:27015/udp environment: - PORT=8211 + - PUID=1000 + - PGID=1000 - PLAYERS=16 - MULTITHREADING=FALSE - COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD! @@ -55,6 +57,8 @@ docker run -d \ -v ./:/palworld/ \ -e PLAYERS=16 \ -e PORT=8211 \ + -e PUID=1000 \ + -e PGID=1000 \ -e COMMUNITY=false \ --restart unless-stopped \ thijsvanloef/palworld-server-docker @@ -74,6 +78,8 @@ It is highly recommended you set the following environment values before startin | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | -------------- | | PLAYERS* | Max amount of players that are able to join the server | 16 | 1-31 | | PORT* | UDP port that the server will expose | 8211 | 1024-65535 | +| PUID* | The uid of the user the server should run as | 8211 | 1024-65535 | +| PGID* | The gid of the group the server should run as | 8211 | 1024-65535 | | MULTITHREADING** | Improves performance in multi-threaded CPU environments. It is effective up to a maximum of about 4 threads, and allocating more than this number of threads does not make much sense. | false | true/false | | COMMUNITY | Whether or not the server shows up in the community server browser (USE WITH SERVER_PASSWORD) | false | true/false | | PUBLIC_IP | 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. | | x.x.x.x | @@ -101,4 +107,4 @@ Issues/Feature requests can be submitted by using [this link](https://github.com ### Known Issues -Known issues are listed in the [wiki](https://github.com/thijsvanloef/palworld-server-docker/wiki/Known-Issues) \ No newline at end of file +Known issues are listed in the [wiki](https://github.com/thijsvanloef/palworld-server-docker/wiki/Known-Issues) diff --git a/docker-compose.yml b/docker-compose.yml index 241e26c0c..50df93831 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,8 @@ services: - 27015:27015/udp environment: - PORT=8211 + - PUID=1000 + - PGID=1000 - PLAYERS=16 - MULTITHREADING=false - UPDATE_ON_BOOT=true @@ -17,4 +19,4 @@ services: # - SERVER_NAME="World of Pals" # - ADMIN_PASSWORD="someAdminPassword" volumes: - - ./palworld:/palworld/ \ No newline at end of file + - ./palworld:/palworld/ From 49bf6edc9b507f6ffe129600a4b3ece2a43d50ba Mon Sep 17 00:00:00 2001 From: Donald Webster Date: Sat, 20 Jan 2024 23:34:37 -0800 Subject: [PATCH 3/3] Specify default values for PUID and PGID and that they cant be 0 (root). --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e582184a1..c7a3c4502 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,8 @@ It is highly recommended you set the following environment values before startin | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | -------------- | | PLAYERS* | Max amount of players that are able to join the server | 16 | 1-31 | | PORT* | UDP port that the server will expose | 8211 | 1024-65535 | -| PUID* | The uid of the user the server should run as | 8211 | 1024-65535 | -| PGID* | The gid of the group the server should run as | 8211 | 1024-65535 | +| PUID* | The uid of the user the server should run as | 1000 | !0 | +| PGID* | The gid of the group the server should run as | 1000 | !0 | | MULTITHREADING** | Improves performance in multi-threaded CPU environments. It is effective up to a maximum of about 4 threads, and allocating more than this number of threads does not make much sense. | false | true/false | | COMMUNITY | Whether or not the server shows up in the community server browser (USE WITH SERVER_PASSWORD) | false | true/false | | PUBLIC_IP | 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. | | x.x.x.x |