Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master Dev Merge #264

Merged
merged 8 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

[Back to main](README.md#changelog)

## 2024-04-28

- Log-Rotation by @Gornoka (#261)
- Throw error when not run as root by @StaleLoafOfBread (#246)
- Minimise user write access to container service file @Callum027 (#241)

## 2024-04-09

- Exclude save backup directory in backup @Dashboy1998 (#259)
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ RUN apt-get update \
COPY --chmod=755 entrypoint.sh /
COPY --chmod=755 scripts/ /scripts
COPY --chmod=755 includes/ /includes
COPY --chmod=755 configs/rcon.yaml /home/steam/steamcmd/rcon.yaml
COPY --chmod=755 configs/PalWorldSettings.ini.template /
COPY --chmod=644 configs/rcon.yaml /home/steam/steamcmd/rcon.yaml
COPY --chmod=644 configs/PalWorldSettings.ini.template /
COPY --chmod=755 gosu-amd64 /usr/local/bin/gosu

RUN mkdir -p "$BACKUP_PATH" \
Expand Down
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ services:
container_name: palworld-dedicated-server
image: jammsen/palworld-dedicated-server:latest
restart: unless-stopped
logging:
driver: "local"
options:
max-size: "10m"
max-file: "3"
ports:
- target: 8211 # Gamerserver port inside of the container
published: 8211 # Gamerserver port on your host
Expand Down
12 changes: 7 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
# shellcheck disable=SC1091
# https://stackoverflow.com/questions/27669950/difference-between-euid-and-uid

set -e

Expand All @@ -9,24 +10,25 @@ APP_HOME=/home/$APP_USER

source /includes/colors.sh

if [[ "${EUID}" -ne 0 ]]; then
ee ">>> This Docker-Container must be run as root! Please adjust how you started the container, to fix this error."
exit 1
fi

if [[ "${PUID}" -eq 0 ]] || [[ "${PGID}" -eq 0 ]]; then
ee ">>> Running Palworld as root is not supported, please fix your PUID and PGID!"
exit 1
elif [[ "$(id -u steam)" -ne "${PUID}" ]] || [[ "$(id -g steam)" -ne "${PGID}" ]]; then
ew "> Current $APP_USER user PUID is '$(id -u steam)' and PGID is '$(id -g steam)'"
ew "> Setting new $APP_USER user PUID to '${PUID}' and PGID to '${PGID}'"
groupmod -g "${PGID}" "$APP_GROUP" && usermod -u "${PUID}" -g "${PGID}" "$APP_USER"
else
else
ew "> Current $APP_USER user PUID is '$(id -u steam)' and PGID is '$(id -g steam)'"
ew "> PUID and PGID matching what is requested for user $APP_USER"
fi

chown -R "$APP_USER":"$APP_GROUP" "$APP_HOME"
chown -R "$APP_USER":"$APP_GROUP" "$GAME_ROOT"
chown "$APP_USER":"$APP_GROUP" /entrypoint.sh
chown "$APP_USER":"$APP_GROUP" /PalWorldSettings.ini.template
chown -R "$APP_USER":"$APP_GROUP" /scripts
chown -R "$APP_USER":"$APP_GROUP" /includes

ew_nn "> id steam: " ; e "$(id steam)"

Expand Down
2 changes: 1 addition & 1 deletion includes/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function setup_palworld_settings_ini() {
fi
# Copy default-config, which comes with SteamCMD to gameserver save location
ew "> Copying PalWorldSettings.ini.template to ${GAME_SETTINGS_FILE}"
cp "${PALWORLD_TEMPLATE_FILE}" "${GAME_SETTINGS_FILE}"
cp --no-preserve=ownership "${PALWORLD_TEMPLATE_FILE}" "${GAME_SETTINGS_FILE}"

if [[ -n ${DIFFICULTY+x} ]]; then
e "> Setting Difficulty to '$DIFFICULTY'"
Expand Down