From a6e30557b99e43ed73d6a31f6ee36e74ee92c023 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Fri, 19 Jan 2024 18:22:08 +0100 Subject: [PATCH 1/3] add community server options --- Dockerfile | 6 +++++- README.md | 14 +++++++++----- docker-compose.yml | 7 ++++--- scripts/start.sh | 32 ++++++++++++++++++++++++++------ 4 files changed, 44 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7ebe636..d1fe406 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,11 @@ RUN apt-get update && apt-get install -y \ ENV PORT=8211 \ PLAYERS=16 \ - MULTITHREADING=FALSE + MULTITHREADING=false \ + COMMUNITY=false \ + PUBLIC_IP= \ + PUBLIC_PORT= \ + SERVER_PASSWORD= COPY ./scripts/* /home/steam/server/ RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh diff --git a/README.md b/README.md index 28fd8cf..8f85fc5 100644 --- a/README.md +++ b/README.md @@ -60,11 +60,15 @@ It is highly recommended you set the following environment values before startin * PORT * MULTITHREADING -| Variable | Info | Default Values | Allowed Values | -|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|----------------| -| 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 | -| 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 | +| Variable | Info | Default Values | Allowed Values | +|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|----------------| +| 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 | +| 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 | +| PUBLIC_PORT | You can manually specify the port number 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 | +| SERVER_PASSWORD | Secure your community server with a password | | string | *highly recommended to set diff --git a/docker-compose.yml b/docker-compose.yml index 7bf5891..836f619 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ services: palworld: - image: thijsvanloef/palworld-server-docker + image: thijsvanloef/palworld-server-docker:latest restart: unless-stopped container_name: palworld-server ports: @@ -9,6 +9,7 @@ services: environment: - PORT=8211 - PLAYERS=16 - - MULTITHREADING=FALSE + - MULTITHREADING=false + - COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD! volumes: - - /path/to/your/palworld/folder:/palworld/ \ No newline at end of file + - ./palworld:/palworld/ \ No newline at end of file diff --git a/scripts/start.sh b/scripts/start.sh index b5b0283..1e1ead1 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,13 +1,33 @@ #!/bin/sh + STARTCOMMAND="./PalServer.sh -port=${PORT} -players=${PLAYERS}" -printf "\e[0;32m*****STARTING SERVER*****\e[0m" -cd /palworld || exit +if [ "${COMMUNITY}" = true ]; then + STARTCOMMAND="${STARTCOMMAND} EpicApp=PalServer" +fi + +if [ -n "${PUBLIC_IP}" ]; then + STARTCOMMAND="${STARTCOMMAND} -publicip=${PUBLIC_IP}" +fi + +if [ -n "${PUBLIC_PORT}" ]; then + STARTCOMMAND="${STARTCOMMAND} -publiport=${PUBLIC_PORT}" +fi + +if [ -n "${SERVER_PASSWORD}" ]; then + STARTCOMMAND="${STARTCOMMAND} -serverpassword=${SERVER_PASSWORD}" +fi if [ "${MULTITHREADING}" = true ]; then - su steam -c "${STARTCOMMAND} -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS" -else - su steam -c "${STARTCOMMAND}" -fi \ No newline at end of file + STARTCOMMAND="${STARTCOMMAND} -useperfthreads -NoAsyncLoadingThread -UseMultithreadForDS" +fi + +cd /palworld || exit + +echo "${STARTCOMMAND}" + +printf "\e[0;32m*****STARTING SERVER*****\e[0m" + +su steam -c "${STARTCOMMAND}" From cc01920bb5dc0f6254d4ebd7e2b8a8295d70f6aa Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Fri, 19 Jan 2024 18:24:41 +0100 Subject: [PATCH 2/3] cleanup apt --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index d1fe406..28c42e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ FROM cm2network/steamcmd:root LABEL maintainer="thijs@loef.dev" -RUN apt-get update && apt-get install -y \ - xdg-user-dirs +RUN apt-get update && apt-get install -y --no-install-recommends \ + xdg-user-dirs \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* ENV PORT=8211 \ From 3345ef3f01a8930aedba119a66172a125d3ce709 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Fri, 19 Jan 2024 18:28:18 +0100 Subject: [PATCH 3/3] pin xdg version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 28c42e9..188a38c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM cm2network/steamcmd:root LABEL maintainer="thijs@loef.dev" RUN apt-get update && apt-get install -y --no-install-recommends \ - xdg-user-dirs \ + xdg-user-dirs=0.17-2 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/*