Skip to content

Commit

Permalink
finalized PR jammsen#179 before merge to develop
Browse files Browse the repository at this point in the history
  • Loading branch information
jammsen committed Feb 9, 2024
1 parent 4b3e678 commit e565fd6
Show file tree
Hide file tree
Showing 19 changed files with 173 additions and 311 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ body:
attributes:
label: Desired behavior
description: Remember, im not familiar with your setup, your permission, your Docker settings and all that kind of stuff, please provide a clear description of what your desired outcome is.
placeholder: Desried ...
placeholder: Desired behavior ...
validations:
required: true
- type: textarea
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 2024-02-09
* **Breaking changes:**
* Changed the default BACKUP_RETENTION_POLICY to true and changed BACKUP_RETENTION_AMOUNT_TO_KEEP to 72, meaning 3 days worth of backup are kept in the default configuration
* Added the ability to change the PUID and PGID via environment variables, this includes a user-process-jail mechanic including entrypoint-script, which makes sure that the gameserver is always working with the right permissions as only user steam and not root by accident or bug
* Mayor refactoring of the code-base to enable more feature requests based around automatic restarts and such. This includes:
* Adding new backupmanager
* Adding color-based echos and feedback-signals by color
* New structure and comments of Dockerfile environment variables
* New structure and comments of default.env template
* Added shell linting
* Changed structure of the project and where files like documentation, includes, scripts and config-templates are to find
* Fixed typos in various documents

## 2024-02-03

* Added changes to shutdown-webhook notifications (#120)
Expand Down
120 changes: 61 additions & 59 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,32 @@ LABEL maintainer="Sebastian Schmidt - https://github.com/jammsen/docker-palworld
LABEL org.opencontainers.image.authors="Sebastian Schmidt"
LABEL org.opencontainers.image.source="https://github.com/jammsen/docker-palworld-dedicated-server"

# Export the ARG variables to the environment
ENV GAME_ROOT="/palworld" \
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ENV DEBIAN_FRONTEND=noninteractive \
# Path-vars
GAME_ROOT="/palworld" \
GAME_PATH="/palworld/Pal" \
GAME_SAVE_PATH="/palworld/Pal/Saved" \
GAME_CONFIG_PATH="/palworld/Pal/Saved/Config/LinuxServer" \
GAME_SETTINGS_FILE="/palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini" \
GAME_ENGINE_FILE="/palworld/Pal/Saved/Config/LinuxServer/Engine.ini" \
BACKUP_PATH="/palworld/backups"

RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests procps xdg-user-dirs \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*


# Latest releases available at https://github.com/aptible/supercronic/releases
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.29/supercronic-linux-amd64 \
SUPERCRONIC=supercronic-linux-amd64 \
SUPERCRONIC_SHA1SUM=cd48d45c4b10f3f0bfdd3a57d054cd05ac96812b

RUN curl -fsSLO "$SUPERCRONIC_URL" \
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \
&& chmod +x "$SUPERCRONIC" \
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic

# Latest releases available at https://github.com/gorcon/rcon-cli/releases
ENV RCON_URL=https://github.com/gorcon/rcon-cli/releases/download/v0.10.3/rcon-0.10.3-amd64_linux.tar.gz \
RCON_TGZ=rcon-0.10.3-amd64_linux.tar.gz \
RCON_TGZ_MD5SUM=8601c70dcab2f90cd842c127f700e398 \
RCON_BINARY=rcon

RUN curl -fsSLO "$RCON_URL" \
&& echo "${RCON_TGZ_MD5SUM} ${RCON_TGZ}" | md5sum -c - \
&& tar xfz rcon-0.10.3-amd64_linux.tar.gz \
&& chmod +x "rcon-0.10.3-amd64_linux/$RCON_BINARY" \
&& mv "rcon-0.10.3-amd64_linux/$RCON_BINARY" "/usr/local/bin/${RCON_BINARY}" \
&& rm -Rf rcon-0.10.3-amd64_linux rcon-0.10.3-amd64_linux.tar.gz

COPY --chown=steam:steam --chmod=755 scripts/ /scripts
COPY --chown=steam:steam --chmod=755 includes/ /includes
COPY --chown=steam:steam --chmod=755 configs/rcon.yaml /home/steam/steamcmd/rcon.yaml
COPY --chown=steam:steam --chmod=755 entrypoint.sh /

RUN ln -s /scripts/backupmanager.sh /usr/local/bin/backupmanager \
&& ln -s /scripts/backup.sh /usr/local/bin/backup \
&& ln -s /scripts/rconcli.sh /usr/local/bin/rconcli


ENV DEBIAN_FRONTEND=noninteractive \
STEAMCMD_PATH="/home/steam/steamcmd" \
RCON_CONFIG_FILE="/home/steam/steamcmd/rcon.yaml" \
BACKUP_PATH="/palworld/backups" \
# Container-setttings
PUID=1000 \
PGID=1000 \
### Container-setttings
TZ="Europe/Berlin" \
TZ="Europe/Berlin" \
# SteamCMD-settings
ALWAYS_UPDATE_ON_START=true \
STEAMCMD_VALIDATE_FILES=true \
MULTITHREAD_ENABLED=true \
### Backup-settings
# Backup-settings
BACKUP_ENABLED=true \
BACKUP_CRON_EXPRESSION="0 * * * *" \
BACKUP_RETENTION_POLICY=false \
BACKUP_RETENTION_AMOUNT_TO_KEEP=30 \
### Webhook-settings
BACKUP_RETENTION_POLICY=true \
BACKUP_RETENTION_AMOUNT_TO_KEEP=72 \
# Webhook-settings
WEBHOOK_ENABLED=false \
WEBHOOK_URL= \
WEBHOOK_START_TITLE="Server is starting" \
Expand All @@ -85,12 +47,14 @@ ENV DEBIAN_FRONTEND=noninteractive \
WEBHOOK_UPDATE_VALIDATION_TITLE="Updating and validating server" \
WEBHOOK_UPDATE_VALIDATION_DESCRIPTION="Server is being updated and validated" \
WEBHOOK_UPDATE_VALIDATION_COLOR="2849520" \
### Server-setting
# Gameserver-start-settings
MULTITHREAD_ENABLED=true \
COMMUNITY_SERVER=true \
# Config-setting - Warning: Every setting below here will be affected!
SERVER_SETTINGS_MODE=manual \
# Engine.ini
# Engine.ini settings
NETSERVERMAXTICKRATE=120 \
# PalWorldSettings.ini
# PalWorldSettings.ini settings
DIFFICULTY=None \
DAYTIME_SPEEDRATE=1.000000 \
NIGHTTIME_SPEEDRATE=1.000000 \
Expand Down Expand Up @@ -157,9 +121,47 @@ ENV DEBIAN_FRONTEND=noninteractive \
EXPOSE 8211/udp
EXPOSE 25575/tcp

VOLUME ["${GAME_ROOT}"]
COPY --chown=steam:steam --chmod=755 scripts/ /scripts
COPY --chown=steam:steam --chmod=755 includes/ /includes
COPY --chown=steam:steam --chmod=755 configs/rcon.yaml /home/steam/steamcmd/rcon.yaml
COPY --chown=steam:steam --chmod=755 entrypoint.sh /

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN ln -s /scripts/backupmanager.sh /usr/local/bin/backupmanager \
&& ln -s /scripts/backup.sh /usr/local/bin/backup \
&& ln -s /scripts/rconcli.sh /usr/local/bin/rconcli

# Install minimum required packages for dedicated server
RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests procps xdg-user-dirs \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Latest releases available at https://github.com/aptible/supercronic/releases
ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0.2.29/supercronic-linux-amd64 \
SUPERCRONIC=supercronic-linux-amd64 \
SUPERCRONIC_SHA1SUM=cd48d45c4b10f3f0bfdd3a57d054cd05ac96812b

RUN curl -fsSLO "$SUPERCRONIC_URL" \
&& echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \
&& chmod +x "$SUPERCRONIC" \
&& mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \
&& ln -s "/usr/local/bin/${SUPERCRONIC}" /usr/local/bin/supercronic

# Latest releases available at https://github.com/gorcon/rcon-cli/releases
ENV RCON_URL=https://github.com/gorcon/rcon-cli/releases/download/v0.10.3/rcon-0.10.3-amd64_linux.tar.gz \
RCON_TGZ=rcon-0.10.3-amd64_linux.tar.gz \
RCON_TGZ_MD5SUM=8601c70dcab2f90cd842c127f700e398 \
RCON_BINARY=rcon

RUN curl -fsSLO "$RCON_URL" \
&& echo "${RCON_TGZ_MD5SUM} ${RCON_TGZ}" | md5sum -c - \
&& tar xfz rcon-0.10.3-amd64_linux.tar.gz \
&& chmod +x "rcon-0.10.3-amd64_linux/$RCON_BINARY" \
&& mv "rcon-0.10.3-amd64_linux/$RCON_BINARY" "/usr/local/bin/${RCON_BINARY}" \
&& rm -Rf rcon-0.10.3-amd64_linux rcon-0.10.3-amd64_linux.tar.gz

VOLUME ["${GAME_ROOT}"]

ENTRYPOINT ["/entrypoint.sh"]
CMD [ "/scripts/servermanager.sh" ]
CMD ["/scripts/servermanager.sh"]
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,16 @@ See [example docker-compose.yml](docker-compose.yml).

## Run RCON commands

> [!NOTE]
> Please research the RCON-Commands on the official source: https://tech.palworldgame.com/server-commands
Open a shell into your container via `docker exec -ti palworld-dedicated-server bash`, then you can run commands against the gameserver via the command `rconcli`

```shell
$:~/steamcmd$ rconcli showplayers
name,playeruid,steamid
$:~/steamcmd$ rconcli info
Welcome to Pal Server[v0.1.3.0] jammsen-docker-generated-20384
Welcome to Pal Server[v0.1.4.1] jammsen-docker-generated-20384
$:~/steamcmd$ rconcli save
Complete Save
```
Expand All @@ -111,14 +114,12 @@ $ docker exec palworld-dedicated-server rconcli showplayers
name,playeruid,steamid

$ docker exec palworld-dedicated-server rconcli info
Welcome to Pal Server[v0.1.3.0] jammsen-docker-generated-20384
Welcome to Pal Server[v0.1.4.1] jammsen-docker-generated-20384

$ docker exec palworld-dedicated-server rconcli save
Complete Save
```

> **Important:** Please research the RCON-Commands on the official source: https://tech.palworldgame.com/server-commands
## Backup Manager

> [!WARNING]
Expand All @@ -140,43 +141,44 @@ Examples:

```shell
$ docker exec palworld-dedicated-server backup
>> Backup 'saved-20240203_032855.tar.gz' created successfully.
> Backup 'saved-20240203_032855.tar.gz' created successfully.
```

```shell
$ docker exec palworld-dedicated-server backup list
>> Listing 2 backup file(s)!
> Listing 2 backup file(s)!
2024-02-03 03:28:55 | saved-20240203_032855.tar.gz
2024-02-03 03:28:00 | saved-20240203_032800.tar.gz
```

```shell
$ docker exec palworld-dedicated-server backup_clean 3
>> 1 backup(s) cleaned, keeping 2 backups(s).
> 1 backup(s) cleaned, keeping 2 backups(s).
```

```shell
$ docker exec palworld-dedicated-server backup_list
>> Listing 1 out of backup 2 file(s).
> Listing 1 out of backup 2 file(s).
2024-02-03 03:30:00 | saved-20240203_033000.tar.gz
```

## Webhook integration

To enable webhook integration, you need to set the following environment variables in the `default.env`:
To enable webhook integrations, you need to set the following environment variables in the `default.env`:

```shell
WEBHOOK_ENABLED=true
WEBHOOK_URL="https://your.webhook.url"
```

After that the server should send messages in a Discord-Compatible way to your webhook.
After enabling the server should send messages in a Discord-Compatible way to your webhook url.

> You can find more details about these variables [here](/docs/ENV_VARS.md#webhook-settings).
### Supported events

- Server starting
- Server starting
- This even is not server started. Just add like 5 seconds on top and the server is online
- Server stopped
- Server updating
- Server updating and validating
Expand Down Expand Up @@ -208,11 +210,11 @@ A Helm chart to deploy this container can be found at [palworld-helm](https://gi
> This is a confirmed bug. Changing `BaseCampWorkerMaxNum` in the `PalWorldSettings.ini` has no effect on the server. There are tools out there to help with this, like this one: <https://github.com/legoduded/palworld-worldoptions>
> [!WARNING]
> Adding `WorldOption.sav` will break `PalWorldSetting.ini`. So any new changes to the settings (either on the file or via ENV VARS), you will have to create a new `WorldOption.sav` and update it everytime for those changes to have effect.
> Adding `WorldOption.sav` will break `PalWorldSetting.ini`. So any new changes to the settings (either on the file or via ENV VARS), you will have to create a new `WorldOption.sav` and update it every time for those changes to have an effect.
## Planned features in the future

- Feel free to suggest something
- Feel free to suggest something. Under `Issues` there is a Feature Request issue-type.

## Software used

Expand Down
26 changes: 12 additions & 14 deletions default.env
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# Change this for logging and backup, see "Environment variables" in the README.md
TZ=Europe/Berlin
# Container-setttings
TZ=Europe/Berlin
# SteamCMD-settings
ALWAYS_UPDATE_ON_START=true
MULTITHREAD_ENABLED=true
STEAMCMD_VALIDATE_FILES=true

### Backups
# Backup-settings
BACKUP_ENABLED=true
BACKUP_CRON_EXPRESSION=0 * * * *
BACKUP_RETENTION_POLICY=false
BACKUP_RETENTION_AMOUNT_TO_KEEP=30

### Webhook Settings
BACKUP_RETENTION_POLICY=true
BACKUP_RETENTION_AMOUNT_TO_KEEP=72
# Webhook-settings
WEBHOOK_ENABLED=false
WEBHOOK_URL="YOUR-URL-IN-HERE"
WEBHOOK_START_TITLE="Server is starting"
Expand All @@ -28,14 +26,14 @@ WEBHOOK_UPDATE_COLOR="2849520"
WEBHOOK_UPDATE_VALIDATION_TITLE="Updating and validating server"
WEBHOOK_UPDATE_VALIDATION_DESCRIPTION="Server is being updated and validated"
WEBHOOK_UPDATE_VALIDATION_COLOR="2849520"

### Server Settings
# Gameserver-start-settings
MULTITHREAD_ENABLED=true
COMMUNITY_SERVER=true
# Change this to manual if you want to edit your configs directly on file
# Config-setting - Warning: Every setting below here will be affected!
SERVER_SETTINGS_MODE=auto
# Engine.ini
# Engine.ini settings
NETSERVERMAXTICKRATE=120
# PalWorldSettings.ini
# PalWorldSettings.ini settings
DIFFICULTY=None
DAYTIME_SPEEDRATE=1.000000
NIGHTTIME_SPEEDRATE=1.000000
Expand Down
Loading

0 comments on commit e565fd6

Please sign in to comment.