Skip to content

Commit

Permalink
Merge branch 'main' into feature-target-manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsvanloef authored Feb 18, 2024
2 parents d7417f8 + 16c52bf commit 32178ab
Show file tree
Hide file tree
Showing 34 changed files with 1,451 additions and 52 deletions.
163 changes: 122 additions & 41 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
file: ./Dockerfile
load: true
tags: ${{ github.run_id }}
platforms: linux/amd64
Expand All @@ -41,7 +42,7 @@ jobs:
- name: Wait for server to start
run: |
TIMEOUT_SECONDS=120
TIMEOUT_SECONDS=180
START_TIME=$(date +%s)
while ! docker logs palworld-server 2>&1 | grep -q "Setting breakpad minidump AppID"; do
Expand All @@ -50,46 +51,86 @@ jobs:
if [ $ELAPSED_TIME -gt $TIMEOUT_SECONDS ]; then
echo "Timeout reached. Server failed to start within $TIMEOUT_SECONDS seconds."
exit 1 # or handle the failure accordingly
printf "\e[0;32m%s\e[0m\n" "*****Container LOGS*****"
docker logs palworld-server
exit 1
fi
echo "Waiting for server to start..."
sleep 5
done
- name: Test if server is up and running
- name: Test if rcon.yaml is valid
run: |
printf "\e[0;32m%s\e[0m\n" "*****RCON.YAML*****"
docker exec palworld-server cat /home/steam/server/rcon.yaml
RCON_PORT=$(docker exec palworld-server env | grep RCON_PORT | cut -d'=' -f2)
ADMIN_PASSWORD=$(docker exec palworld-server env | grep ADMIN_PASSWORD | cut -d'=' -f2)
YAML_PORT=$(docker exec palworld-server cat /home/steam/server/rcon.yaml | grep "^ address:" | awk '{print $2}' | cut -d ':' -f2 | tr -d '"')
YAML_PASSWORD=$(docker exec palworld-server cat /home/steam/server/rcon.yaml | grep "^ password:" | awk '{print $2}' | tr -d '"')
if [ ! $RCON_PORT == $YAML_PORT ]; then
echo "Error: $RCON_PORT in .env.example does not match $YAML_PORT in rcon.yaml."
exit 2
fi
if [ ! "$ADMIN_PASSWORD" == "$YAML_PASSWORD" ]; then
echo "Error: $ADMIN_PASSWORD in .env.example does not match $YAML_PASSWORD in rcon.yaml."
exit 3
fi
- name: Test if rcon works
run: |
sleep 5
if ! docker exec palworld-server rcon-cli Info | grep -q "Welcome to Pal Server"; then
echo "Server may not have started successfully."
exit 1
exit 4
fi
OUTPUT=$(docker exec palworld-server rcon-cli "Broadcast test" 2>&1)
if [[ $OUTPUT != *"Broadcasted: test"* ]]; then
echo "Error: Unexpected output - $OUTPUT"
exit 5
fi
OUTPUT=$(docker exec palworld-server rcon-cli save 2>&1)
if [[ $OUTPUT != *"Complete Save"* ]]; then
echo "Error: Unexpected output - $OUTPUT"
exit 6
fi
- name: Test if port 8211, 27015 and 25575 are listening
run: |
nc -z -u -v 127.0.0.1 8211 || exit 1
nc -z -u -v 127.0.0.1 27015 || exit 1
nc -z -v 127.0.0.1 25575 || exit 1
nc -z -u -v 127.0.0.1 8211 || exit 7
nc -z -u -v 127.0.0.1 27015 || exit 8
nc -z -v 127.0.0.1 25575 || exit 9
- name: Test the backup script
run: |
docker exec palworld-server backup
if [ ! -f ./palworld/backups/palworld-save-*.tar.gz ]; then
echo "Backup file not found. Backup command may have failed."
exit 1
fi
docker exec palworld-server backup
if [ ! -f ./palworld/backups/palworld-save-*.tar.gz ]; then
echo "Backup file not found. Backup command may have failed."
exit 10
fi
- name: Test if PalWorldSettings.ini is valid
run: |
if ! grep -q "\[\/Script\/Pal.PalGameWorldSettings\]" ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then
echo "Error: PalWorldSettings.ini is missing the required section [/Script/Pal.PalGameWorldSettings]."
exit 1
fi
if [ ! -f ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini ]; then
echo "Error: PalWorldSettings.ini file is missing."
exit 11
fi
if ! grep -q "\[\/Script\/Pal.PalGameWorldSettings\]" ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then
echo "Error: PalWorldSettings.ini is missing the required section [/Script/Pal.PalGameWorldSettings]."
exit 12
fi
if ! grep -q "^OptionSettings=\(.*\)" ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then
echo "Error: PalWorldSettings.ini is missing or has an invalid OptionSettings section."
exit 1
fi
if ! grep -q "^OptionSettings=\(.*\)" ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then
echo "Error: PalWorldSettings.ini is missing or has an invalid OptionSettings section."
exit 13
fi
unit-test-arm64:
name: Docker - Test (arm64)
Expand Down Expand Up @@ -128,7 +169,7 @@ jobs:
- name: Wait for server to start
run: |
TIMEOUT_SECONDS=600
TIMEOUT_SECONDS=660
START_TIME=$(date +%s)
while ! docker logs palworld-server 2>&1 | grep -q "Setting breakpad minidump AppID"; do
Expand All @@ -137,43 +178,83 @@ jobs:
if [ $ELAPSED_TIME -gt $TIMEOUT_SECONDS ]; then
echo "Timeout reached. Server failed to start within $TIMEOUT_SECONDS seconds."
exit 1 # or handle the failure accordingly
printf "\e[0;32m%s\e[0m\n" "*****Container LOGS*****"
docker logs palworld-server
exit 1
fi
echo "Waiting for server to start..."
sleep 5
done
- name: Test if server is up and running
- name: Test if rcon.yaml is valid
run: |
printf "\e[0;32m%s\e[0m\n" "*****RCON.YAML*****"
docker exec palworld-server cat /home/steam/server/rcon.yaml
RCON_PORT=$(docker exec palworld-server env | grep RCON_PORT | cut -d'=' -f2)
ADMIN_PASSWORD=$(docker exec palworld-server env | grep ADMIN_PASSWORD | cut -d'=' -f2)
YAML_PORT=$(docker exec palworld-server cat /home/steam/server/rcon.yaml | grep "^ address:" | awk '{print $2}' | cut -d ':' -f2 | tr -d '"')
YAML_PASSWORD=$(docker exec palworld-server cat /home/steam/server/rcon.yaml | grep "^ password:" | awk '{print $2}' | tr -d '"')
if [ ! $RCON_PORT == $YAML_PORT ]; then
echo "Error: $RCON_PORT in .env.example does not match $YAML_PORT in rcon.yaml."
exit 2
fi
if [ ! "$ADMIN_PASSWORD" == "$YAML_PASSWORD" ]; then
echo "Error: $ADMIN_PASSWORD in .env.example does not match $YAML_PASSWORD in rcon.yaml."
exit 3
fi
- name: Test if rcon works
run: |
sleep 100
if ! docker exec palworld-server rcon-cli Info | grep -q "Welcome to Pal Server"; then
echo "Server may not have started successfully."
exit 1
exit 4
fi
OUTPUT=$(docker exec palworld-server rcon-cli "Broadcast test" 2>&1)
if [[ $OUTPUT != *"Broadcasted: test"* ]]; then
echo "Error: Unexpected output - $OUTPUT"
exit 5
fi
OUTPUT=$(docker exec palworld-server rcon-cli save 2>&1)
if [[ $OUTPUT != *"Complete Save"* ]]; then
echo "Error: Unexpected output - $OUTPUT"
exit 6
fi
- name: Test if port 8211, 27015 and 25575 are listening
run: |
nc -z -u -v 127.0.0.1 8211 || exit 1
nc -z -u -v 127.0.0.1 27015 || exit 1
nc -z -v 127.0.0.1 25575 || exit 1
nc -z -u -v 127.0.0.1 8211 || exit 7
nc -z -u -v 127.0.0.1 27015 || exit 8
nc -z -v 127.0.0.1 25575 || exit 9
- name: Test the backup script
run: |
docker exec palworld-server backup
if [ ! -f ./palworld/backups/palworld-save-*.tar.gz ]; then
echo "Backup file not found. Backup command may have failed."
exit 1
fi
docker exec palworld-server backup
if [ ! -f ./palworld/backups/palworld-save-*.tar.gz ]; then
echo "Backup file not found. Backup command may have failed."
exit 10
fi
- name: Test if PalWorldSettings.ini is valid
run: |
if ! grep -q "\[\/Script\/Pal.PalGameWorldSettings\]" ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then
echo "Error: PalWorldSettings.ini is missing the required section [/Script/Pal.PalGameWorldSettings]."
exit 1
fi
if ! grep -q "^OptionSettings=\(.*\)" ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then
echo "Error: PalWorldSettings.ini is missing or has an invalid OptionSettings section."
exit 1
fi
if [ ! -f ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini ]; then
echo "Error: PalWorldSettings.ini file is missing."
exit 11
fi
if ! grep -q "\[\/Script\/Pal.PalGameWorldSettings\]" ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then
echo "Error: PalWorldSettings.ini is missing the required section [/Script/Pal.PalGameWorldSettings]."
exit 12
fi
if ! grep -q "^OptionSettings=\(.*\)" ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini; then
echo "Error: PalWorldSettings.ini is missing or has an invalid OptionSettings section."
exit 13
fi
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ RUN chmod +x /home/steam/server/*.sh && \
mv /home/steam/server/restore.sh /usr/local/bin/restore

WORKDIR /home/steam/server
RUN touch rcon.yaml crontab && \
chmod o+w rcon.yaml crontab && \
chown steam:steam -R /home/steam && \
chmod -R o+w /home/steam/steamcmd

HEALTHCHECK --start-period=5m \
CMD pgrep "PalServer-Linux" > /dev/null || exit 1
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,29 @@ All files you will need to deploy this container to kubernetes are located in th

Follow the steps in the [README.md here](k8s/readme.md) to deploy it.

### Running without root

This is only for advanced users

It is possible to run this container and
[override the default user](https://docs.docker.com/engine/reference/run/#user) which is root in this image.

Because you are specifiying the user and group `PUID` and `PGID` are ignored.

If you want to find your UID: `id -u`
If you want to find your GID: `id -g`

You must set user to `NUMBERICAL_UID:NUMBERICAL_GID`

Below we assume your UID is 1000 and your GID is 1001

* In docker run add `--user 1000:1001 \` above the last line.
* In docker compose add `user: 1000:1001` above ports.

If you wish to run it with a different UID/GID than your own you will need to change the ownership of the directory that
is being bind: `chown UID:GID palworld/`
or by changing the permissions for all other: `chmod o=rwx palworld/`

#### Using helm chart

The official helm chart can be found in a seperate repository, [palworld-server-chart](https://github.com/Twinki14/palworld-server-chart)
Expand Down
26 changes: 26 additions & 0 deletions docusaurus/docs/guides/running-without-root.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
sidebar_position: 6
---

# Running without root

This is only for advanced users

It is possible to run this container and
[override the default user](https://docs.docker.com/engine/reference/run/#user) which is root in this image.

Because you are specifiying the user and group `PUID` and `PGID` are ignored.

If you want to find your UID: `id -u`
If you want to find your GID: `id -g`

You must set user to `NUMBERICAL_UID:NUMBERICAL_GID`

Below we assume your UID is 1000 and your GID is 1001

* In docker run add `--user 1000:1001 \` above the last line.
* In docker compose add `user: 1000:1001` above ports.

If you wish to run it with a different UID/GID than your own you will need to change the ownership of the directory that
is being bind: `chown UID:GID palworld/`
or by changing the permissions for all other: `chmod o=rwx palworld/`
5 changes: 4 additions & 1 deletion docusaurus/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const config = {
// may want to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
locales: ['en', 'ko', 'zh', 'nl'],
locales: ['en', 'ko', 'zh', 'nl', 'de'],
localeConfigs:{
en: {
label: 'English',
Expand All @@ -45,6 +45,9 @@ const config = {
nl: {
label: 'Dutch',
},
de: {
label: 'Deutsch'
}
}
},

Expand Down
Loading

0 comments on commit 32178ab

Please sign in to comment.