Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
thijsvanloef authored Feb 11, 2024
2 parents b5cc887 + 76e3100 commit 5d23811
Show file tree
Hide file tree
Showing 22 changed files with 241 additions and 753 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ AUTO_UPDATE_ENABLED=false
AUTO_UPDATE_CRON_EXPRESSION=0 * * * *
AUTO_UPDATE_WARN_MINUTES=30
AUTO_REBOOT_ENABLED=false
AUTO_REBOOT_EVEN_IF_PLAYERS_ONLINE=false
AUTO_REBOOT_WARN_MINUTES=5
AUTO_REBOOT_CRON_EXPRESSION=0 0 * * *

Expand Down
34 changes: 1 addition & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Release
on: # yamllint disable-line rule:truthy
on: # yamllint disable-line rule:truthy
release:
types: [published]

Expand Down Expand Up @@ -91,35 +91,3 @@ jobs:
platforms: linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}

# Generates a new release specifically for the helm chart, using the helm charts version
# Only generates a new release if the helm charts version has changed since the last release
# Will then update the gh-pages branch & helm repository
release-helm:
name: Release - Helm chart
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Git - Configure
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
# Will push updates to a index.yaml file in the gh-pages branch
- name: Helm - chart-releaser
uses: helm/[email protected]
with:
charts_dir: charts
pages_branch: gh-pages
mark_as_latest: false
skip_existing: true
config: ./charts/cr.yaml
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
199 changes: 199 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
---
name: Unit-test
on: # yamllint disable-line rule:truthy
pull_request:
workflow_call:

jobs:
unit-test-amd64:
name: Docker - Test (amd64)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
load: true
tags: ${{ github.run_id }}
platforms: linux/amd64

- name: Run server
run: |
docker run -d \
--name palworld-server \
-p 8211:8211/udp \
-p 27015:27015/udp \
-p 25575:25575/tcp \
-v ./palworld:/palworld/ \
-e PUID=1000 \
-e PGID=1000 \
-e PORT=8211 \
-e PLAYERS=16 \
-e MULTITHREADING=true \
-e RCON_ENABLED=true \
-e RCON_PORT=25575 \
-e TZ=UTC \
-e ADMIN_PASSWORD="adminPasswordHere" \
-e SERVER_PASSWORD="worldofpals" \
-e COMMUNITY=false \
-e SERVER_NAME="World of Pals" \
-e SERVER_DESCRIPTION="palworld-server-docker by Thijs van Loef" \
--restart unless-stopped \
--stop-timeout 30 \
${{ github.run_id }}
- name: Wait for server to start
run: |
TIMEOUT_SECONDS=120
START_TIME=$(date +%s)
while ! docker logs palworld-server 2>&1 | grep -q "Setting breakpad minidump AppID"; do
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
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
fi
echo "Waiting for server to start..."
sleep 5
done
- name: Test if server is up and running
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
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
- name: Test the backup command functions
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
- 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
unit-test-arm64:
name: Docker - Test (arm64)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
file: ./Dockerfile.arm64
load: true
tags: ${{ github.run_id }}
platforms: linux/arm64

- name: Run server
run: |
docker run -d \
--name palworld-server \
--platform linux/arm64 \
-p 8211:8211/udp \
-p 27015:27015/udp \
-p 25575:25575/tcp \
-v ./palworld:/palworld/ \
-e PUID=1000 \
-e PGID=1000 \
-e PORT=8211 \
-e PLAYERS=16 \
-e MULTITHREADING=true \
-e RCON_ENABLED=true \
-e RCON_PORT=25575 \
-e TZ=UTC \
-e ADMIN_PASSWORD="adminPasswordHere" \
-e SERVER_PASSWORD="worldofpals" \
-e COMMUNITY=false \
-e SERVER_NAME="World of Pals" \
-e SERVER_DESCRIPTION="palworld-server-docker by Thijs van Loef" \
--restart unless-stopped \
--stop-timeout 30 \
${{ github.run_id }}
- name: Wait for server to start
run: |
TIMEOUT_SECONDS=400
START_TIME=$(date +%s)
while ! docker logs palworld-server 2>&1 | grep -q "Setting breakpad minidump AppID"; do
CURRENT_TIME=$(date +%s)
ELAPSED_TIME=$((CURRENT_TIME - START_TIME))
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
fi
echo "Waiting for server to start..."
sleep 5
done
- name: Test if server is up and running
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
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
- name: Test the backup command functions
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
- 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
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ ENV PORT= \
AUTO_UPDATE_WARN_MINUTES=30 \
AUTO_REBOOT_ENABLED=false \
AUTO_REBOOT_WARN_MINUTES=5 \
AUTO_REBOOT_EVEN_IF_PLAYERS_ONLINE=false \
AUTO_REBOOT_CRON_EXPRESSION="0 0 * * *" \
DISCORD_WEBHOOK_URL= \
DISCORD_CONNECT_TIMEOUT=30 \
Expand Down
1 change: 1 addition & 0 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ ENV PORT= \
AUTO_UPDATE_WARN_MINUTES=30 \
AUTO_REBOOT_ENABLED=false \
AUTO_REBOOT_WARN_MINUTES=5 \
AUTO_REBOOT_EVEN_IF_PLAYERS_ONLINE=false \
AUTO_REBOOT_CRON_EXPRESSION="0 0 * * *" \
DISCORD_WEBHOOK_URL= \
DISCORD_CONNECT_TIMEOUT=30 \
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

[![Docker Hub](https://img.shields.io/badge/Docker_Hub-palworld-blue?logo=docker)](https://hub.docker.com/r/thijsvanloef/palworld-server-docker)
[![GHCR](https://img.shields.io/badge/GHCR-palworld-blue?logo=docker)](https://github.com/thijsvanloef/palworld-server-docker/pkgs/container/palworld-server-docker)
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/palworld)](https://artifacthub.io/packages/search?repo=palworld)
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/palworld-server-chart)](https://artifacthub.io/packages/search?repo=palworld-server-chart)

[Chat with the community on Discord](https://discord.gg/UxBxStPAAE)

Expand Down Expand Up @@ -73,19 +73,19 @@ services:
- 8211:8211/udp
- 27015:27015/udp
environment:
- PUID=1000
- PGID=1000
- PORT=8211 # Optional but recommended
- PLAYERS=16 # Optional but recommended
- SERVER_PASSWORD=worldofpals # Optional but recommended
- MULTITHREADING=true
- RCON_ENABLED=true
- RCON_PORT=25575
- TZ=UTC
- ADMIN_PASSWORD=adminPasswordHere
- COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD!
- SERVER_NAME=World of Pals
- SERVER_DESCRIPTION=palworld-server-docker by Thijs van Loef
PUID: 1000
PGID: 1000
PORT: 8211 # Optional but recommended
PLAYERS: 16 # Optional but recommended
SERVER_PASSWORD: "worldofpals" # Optional but recommended
MULTITHREADING: true
RCON_ENABLED: true
RCON_PORT: 25575
TZ: "UTC"
ADMIN_PASSWORD: "adminPasswordHere"
COMMUNITY: false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD!
SERVER_NAME: "World of Pals"
SERVER_DESCRIPTION: "palworld-server-docker by Thijs van Loef"
volumes:
- ./palworld:/palworld/
```
Expand Down Expand Up @@ -162,7 +162,7 @@ Follow the steps in the [README.md here](k8s/readme.md) to deploy it.

#### Using helm chart

Follow up the docs on the [README.md for the helm chart](./charts/palworld/README.md) to deploy.
The official helm chart can be found in a seperate repository, [palworld-server-chart](https://github.com/Twinki14/palworld-server-chart)

### Environment variables

Expand Down Expand Up @@ -203,6 +203,7 @@ It is highly recommended you set the following environment values before startin
| AUTO_REBOOT_CRON_EXPRESSION | Setting affects frequency of automatic updates. | 0 0 \* \* \* | Needs a Cron-Expression - See [Configuring Automatic Backups with Cron](#configuring-automatic-reboots-with-cron) |
| AUTO_REBOOT_ENABLED | Enables automatic reboots | false | true/false |
| AUTO_REBOOT_WARN_MINUTES | How long to wait to reboot the server, after the player were informed. | 5 | !0 |
| AUTO_REBOOT_EVEN_IF_PLAYERS_ONLINE | Restart the Server even if there are players online. | false | true/false |
| DISCORD_WEBHOOK_URL | Discord webhook url found after creating a webhook on a discord server | | `https://discord.com/api/webhooks/<webhook_id>` |
| DISCORD_CONNECT_TIMEOUT | Discord command initial connection timeout | 30 | !0 |
| DISCORD_MAX_TIMEOUT | Discord total hook timeout | 30 | !0 |
Expand Down
2 changes: 0 additions & 2 deletions charts/cr.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions charts/palworld/Chart.yaml

This file was deleted.

Loading

0 comments on commit 5d23811

Please sign in to comment.