Skip to content

Commit

Permalink
Changed formating, jammsen#27 Added backup solution
Browse files Browse the repository at this point in the history
  • Loading branch information
jammsen committed Jan 23, 2024
1 parent d1365a0 commit 192656c
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 17 deletions.
27 changes: 24 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
FROM cm2network/steamcmd
FROM cm2network/steamcmd:root

LABEL org.opencontainers.image.authors="Sebastian Schmidt"
LABEL org.opencontainers.image.source="https://github.com/jammsen/docker-palworld-dedicated-server"

RUN apt-get update \
&& apt-get install -y --no-install-recommends 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

USER steam

ENV TIMEZONE=Europe/Berlin \
DEBIAN_FRONTEND=noninteractive \
PUID=0 \
Expand All @@ -18,14 +37,16 @@ ENV TIMEZONE=Europe/Berlin \
SERVER_NAME=jammsen-docker-generated-###RANDOM### \
SERVER_DESCRIPTION="Palworld-Dedicated-Server running in Docker by jammsen" \
SERVER_PASSWORD=serverPasswordHere \
ADMIN_PASSWORD=adminPasswordHere

ADMIN_PASSWORD=adminPasswordHere \
BACKUP_ENABLED=true \
BACKUP_CRON_EXPRESSION="0 * * * *"

VOLUME [ "/palworld" ]

EXPOSE 8211/udp
EXPOSE 25575/tcp

ADD --chmod=777 servermanager.sh /servermanager.sh
ADD --chmod=777 backupmanager.sh /backupmanager.sh

CMD ["/servermanager.sh"]
34 changes: 20 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,22 @@ This includes a Palworld Dedicated Server based on Linux and Docker.
5. After first start, stop the server, setup your config at `game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini` and start it again

## Environment-Variables
| Variable | Describe | Default Value | Allowed Value |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | ------------- |
| ALWAYS_UPDATE_ON_START | Updates the server on startup | true | false/true |
| MAX_PLAYERS | Maximum amout of players | 32 | 1-32 |
| MULTITHREAD_ENABLED | Sets options for "Improved multi-threaded CPU performance" | true | false/true |
| COMMUNITY_SERVER | Sets the server to a "Community-Server". If true, the server will appear in the Community-Serverlist. Needs PUBLIC_IP and PUBLIC_PORT | true | false/true |
| RCON_ENABLED | RCON function - use ADMIN_PASSWORD to login after enabling it | true | false/true |
| RCON_PORT | RCON port to connect to | 25575 | 1024-65535 |
| PUBLIC_IP | Public ip, auto-detect if not specified, see COMMUNITY_SERVER | 10.0.0.1 | ip address |
| PUBLIC_PORT | Public port, auto-detect if not specified, see COMMUNITY_SERVER | 8211 | 1024-65535 |
| SERVER_NAME | Name of the server | jammsen-docker-generated-###RANDOM### | string |
| SERVER_DESCRIPTION | Desription of the server | Palworld-Dedicated-Server running in Docker by jammsen | string |
| SERVER_PASSWORD | Password of the server | serverPasswordHere | string |
| ADMIN_PASSWORD | Admin password of the server | adminPasswordHere | string |
| Variable | Describe | Default Value | Allowed Value |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | --------------- |
| ALWAYS_UPDATE_ON_START | Updates the server on startup | true | false/true |
| MAX_PLAYERS | Maximum amout of players | 32 | 1-32 |
| MULTITHREAD_ENABLED | Sets options for "Improved multi-threaded CPU performance" | true | false/true |
| COMMUNITY_SERVER | Sets the server to a "Community-Server". If true, the server will appear in the Community-Serverlist. Needs PUBLIC_IP and PUBLIC_PORT | true | false/true |
| RCON_ENABLED | RCON function - use ADMIN_PASSWORD to login after enabling it | true | false/true |
| RCON_PORT | RCON port to connect to | 25575 | 1024-65535 |
| PUBLIC_IP | Public ip, auto-detect if not specified, see COMMUNITY_SERVER | 10.0.0.1 | ip address |
| PUBLIC_PORT | Public port, auto-detect if not specified, see COMMUNITY_SERVER | 8211 | 1024-65535 |
| SERVER_NAME | Name of the server | jammsen-docker-generated-###RANDOM### | string |
| SERVER_DESCRIPTION | Desription of the server | Palworld-Dedicated-Server running in Docker by jammsen | string |
| SERVER_PASSWORD | Password of the server | serverPasswordHere | string |
| ADMIN_PASSWORD | Admin password of the server | adminPasswordHere | string |
| BACKUP_ENABLED | Backup function, creates backups in your `game` directory | true | false/true |
| BACKUP_CRON_EXPRESSION | Needs a Cron-Expression - See https://github.com/aptible/supercronic#crontab-format or https://crontab-generator.org/ | 0 * * * * (meaning every hour) | Cron-Expression |

Look at https://tech.palworldgame.com/optimize-game-balance for more information and config-settings in `game/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini`

Expand Down Expand Up @@ -84,6 +86,8 @@ services:
- SERVER_DESCRIPTION=Palworld-Dedicated-Server running in Docker by jammsen
- SERVER_PASSWORD=serverPasswordHere
- ADMIN_PASSWORD=adminPasswordHere
- BACKUP_ENABLED=true
- BACKUP_CRON_EXPRESSION=0 * * * *
volumes:
- ./game:/palworld
```
Expand Down Expand Up @@ -119,6 +123,8 @@ services:
- SERVER_DESCRIPTION=Palworld-Dedicated-Server running in Docker by jammsen
- SERVER_PASSWORD=serverPasswordHere
- ADMIN_PASSWORD=adminPasswordHere
- BACKUP_ENABLED=true
- BACKUP_CRON_EXPRESSION=0 * * * *
volumes:
- ./game:/palworld

Expand Down
9 changes: 9 additions & 0 deletions backupmanager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

DATE=$(date +%Y%m%d_%H%M%S)

# Create backup dir and change into it
mkdir -p /palworld/backups && cd /palworld/Pal
echo ">>> Creating backup"
tar cfz /palworld/backups/saved-$DATE.tar.gz Saved/
echo ">>> Done"
6 changes: 6 additions & 0 deletions servermanager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ function startServer() {
}

function startMain() {
if [[ -n $BACKUP_ENABLED ]] && [[ $BACKUP_ENABLED == "true" ]]; then
# Preparing the cronlist file
echo "$BACKUP_CRON_EXPRESSION /backupmanager.sh" >> cronlist
# Making sure supercronic is enabled and the cronfile is loaded
/usr/local/bin/supercronic cronlist &
fi
# Check if server is installed, if not try again
if [ ! -f "/palworld/PalServer.sh" ]; then
installServer
Expand Down

0 comments on commit 192656c

Please sign in to comment.