Skip to content

Commit

Permalink
output rcon.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
win5923 committed Feb 18, 2024
1 parent 37aae95 commit fc6aa67
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 37 deletions.
72 changes: 38 additions & 34 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Unit-test
on: # yamllint disable-line rule:truthy
pull_request:
workflow_call:
push:
branches: [unittest]

concurrency:
group: '${{ github.workflow }} @ ${{ github.ref }}'
Expand Down Expand Up @@ -59,76 +57,79 @@ jobs:
fi
echo "Waiting for server to start..."
sleep 30
sleep 5
done
- 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
if [ ! $RCON_PORT == $YAML_PORT ]; then
echo "Error: $RCON_PORT in .env.example does not match $YAML_PORT in rcon.yaml."
exit 1
exit 2
fi
if [[ "$ADMIN_PASSWORD" == "$YAML_PASSWORD" ]]; then
if [ ! "$ADMIN_PASSWORD" == "$YAML_PASSWORD" ]; then
echo "Error: $ADMIN_PASSWORD in .env.example does not match $YAML_PASSWORD in rcon.yaml."
exit 1
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 -it palworld-server rcon-cli "Broadcast test" 2>&1)
OUTPUT=$(docker exec palworld-server rcon-cli "Broadcast test" 2>&1)
if [[ $OUTPUT != *"Broadcasted: test"* ]]; then
echo "Error: Unexpected output - $OUTPUT"
exit 1
exit 5
fi
OUTPUT=$(docker exec -it palworld-server rcon-cli save 2>&1)
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
exit 10
fi
- name: Test if PalWorldSettings.ini is valid
run: |
if [ ! -f ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini ]; then
echo "Error: PalWorldSettings.ini file is missing."
exit 1
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 1
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
exit 13
fi
unit-test-arm64:
Expand Down Expand Up @@ -183,74 +184,77 @@ jobs:
fi
echo "Waiting for server to start..."
sleep 30
sleep 5
done
- 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
if [ ! $RCON_PORT == $YAML_PORT ]; then
echo "Error: $RCON_PORT in .env.example does not match $YAML_PORT in rcon.yaml."
exit 1
exit 2
fi
if [[ "$ADMIN_PASSWORD" == "$YAML_PASSWORD" ]]; then
if [ ! "$ADMIN_PASSWORD" == "$YAML_PASSWORD" ]; then
echo "Error: $ADMIN_PASSWORD in .env.example does not match $YAML_PASSWORD in rcon.yaml."
exit 1
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 -it palworld-server rcon-cli "Broadcast test" 2>&1)
OUTPUT=$(docker exec palworld-server rcon-cli "Broadcast test" 2>&1)
if [[ $OUTPUT != *"Broadcasted: test"* ]]; then
echo "Error: Unexpected output - $OUTPUT"
exit 1
exit 5
fi
OUTPUT=$(docker exec -it palworld-server rcon-cli save 2>&1)
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
exit 10
fi
- name: Test if PalWorldSettings.ini is valid
run: |
if [ ! -f ./palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini ]; then
echo "Error: PalWorldSettings.ini file is missing."
exit 1
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 1
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
exit 13
fi
17 changes: 14 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,19 @@ services:
ports:
- 8211:8211/udp
- 27015:27015/udp # Required if you want your server to show up in the community servers tab
# - 25575:25575/tcp # Required if you want to use RCON
env_file:
- .env.example
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"
volumes:
- ./palworld:/palworld/

0 comments on commit fc6aa67

Please sign in to comment.