Skip to content

Commit

Permalink
refactoring of most of the code-base, added changelog, added user-jai…
Browse files Browse the repository at this point in the history
…ls for UID/PID swapping, added backupmanager by thejcpalma, updated rcon behavior and documentation
  • Loading branch information
jammsen committed Feb 12, 2024
1 parent 285982e commit a6bca49
Show file tree
Hide file tree
Showing 12 changed files with 258 additions and 208 deletions.
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## 2024-02-09
[Back to main](README.md#changelog)

## 2024-02-12
* **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
Expand All @@ -12,10 +14,17 @@
* 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
* Requirements - What you need to do:
* **Read the readme, a lot has changed, there is a new part about the backupmanager and how to interact now with rconcli**
* Update to latest image
* Download new docker-compose.yml and new default.env
* Merge your settings and make sure that backup-settings, PGID and PUID are right

## 2024-02-03

* Added changes to shutdown-webhook notifications (#120)
* Added rcon.sh again for having alias function calls that dont bloat the servermanager
* Refactored how webhook messages function are called and added alias functions
* Added a changelog, from various request resources

[Back to main](README.md#changelog)
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ 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" \
# Config-setting - Warning: Every setting below here will be affected!
SERVER_SETTINGS_MODE=manual \
# 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 settings
NETSERVERMAXTICKRATE=120 \
# PalWorldSettings.ini settings
Expand Down Expand Up @@ -121,19 +121,20 @@ ENV DEBIAN_FRONTEND=noninteractive \
EXPOSE 8211/udp
EXPOSE 25575/tcp

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 /
COPY --chmod=744 entrypoint.sh /
COPY --chmod=755 scripts/ /scripts
COPY --chmod=755 includes/ /includes
COPY --chmod=755 configs/rcon.yaml /home/steam/steamcmd/rcon.yaml

RUN ln -s /scripts/backupmanager.sh /usr/local/bin/backup \
RUN mkdir -p "$BACKUP_PATH" \
&& ln -s /scripts/backupmanager.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 install -y --no-install-recommends --no-install-suggests gosu procps xdg-user-dirs \
&& apt-get autoremove -y --purge \
&& 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
Expand Down
57 changes: 30 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ ___
- [How to ask for support for this Docker image](#how-to-ask-for-support-for-this-docker-image)
- [Requirements](#requirements)
- [Minimum system requirements](#minimum-system-requirements)
- [Changelog](#changelog)
- [Getting started](#getting-started)
- [Environment variables](#environment-variables)
- [Docker-Compose examples](#docker-compose-examples)
Expand Down Expand Up @@ -68,17 +69,26 @@ To run this Docker image, you need a basic understanding of Docker, Docker-Compo
| RAM | 8GB RAM Base + 2GB per player | 12GB RAM Base + 2GB per player |
| Storage | 30GB | 30GB+ |

## Changelog

You can find the [changelog here](CHANGELOG.md)

## Getting started

1. Create a `game` sub-directory on your Docker-Node in your game-server-directory (Example: `/srv/palworld`).
- This directory will be used to store the game server files, including configs and savegames.
2. Set up Port-Forwarding or NAT for the ports in the Docker-Compose file.
3. Pull the latest version of the image with `docker pull jammsen/palworld-dedicated-server:latest`.
4. Download the [docker-compose.yml](docker-compose.yml) and [default.env](default.env).
5. Set up the `docker-compose.yml` and `default.env` to your liking.
- Refer to the [Environment-Variables](#environment-variables) section for more information.
6. Start the container via `docker-compose up -d && docker-compose logs -f`.
- Watch the log, if no errors occur you can close the logs with ctrl+c.
1. Create a `game` sub-directory on your Docker-Node in your game-server-directory
- (Examples: `/srv/palworld`, `/opt/palworld` or `/home/username/palworld`)
- This directory will be used to store the game server files, including configs and savegames
- In older versions we asked you to setup permissions via CHMOD or CHOWN, this should not be needed anymore!
2. Set up Port-Forwarding or NAT for the ports in the Docker-Compose file
3. Pull the latest version of the image with `docker pull jammsen/palworld-dedicated-server:latest`
4. Download the [docker-compose.yml](docker-compose.yml) and [default.env](default.env)
5. Set up the `docker-compose.yml` and `default.env` to your liking
- Make sure you setup PUID and PGID according to the user you want to use
- **PUID and PGID 0 will error out, thats on purpose!**
- if you use Docker as root, then you can just use 1000 inside the container
- Refer to the [Environment-Variables](#environment-variables) section for more information
6. Start the container via `docker-compose up -d && docker-compose logs -f`
- Watch the log, if no errors occur you can close the logs with ctrl+c
7. Now have fun and happy gaming! 🎮😉

## Environment variables
Expand All @@ -96,18 +106,7 @@ See [example docker-compose.yml](docker-compose.yml).
> [!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.4.1] jammsen-docker-generated-20384
$:~/steamcmd$ rconcli save
Complete Save
```

You can also use `docker exec palworld-dedicated-server rconcli <command>` right on your terminal/shell.
You can use `docker exec palworld-dedicated-server rconcli <command>` right on your terminal/shell.

```shell
$ docker exec palworld-dedicated-server rconcli showplayers
Expand All @@ -123,13 +122,17 @@ Complete Save
## Backup Manager

> [!WARNING]
> If RCON is disabled, the backup manager won't do saves via RCON before creating a backup.
> If RCON is disabled, the backup manager won't do saves via RCON before creating a backup and will report warnings.
> This means that the backup will be created from the last auto-save of the server.
> This can lead to data-loss and/or savegame corruption.
>
> **Recommendation:** Please make sure that RCON is enabled before using the backup manager.
Usage: `docker exec palworld-dedicated-server backup [command] [arguments]`
> [!WARNING]
> Please use in the following part always the `-user steam` option or your files will written as root

Usage: `docker exec -user steam palworld-dedicated-server backup [command] [arguments]`

| Command | Argument | Required/Optional | Default Value | Values | Description |
| ------- | ------------------ | ----------------- | --------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
Expand All @@ -140,24 +143,24 @@ Usage: `docker exec palworld-dedicated-server backup [command] [arguments]`
Examples:

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

```shell
$ docker exec palworld-dedicated-server backup list
$ docker exec -user steam palworld-dedicated-server backup list
> 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
$ docker exec -user steam palworld-dedicated-server backup_clean 3
> 1 backup(s) cleaned, keeping 2 backups(s).
```

```shell
$ docker exec palworld-dedicated-server backup_list
$ docker exec -user steam palworld-dedicated-server backup_list
> Listing 1 out of backup 2 file(s).
2024-02-03 03:30:00 | saved-20240203_033000.tar.gz
```
Expand Down
6 changes: 4 additions & 2 deletions default.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Container-setttings
PUID=1000
PGID=1000
TZ=Europe/Berlin
# SteamCMD-settings
ALWAYS_UPDATE_ON_START=true
Expand Down Expand Up @@ -26,11 +28,11 @@ 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"
# Config-setting - Warning: Every setting below here will be affected!
SERVER_SETTINGS_MODE=auto
# Gameserver-start-settings
MULTITHREAD_ENABLED=true
COMMUNITY_SERVER=true
# Config-setting - Warning: Every setting below here will be affected!
SERVER_SETTINGS_MODE=auto
# Engine.ini settings
NETSERVERMAXTICKRATE=120
# PalWorldSettings.ini settings
Expand Down
Loading

0 comments on commit a6bca49

Please sign in to comment.