From e8705206815f88a7dbc329d5b6c632aae2a9b488 Mon Sep 17 00:00:00 2001 From: Guillaume Barreau Date: Wed, 24 Jan 2024 23:35:13 -0500 Subject: [PATCH 01/34] feat: feat --- .DS_Store | Bin 0 -> 6148 bytes Dockerfile | 10 ++++++++++ docker-compose.yml | 3 ++- scripts/backup.sh | 13 ++++++++++++- scripts/init.sh | 2 ++ scripts/start.sh | 2 ++ 6 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5d1b9ee718f408069dad176a9032def1329130ef GIT binary patch literal 6148 zcmeHK%Wl&^6upxKVz)wy5J=r1Sz;SP3bX>Tanoc`sj#RKEC2;NHel8DM7D#4qDWrD zKky4|`z8ICuHek0QsRKvRS}vi-8ths_s-+Y%R@wLFbj8yIz(ha1-7=3{6R#y&^2jj ziw$J5j)*dPKojD0w&raNh5^ICrZFJ)?rjROV<&V<%lmfZZL4i+P zah?QMc|Uj^N9DM4=a8p`AE!|!1L81(%eyym8uD_$XK9$rSWgvLwq=hyJM;OI$NODp zZ+CCeb>`0=^}7xXi-m37z5np}$@nxmOZhj90m5+RO1Y)+3Ir!>Jbdx8G~wwdl!-W- zPQd5^X6*&AhZ(Lh)exS`Gu*~%n1It53>WoTlk4Hf(t1F!kqu`+uODlB!~1EvXBaRH zTt5Tid~l!wU5%AOd2}F=PXJ&GW+}*v-vbfjXmmAJ3Q+=KDio+fnSNq06%MI0sps7AP;{G4~{r$fhWWEdohJpWz0oEFN z!vTh*@7A@!iM!T;et-%Qew9KQf<#}(G9#|y9jFwPIU)meHC75?ftViwNrOoY1J}yH EZz?jV*#H0l literal 0 HcmV?d00001 diff --git a/Dockerfile b/Dockerfile index 5978229..320e884 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,6 +11,16 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN wget -q https://github.com/itzg/rcon-cli/releases/download/1.6.4/rcon-cli_1.6.4_linux_amd64.tar.gz -O - | tar -xz RUN mv rcon-cli /usr/bin/rcon-cli + +RUN rm -f /var/run/crond.pid +RUN apt-get update && apt-get -y install cron + +COPY ./scripts/backup.sh /usr/local/bin/backup +RUN chmod +x /usr/local/bin/backup +RUN echo "*/1 * * * * /usr/local/bin/backup\n" > /etc/cron.d/backups-cron +RUN chmod 0644 /etc/cron.d/backups-cron +RUN crontab /etc/cron.d/backups-cron + ENV PORT= \ PUID=1000 \ PGID=1000 \ diff --git a/docker-compose.yml b/docker-compose.yml index 7dc7136..64dcdb8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ services: palworld: - image: thijsvanloef/palworld-server-docker:latest + image: test/palworld-server-docker:latest + build: . restart: unless-stopped container_name: palworld-server ports: diff --git a/scripts/backup.sh b/scripts/backup.sh index 9cca792..29be637 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -1,8 +1,19 @@ #!/bin/bash +printf "\e[0;34m***** RUNNING SCRIPTS backup.sh *****\e[0m\n" + DATE=$(date +"%Y-%m-%d_%H-%M-%S") -FILE_PATH="/palworld/backups/palworld-save-${DATE}.tar.gz" +DESTINATION_PATH="/palworld/backups" +FILE_PATH="${DESTINATION_PATH}/backup_palworld_${DATE}.tar.gz" + +if [ ! -f ${FILE_PATH} ]; then + printf "\e[0;32m***** CREATING BACKUPS FOLDER *****\e[0m\n" + mkdir -p "${DESTINATION_PATH}" +fi + cd /palworld/Pal/ || exit tar -zcf "$FILE_PATH" "Saved/" echo "backup created at $FILE_PATH" + +find "${DESTINATION_PATH}" -type f -name "backup_palworld_*.tar.gz" -ctime +7 -exec rm -f {} \; \ No newline at end of file diff --git a/scripts/init.sh b/scripts/init.sh index f1b5bf2..32a7840 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,5 +1,7 @@ #!/bin/bash +printf "\e[0;34m***** RUNNING SCRIPTS init.sh *****\e[0m\n" + if [[ ! "${PUID}" -eq 0 ]] && [[ ! "${PGID}" -eq 0 ]]; then printf "\e[0;32m*****EXECUTING USERMOD*****\e[0m\n" usermod -o -u "${PUID}" steam diff --git a/scripts/start.sh b/scripts/start.sh index 9159076..411e522 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,5 +1,7 @@ #!/bin/bash +printf "\e[0;34m***** RUNNING SCRIPTS start.sh *****\e[0m\n" + STARTCOMMAND="./PalServer.sh" if [ -n "${PORT}" ]; then From 9868ce72334b663faf2b0c40c51dfade3eb5bfdf Mon Sep 17 00:00:00 2001 From: Guillaume Barreau Date: Thu, 25 Jan 2024 02:25:14 -0500 Subject: [PATCH 02/34] feat: :sparkles: Add cron command for DockerFile --- Dockerfile | 7 ++----- README.md | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 320e884..f8e52f9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,21 +5,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xdg-user-dirs=0.17-2 \ procps=2:3.3.17-5 \ wget=1.21-1+deb11u1 \ + && apt-get install -y cron \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* RUN wget -q https://github.com/itzg/rcon-cli/releases/download/1.6.4/rcon-cli_1.6.4_linux_amd64.tar.gz -O - | tar -xz RUN mv rcon-cli /usr/bin/rcon-cli - RUN rm -f /var/run/crond.pid -RUN apt-get update && apt-get -y install cron - COPY ./scripts/backup.sh /usr/local/bin/backup RUN chmod +x /usr/local/bin/backup -RUN echo "*/1 * * * * /usr/local/bin/backup\n" > /etc/cron.d/backups-cron +RUN echo "0 3 * * * root bash /usr/local/bin/backup" > /etc/cron.d/backups-cron RUN chmod 0644 /etc/cron.d/backups-cron -RUN crontab /etc/cron.d/backups-cron ENV PORT= \ PUID=1000 \ diff --git a/README.md b/README.md index b23efda..f7b8587 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,25 @@ docker exec palworld-server backup This will create a backup at `/palworld/backups/` +## Setting Up Automatic Backups with Cron + +This section guides you through the process of configuring automatic backups using Cron. Use the provided command to set up the necessary Cron job for your Palworld server within a Docker environment. + +The configured backup system automatically deletes backups older than 7 days to manage storage efficiently. + +```bash +docker exec palworld-server cron /etc/cron.d/backups-cron + +``` + +Additionally, to stop the cron process within the Docker container, you can use the following command: + +```bash +docker exec palworld-server service cron stop +``` + +This command stops the cron service within the specified container, halting the scheduled cron job. + ## Editing Server Settings When the server starts, a `PalWorldSettings.ini` file will be created in the following location: `/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini` From ebd63d17617d369e7614fc8fc4e89eac70245ee2 Mon Sep 17 00:00:00 2001 From: Guillaume Barreau Date: Thu, 25 Jan 2024 02:56:06 -0500 Subject: [PATCH 03/34] =?UTF-8?q?feat:=20=E2=9C=A8=20Add=20Cron=20command?= =?UTF-8?q?=20to=20Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 64dcdb8..7dc7136 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ services: palworld: - image: test/palworld-server-docker:latest - build: . + image: thijsvanloef/palworld-server-docker:latest restart: unless-stopped container_name: palworld-server ports: From 5bbc0d972b7d4ce380e36d3cca61f244e8ad3ef6 Mon Sep 17 00:00:00 2001 From: Guillaume Barreau Date: Thu, 25 Jan 2024 02:58:46 -0500 Subject: [PATCH 04/34] =?UTF-8?q?feat:=20=E2=9C=A8=20Add=20cron=20command?= =?UTF-8?q?=20for=20DockerFile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 5d1b9ee718f408069dad176a9032def1329130ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%Wl&^6upxKVz)wy5J=r1Sz;SP3bX>Tanoc`sj#RKEC2;NHel8DM7D#4qDWrD zKky4|`z8ICuHek0QsRKvRS}vi-8ths_s-+Y%R@wLFbj8yIz(ha1-7=3{6R#y&^2jj ziw$J5j)*dPKojD0w&raNh5^ICrZFJ)?rjROV<&V<%lmfZZL4i+P zah?QMc|Uj^N9DM4=a8p`AE!|!1L81(%eyym8uD_$XK9$rSWgvLwq=hyJM;OI$NODp zZ+CCeb>`0=^}7xXi-m37z5np}$@nxmOZhj90m5+RO1Y)+3Ir!>Jbdx8G~wwdl!-W- zPQd5^X6*&AhZ(Lh)exS`Gu*~%n1It53>WoTlk4Hf(t1F!kqu`+uODlB!~1EvXBaRH zTt5Tid~l!wU5%AOd2}F=PXJ&GW+}*v-vbfjXmmAJ3Q+=KDio+fnSNq06%MI0sps7AP;{G4~{r$fhWWEdohJpWz0oEFN z!vTh*@7A@!iM!T;et-%Qew9KQf<#}(G9#|y9jFwPIU)meHC75?ftViwNrOoY1J}yH EZz?jV*#H0l From 918c32c623b1d04b70ab646e14715406f3ade918 Mon Sep 17 00:00:00 2001 From: Guillaume Barreau Date: Thu, 25 Jan 2024 07:09:30 -0500 Subject: [PATCH 05/34] =?UTF-8?q?feat:=20=E2=9C=A8=20Add=20variables=20Env?= =?UTF-8?q?=20for=20cron=20feature?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 7 ++++--- README.md | 34 ++++++++++++++++++++++------------ docker-compose.yml | 8 ++++++-- scripts/backup.sh | 13 +++++++++---- scripts/init.sh | 2 -- scripts/start.sh | 17 +++++++++++++++-- 6 files changed, 56 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index f8e52f9..6d64723 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,8 +15,6 @@ RUN mv rcon-cli /usr/bin/rcon-cli RUN rm -f /var/run/crond.pid COPY ./scripts/backup.sh /usr/local/bin/backup RUN chmod +x /usr/local/bin/backup -RUN echo "0 3 * * * root bash /usr/local/bin/backup" > /etc/cron.d/backups-cron -RUN chmod 0644 /etc/cron.d/backups-cron ENV PORT= \ PUID=1000 \ @@ -32,7 +30,10 @@ ENV PORT= \ UPDATE_ON_BOOT=true \ RCON_ENABLED=true \ RCON_PORT=25575 \ - QUERY_PORT=27015 + QUERY_PORT=27015 \ + BACKUP_ENABLED=true \ + DAYS_TO_KEEP=7 \ + BACKUP_CRON_EXPRESSION="0 0 * * *" COPY ./scripts/* /home/steam/server/ RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/backup.sh diff --git a/README.md b/README.md index f7b8587..a0215e5 100644 --- a/README.md +++ b/README.md @@ -164,23 +164,33 @@ This will create a backup at `/palworld/backups/` ## Setting Up Automatic Backups with Cron -This section guides you through the process of configuring automatic backups using Cron. Use the provided command to set up the necessary Cron job for your Palworld server within a Docker environment. +Setting Up Automatic Backups with Cron -The configured backup system automatically deletes backups older than 7 days to manage storage efficiently. +### Environment Variables + +**DAYS_TO_KEEP:** + +Description: This environment variable represents the number of days to retain backup files. It is used in the cleanup process to remove backup files older than the specified duration. +Example Usage: If set to 7, backup files older than 7 days will be deleted during the cleanup. + +**BACKUP_CRON_EXPRESSION:** + +Description: This environment variable defines the cron expression for scheduling automatic backups. It determines when the backup script should run at specific intervals. +Example Usage: If set to 0 2 * * *, the backup script will run every day at 2:00 AM. + +**BACKUP_ENABLED:** + +Description: This environment variable indicates whether automatic backups are enabled or not. If set to a non-empty value, automatic backups will be enabled; otherwise, they will be disabled. +Example Usage: If set to any non-empty string (e.g., true or 1), the backup script will be configured and executed as per the specified cron schedule. + +Example: ```bash -docker exec palworld-server cron /etc/cron.d/backups-cron - +DAYS_TO_KEEP=7 +BACKUP_CRON_EXPRESSION="0 2 * * *" +BACKUP_ENABLED=true ``` -Additionally, to stop the cron process within the Docker container, you can use the following command: - -```bash -docker exec palworld-server service cron stop -``` - -This command stops the cron service within the specified container, halting the scheduled cron job. - ## Editing Server Settings When the server starts, a `PalWorldSettings.ini` file will be created in the following location: `/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini` diff --git a/docker-compose.yml b/docker-compose.yml index 7dc7136..0665c1e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ services: palworld: - image: thijsvanloef/palworld-server-docker:latest + image: test/palworld-server-docker:latest + build: . restart: unless-stopped container_name: palworld-server ports: @@ -15,7 +16,10 @@ services: - RCON_ENABLED=true - RCON_PORT=25575 - ADMIN_PASSWORD="adminPasswordHere" - - COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD! + - COMMUNITY=false + - BACKUP_ENABLED=true + - DAYS_TO_KEEP=7 + - BACKUP_CRON_EXPRESSION=0 0 * * * # Enable the environment variables below if you have COMMUNITY=true # - SERVER_PASSWORD="worldofpals" # - SERVER_NAME="World of Pals" diff --git a/scripts/backup.sh b/scripts/backup.sh index 29be637..712a0db 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -1,13 +1,11 @@ #!/bin/bash -printf "\e[0;34m***** RUNNING SCRIPTS backup.sh *****\e[0m\n" - DATE=$(date +"%Y-%m-%d_%H-%M-%S") DESTINATION_PATH="/palworld/backups" FILE_PATH="${DESTINATION_PATH}/backup_palworld_${DATE}.tar.gz" if [ ! -f ${FILE_PATH} ]; then - printf "\e[0;32m***** CREATING BACKUPS FOLDER *****\e[0m\n" + echo "\e[0;32m***** CREATING BACKUPS FOLDER *****\e[0m\n" mkdir -p "${DESTINATION_PATH}" fi @@ -16,4 +14,11 @@ cd /palworld/Pal/ || exit tar -zcf "$FILE_PATH" "Saved/" echo "backup created at $FILE_PATH" -find "${DESTINATION_PATH}" -type f -name "backup_palworld_*.tar.gz" -ctime +7 -exec rm -f {} \; \ No newline at end of file +if [[ -n "${DAYS_TO_KEEP}" && "${DAYS_TO_KEEP}" =~ ^[0-9]+$ ]]; then + echo "DAYS_TO_KEEP=${DAYS_TO_KEEP}" + find "${DESTINATION_PATH}" -type f -mtime +"${DAYS_TO_KEEP}" -exec rm {} \; +else + echo "DAYS_TO_KEEP is not a valid number." +fi + + diff --git a/scripts/init.sh b/scripts/init.sh index 32a7840..f1b5bf2 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -1,7 +1,5 @@ #!/bin/bash -printf "\e[0;34m***** RUNNING SCRIPTS init.sh *****\e[0m\n" - if [[ ! "${PUID}" -eq 0 ]] && [[ ! "${PGID}" -eq 0 ]]; then printf "\e[0;32m*****EXECUTING USERMOD*****\e[0m\n" usermod -o -u "${PUID}" steam diff --git a/scripts/start.sh b/scripts/start.sh index 411e522..8e0cc1b 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -1,7 +1,5 @@ #!/bin/bash -printf "\e[0;34m***** RUNNING SCRIPTS start.sh *****\e[0m\n" - STARTCOMMAND="./PalServer.sh" if [ -n "${PORT}" ]; then @@ -69,6 +67,21 @@ if [ -n "${RCON_PORT}" ]; then sed -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini fi +if [[ -n "${BACKUP_ENABLED}" ]]; then + echo "BACKUP_ENABLED=${BACKUP_ENABLED}" + + if [[ -z "${BACKUP_CRON_EXPRESSION}" ]]; then + printf "\e[0;31m***** BACKUP_CRON_EXPRESSION NOT SET *****\e[0m\n" + exit 1 + else + echo "BACKUP_CRON_EXPRESSION=${BACKUP_CRON_EXPRESSION}" + fi + + echo "${BACKUP_CRON_EXPRESSION} root bash /usr/local/bin/backup" > /etc/cron.d/backups-cron + chmod 0644 /etc/cron.d/backups-cron + cron /etc/cron.d/backups-cron +fi + # Configure RCON settings cat >~/.rcon-cli.yaml < Date: Thu, 25 Jan 2024 08:02:43 -0500 Subject: [PATCH 06/34] =?UTF-8?q?feat:=20=E2=9C=A8=20Update=20Docker-compo?= =?UTF-8?q?se?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker-compose.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 12fb347..b18c716 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ services: palworld: - image: test/palworld-server-docker:latest - build: . + image: thijsvanloef/palworld-server-docker:latest restart: unless-stopped container_name: palworld-server ports: @@ -17,8 +16,8 @@ services: - RCON_PORT=25575 - TZ=UTC - ADMIN_PASSWORD="adminPasswordHere" - - COMMUNITY=false - - BACKUP_ENABLED=true + - COMMUNITY=false # Enable this if you want your server to show up in the community servers tab, USE WITH SERVER_PASSWORD! + - BACKUP_ENABLED=false - DAYS_TO_KEEP=7 - BACKUP_CRON_EXPRESSION=0 0 * * * # Enable the environment variables below if you have COMMUNITY=true From 4b559677b7e27b7c10f0712c54aee9069ae70bc3 Mon Sep 17 00:00:00 2001 From: Guillaume Barreau Date: Thu, 25 Jan 2024 09:14:30 -0500 Subject: [PATCH 07/34] =?UTF-8?q?feat:=20=E2=9C=A8=20Update=20DockerFile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 6d64723..f5f5c83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,7 @@ ENV PORT= \ RCON_ENABLED=true \ RCON_PORT=25575 \ QUERY_PORT=27015 \ + TZ=UTC \ BACKUP_ENABLED=true \ DAYS_TO_KEEP=7 \ BACKUP_CRON_EXPRESSION="0 0 * * *" From 00468ace96c262a1d92da3e06c55c3ef59f6aa26 Mon Sep 17 00:00:00 2001 From: Guillaume Barreau Date: Thu, 25 Jan 2024 09:19:37 -0500 Subject: [PATCH 08/34] =?UTF-8?q?feat:=20=E2=9C=A8=20Update=20Readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ee7ba90..707a943 100644 --- a/README.md +++ b/README.md @@ -173,18 +173,22 @@ Setting Up Automatic Backups with Cron **DAYS_TO_KEEP:** -Description: This environment variable represents the number of days to retain backup files. It is used in the cleanup process to remove backup files older than the specified duration. +Description: This environment variable represents the number of days to retain backup files. +It is used in the cleanup process to remove backup files older than the specified duration. + Example Usage: If set to 7, backup files older than 7 days will be deleted during the cleanup. **BACKUP_CRON_EXPRESSION:** -Description: This environment variable defines the cron expression for scheduling automatic backups. It determines when the backup script should run at specific intervals. +Description: This environment variable defines the cron expression for scheduling automatic backups. +It determines when the backup script should run at specific intervals. + Example Usage: If set to 0 2 * * *, the backup script will run every day at 2:00 AM. **BACKUP_ENABLED:** -Description: This environment variable indicates whether automatic backups are enabled or not. If set to a non-empty value, automatic backups will be enabled; otherwise, they will be disabled. -Example Usage: If set to any non-empty string (e.g., true or 1), the backup script will be configured and executed as per the specified cron schedule. +Description: This environment variable indicates whether automatic backups are enabled or not. +If set to a non-empty value, automatic backups will be disabled. Example: From 2a13366498ad1e07365d9f2a28e8a90f07aa955c Mon Sep 17 00:00:00 2001 From: Guillaume Barreau Date: Fri, 26 Jan 2024 23:57:07 -0500 Subject: [PATCH 09/34] refactor: :fire: Update main branch --- .DS_Store | Bin 0 -> 8196 bytes Dockerfile | 6 +++--- docker-compose.yml | 9 +++++---- scripts/backup.sh | 10 ++++++---- scripts/start.sh | 17 +++++++---------- 5 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a660ad9a8fccc9ea22622d5273d33dbaf00dfa2b GIT binary patch literal 8196 zcmeI1&u$V?6vod5l)=V?7){uiOyU-iT0j~%l)|Eky66~Ps6mE7JLzNfC(@GCh#v1z@9C`I%nV4XSrtrOyIvHAfFF5 zn$(ujM5}sqpi?CPG>2&w7^4nQ9@}WkXrfhF@tV4N5XLG@i6OKd=WUq|Z5d6pYC8#S zCtNGlidVD5-OX9tK zg21E4JfcXlU5<}9F!y}wjKd%b-(yB*=jjO@&^~qP89CHV5s|)S))tMZ556-HA49!V z{Y3YR!LI zTJx#wOQ*WiDBJbz#s#US?kdGJ0WqvtwZze>T^P#yKe%u(fvZFytKV!%*8kn}fB(Nq zx5V$22{3^_Bp`Afr_+W>?dluMa+kN!-lEBnd5KnKLAUZn0LQ=nFvQqKs`RvsCR#Cr P;2#1M2JV=^UnTGZhl3@Y literal 0 HcmV?d00001 diff --git a/Dockerfile b/Dockerfile index f5f5c83..275346d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,9 +32,9 @@ ENV PORT= \ RCON_PORT=25575 \ QUERY_PORT=27015 \ TZ=UTC \ - BACKUP_ENABLED=true \ - DAYS_TO_KEEP=7 \ - BACKUP_CRON_EXPRESSION="0 0 * * *" + BACKUP_ENABLED=false \ + DAYS_TO_KEEP= \ + BACKUP_CRON_EXPRESSION= COPY ./scripts/* /home/steam/server/ RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/backup.sh diff --git a/docker-compose.yml b/docker-compose.yml index b18c716..e572b87 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ services: palworld: - image: thijsvanloef/palworld-server-docker:latest + image: test/palworld-server-docker:latest + build: . restart: unless-stopped container_name: palworld-server ports: @@ -17,9 +18,9 @@ services: - 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! - - BACKUP_ENABLED=false - - DAYS_TO_KEEP=7 - - BACKUP_CRON_EXPRESSION=0 0 * * * + - BACKUP_ENABLED=true + - DAYS_TO_KEEP= + - BACKUP_CRON_EXPRESSION= # Enable the environment variables below if you have COMMUNITY=true # - SERVER_PASSWORD="worldofpals" # - SERVER_NAME="World of Pals" diff --git a/scripts/backup.sh b/scripts/backup.sh index 712a0db..4444997 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -5,7 +5,7 @@ DESTINATION_PATH="/palworld/backups" FILE_PATH="${DESTINATION_PATH}/backup_palworld_${DATE}.tar.gz" if [ ! -f ${FILE_PATH} ]; then - echo "\e[0;32m***** CREATING BACKUPS FOLDER *****\e[0m\n" + printf "\e[0;32m***** CREATING BACKUPS FOLDER *****\e[0m\n" mkdir -p "${DESTINATION_PATH}" fi @@ -16,9 +16,11 @@ echo "backup created at $FILE_PATH" if [[ -n "${DAYS_TO_KEEP}" && "${DAYS_TO_KEEP}" =~ ^[0-9]+$ ]]; then echo "DAYS_TO_KEEP=${DAYS_TO_KEEP}" - find "${DESTINATION_PATH}" -type f -mtime +"${DAYS_TO_KEEP}" -exec rm {} \; -else - echo "DAYS_TO_KEEP is not a valid number." + if [[ "${DAYS_TO_KEEP}" -gt 0 ]]; then + find "${DESTINATION_PATH}" -type f -mtime +"${DAYS_TO_KEEP}" -exec rm {} \; + else + echo "DAYS_TO_KEEP is zero. No files will be removed." + fi fi diff --git a/scripts/start.sh b/scripts/start.sh index 8e0cc1b..6587107 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -67,19 +67,16 @@ if [ -n "${RCON_PORT}" ]; then sed -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini fi -if [[ -n "${BACKUP_ENABLED}" ]]; then +if [[ -n $BACKUP_ENABLED ]]; then echo "BACKUP_ENABLED=${BACKUP_ENABLED}" - if [[ -z "${BACKUP_CRON_EXPRESSION}" ]]; then - printf "\e[0;31m***** BACKUP_CRON_EXPRESSION NOT SET *****\e[0m\n" - exit 1 - else - echo "BACKUP_CRON_EXPRESSION=${BACKUP_CRON_EXPRESSION}" + if [[ $BACKUP_ENABLED == true ]]; then + CRON_EXPRESSION=$([[ -n $BACKUP_CRON_EXPRESSION ]] && echo "$BACKUP_CRON_EXPRESSION" || echo "0 0 * * *") + echo "CRON_EXPRESSION=${CRON_EXPRESSION}" + echo "${CRON_EXPRESSION} root bash /usr/loca/bin/backup" > /etc/cron.d/backups-cron + chmod 0644 /etc/cron.d/backups-cron + cron /etc/cron.d/backups-cron fi - - echo "${BACKUP_CRON_EXPRESSION} root bash /usr/local/bin/backup" > /etc/cron.d/backups-cron - chmod 0644 /etc/cron.d/backups-cron - cron /etc/cron.d/backups-cron fi # Configure RCON settings From 16f40986a8fd45552b632ca0ac5f363f90d03b5d Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 13:42:24 -0500 Subject: [PATCH 10/34] Updated dockerfile --- Dockerfile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 49cb37a..8f01770 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,18 +5,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xdg-user-dirs=0.17-2 \ procps=2:3.3.17-5 \ wget=1.21-1+deb11u1 \ - && apt-get install -y cron \ + cron \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN wget -q https://github.com/gorcon/rcon-cli/releases/download/v0.10.3/rcon-0.10.3-amd64_linux.tar.gz -O - | tar -xz && \ mv rcon-0.10.3-amd64_linux/rcon /usr/bin/rcon-cli && \ - rmdir /tmp/dumps - -RUN rm -f /var/run/crond.pid -COPY ./scripts/backup.sh /usr/local/bin/backup -RUN chmod +x /usr/local/bin/backup + rmdir /tmp/dumps && \ + rm -f /var/run/crond.pid ENV PORT= \ PUID=1000 \ @@ -34,7 +31,7 @@ ENV PORT= \ RCON_PORT=25575 \ QUERY_PORT=27015 \ TZ=UTC \ - SERVER_DESCRIPTION= + SERVER_DESCRIPTION= \ BACKUP_ENABLED=false \ DAYS_TO_KEEP= \ BACKUP_CRON_EXPRESSION= From e8605f234a3c60b93419256ec8568f7d0fea958d Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 13:43:48 -0500 Subject: [PATCH 11/34] Restored docker compose --- docker-compose.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 750de7a..e9dd61b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,6 @@ services: palworld: - image: test/palworld-server-docker:latest - build: . + image: thijsvanloef/palworld-server-docker:latest restart: unless-stopped container_name: palworld-server ports: From ea86215a0b7b9524dca3cf4158e10660d5e74fa7 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 16:03:22 -0500 Subject: [PATCH 12/34] Removed binary file --- .DS_Store | Bin 8196 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index a660ad9a8fccc9ea22622d5273d33dbaf00dfa2b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeI1&u$V?6vod5l)=V?7){uiOyU-iT0j~%l)|Eky66~Ps6mE7JLzNfC(@GCh#v1z@9C`I%nV4XSrtrOyIvHAfFF5 zn$(ujM5}sqpi?CPG>2&w7^4nQ9@}WkXrfhF@tV4N5XLG@i6OKd=WUq|Z5d6pYC8#S zCtNGlidVD5-OX9tK zg21E4JfcXlU5<}9F!y}wjKd%b-(yB*=jjO@&^~qP89CHV5s|)S))tMZ556-HA49!V z{Y3YR!LI zTJx#wOQ*WiDBJbz#s#US?kdGJ0WqvtwZze>T^P#yKe%u(fvZFytKV!%*8kn}fB(Nq zx5V$22{3^_Bp`Afr_+W>?dluMa+kN!-lEBnd5KnKLAUZn0LQ=nFvQqKs`RvsCR#Cr P;2#1M2JV=^UnTGZhl3@Y From a2c87f1fcf9866c9de46b3d4455dc5325f24fb3c Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 16:06:53 -0500 Subject: [PATCH 13/34] Removed extra brackets to keep the same style. --- scripts/start.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/start.sh b/scripts/start.sh index 246760c..6aaa55b 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -289,10 +289,10 @@ if [ -n "${RCON_PORT}" ]; then sed -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini fi -if [[ -n $BACKUP_ENABLED ]]; then +if [ -n $BACKUP_ENABLED ]; then echo "BACKUP_ENABLED=${BACKUP_ENABLED}" - if [[ $BACKUP_ENABLED == true ]]; then + if [ $BACKUP_ENABLED = true ]; then CRON_EXPRESSION=$([[ -n $BACKUP_CRON_EXPRESSION ]] && echo "$BACKUP_CRON_EXPRESSION" || echo "0 0 * * *") echo "CRON_EXPRESSION=${CRON_EXPRESSION}" echo "${CRON_EXPRESSION} root bash /usr/loca/bin/backup" > /etc/cron.d/backups-cron From f6a3b982b20b70df42c4d5223701a3d1994488ee Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 16:07:32 -0500 Subject: [PATCH 14/34] Removed changes in backup.sh --- scripts/backup.sh | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/scripts/backup.sh b/scripts/backup.sh index 81c92ff..e479e2f 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -5,13 +5,7 @@ if [ "${RCON_ENABLED}" = true ]; then fi DATE=$(date +"%Y-%m-%d_%H-%M-%S") -DESTINATION_PATH="/palworld/backups" -FILE_PATH="${DESTINATION_PATH}/backup_palworld_${DATE}.tar.gz" - -if [ ! -f ${FILE_PATH} ]; then - printf "\e[0;32m***** CREATING BACKUPS FOLDER *****\e[0m\n" - mkdir -p "${DESTINATION_PATH}" -fi +FILE_PATH="/palworld/backups/palworld-save-${DATE}.tar.gz" cd /palworld/Pal/ || exit @@ -23,13 +17,4 @@ fi echo "backup created at $FILE_PATH" -if [[ -n "${DAYS_TO_KEEP}" && "${DAYS_TO_KEEP}" =~ ^[0-9]+$ ]]; then - echo "DAYS_TO_KEEP=${DAYS_TO_KEEP}" - if [[ "${DAYS_TO_KEEP}" -gt 0 ]]; then - find "${DESTINATION_PATH}" -type f -mtime +"${DAYS_TO_KEEP}" -exec rm {} \; - else - echo "DAYS_TO_KEEP is zero. No files will be removed." - fi -fi - - +# Adding auto delete here From 5586e7044a51ccc67abe0c75d37395f27b79c45e Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 17:25:52 -0500 Subject: [PATCH 15/34] Working --- Dockerfile | 3 +-- scripts/init.sh | 4 ++++ scripts/start.sh | 14 +++++--------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f01770..7fe168c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,8 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN wget -q https://github.com/gorcon/rcon-cli/releases/download/v0.10.3/rcon-0.10.3-amd64_linux.tar.gz -O - | tar -xz && \ mv rcon-0.10.3-amd64_linux/rcon /usr/bin/rcon-cli && \ - rmdir /tmp/dumps && \ - rm -f /var/run/crond.pid + rmdir /tmp/dumps ENV PORT= \ PUID=1000 \ diff --git a/scripts/init.sh b/scripts/init.sh index 24c3fac..3c9a3f1 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -22,6 +22,10 @@ term_handler() { tail --pid=$killpid -f 2>/dev/null } +if [ "${BACKUP_ENABLED}" = true ]; then + service cron start +fi + trap 'term_handler' SIGTERM su steam -c ./start.sh & diff --git a/scripts/start.sh b/scripts/start.sh index 6aaa55b..c6176b8 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -289,16 +289,12 @@ if [ -n "${RCON_PORT}" ]; then sed -i "s/RCONPort=[0-9]*/RCONPort=$RCON_PORT/" /palworld/Pal/Saved/Config/LinuxServer/PalWorldSettings.ini fi -if [ -n $BACKUP_ENABLED ]; then +if [ "${BACKUP_ENABLED}" = true ]; then echo "BACKUP_ENABLED=${BACKUP_ENABLED}" - - if [ $BACKUP_ENABLED = true ]; then - CRON_EXPRESSION=$([[ -n $BACKUP_CRON_EXPRESSION ]] && echo "$BACKUP_CRON_EXPRESSION" || echo "0 0 * * *") - echo "CRON_EXPRESSION=${CRON_EXPRESSION}" - echo "${CRON_EXPRESSION} root bash /usr/loca/bin/backup" > /etc/cron.d/backups-cron - chmod 0644 /etc/cron.d/backups-cron - cron /etc/cron.d/backups-cron - fi + + # Assuming BACKUP_CRON_EXPRESSION is set and is valid + echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup >/dev/null 2>&1" > "/home/steam/server/crontab" + crontab "/home/steam/server/crontab" fi # Configure RCON settings From 9e811db77ba506dc1ef88314f31e9abafdaf85ad Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 17:34:12 -0500 Subject: [PATCH 16/34] Switched to superchronic --- Dockerfile | 12 +++++++++++- scripts/init.sh | 4 ---- scripts/start.sh | 4 ++-- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7fe168c..a4713c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ xdg-user-dirs=0.17-2 \ procps=2:3.3.17-5 \ wget=1.21-1+deb11u1 \ - cron \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -14,6 +13,17 @@ RUN wget -q https://github.com/gorcon/rcon-cli/releases/download/v0.10.3/rcon-0. mv rcon-0.10.3-amd64_linux/rcon /usr/bin/rcon-cli && \ rmdir /tmp/dumps +# 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 + ENV PORT= \ PUID=1000 \ PGID=1000 \ diff --git a/scripts/init.sh b/scripts/init.sh index 3c9a3f1..24c3fac 100644 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -22,10 +22,6 @@ term_handler() { tail --pid=$killpid -f 2>/dev/null } -if [ "${BACKUP_ENABLED}" = true ]; then - service cron start -fi - trap 'term_handler' SIGTERM su steam -c ./start.sh & diff --git a/scripts/start.sh b/scripts/start.sh index c6176b8..c07b50f 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -293,8 +293,8 @@ if [ "${BACKUP_ENABLED}" = true ]; then echo "BACKUP_ENABLED=${BACKUP_ENABLED}" # Assuming BACKUP_CRON_EXPRESSION is set and is valid - echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup >/dev/null 2>&1" > "/home/steam/server/crontab" - crontab "/home/steam/server/crontab" + echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup" > "/home/steam/server/crontab" + supercronic "/home/steam/server/crontab" & fi # Configure RCON settings From 27d88a6551ea8409bedd9516e7c58fda2e06f697 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 17:36:40 -0500 Subject: [PATCH 17/34] Changed env --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index e9dd61b..a4ac545 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,7 +21,7 @@ services: - SERVER_NAME="World of Pals" - SERVER_DESCRIPTION="" - BACKUP_ENABLED=true - - DAYS_TO_KEEP= - - BACKUP_CRON_EXPRESSION= + - BACKUP_TO_KEEP=14 + - BACKUP_CRON_EXPRESSION=0 0 0 * * volumes: - ./palworld:/palworld/ From c36461711175e028466471d771d7347270ecc3f0 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 17:39:31 -0500 Subject: [PATCH 18/34] Remvoed BACKUP_TO_KEEP as that is apart of another PR --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 440af54..0f560b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,6 @@ services: - SERVER_NAME="World of Pals" - SERVER_DESCRIPTION="" - BACKUP_ENABLED=true - - BACKUP_TO_KEEP=14 - BACKUP_CRON_EXPRESSION=0 0 0 * * volumes: - ./palworld:/palworld/ From f19c3c4da6bb7d796049257d7064b16f8d20744a Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 17:43:35 -0500 Subject: [PATCH 19/34] Automatic backup is default --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a4713c2..f763497 100644 --- a/Dockerfile +++ b/Dockerfile @@ -41,9 +41,8 @@ ENV PORT= \ QUERY_PORT=27015 \ TZ=UTC \ SERVER_DESCRIPTION= \ - BACKUP_ENABLED=false \ - DAYS_TO_KEEP= \ - BACKUP_CRON_EXPRESSION= + BACKUP_ENABLED=true \ + BACKUP_CRON_EXPRESSION=0 0 * * * COPY ./scripts/* /home/steam/server/ RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/backup.sh && \ From 1ee4be23e86f45f0a554640ce1077a2fe7ebf38e Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 18:17:46 -0500 Subject: [PATCH 20/34] Updated readme --- README.md | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 79ddaca..c4c7394 100644 --- a/README.md +++ b/README.md @@ -141,6 +141,8 @@ It is highly recommended you set the following environment values before startin | RCON_ENABLED*** | Enable RCON for the Palworld server | true | true/false | | RCON_PORT | RCON port to connect to | 25575 | 1024-65535 | | QUERY_PORT | Query port used to communicate with Steam servers | 27015 | 1024-65535 | +| BACKUP_CRON_EXPRESSION | Setting affects frequency of automatic backups. | 0 0 * * * | Needs a Cron-Expression - See [Cron expression](#Configuring-Automatic-Backups-with-Cron) | +| BACKUP_ENABLED | Enables automatic backups | true | true/false | *highly recommended to set @@ -201,39 +203,19 @@ This will create a backup at `/palworld/backups/` The server will run a save before the backup if rcon is enabled. -## Setting Up Automatic Backups with Cron +## Configuring Automatic Backups with Cron -Setting Up Automatic Backups with Cron - -### Environment Variables - -**DAYS_TO_KEEP:** - -Description: This environment variable represents the number of days to retain backup files. -It is used in the cleanup process to remove backup files older than the specified duration. - -Example Usage: If set to 7, backup files older than 7 days will be deleted during the cleanup. - -**BACKUP_CRON_EXPRESSION:** - -Description: This environment variable defines the cron expression for scheduling automatic backups. -It determines when the backup script should run at specific intervals. +The server is automatically backed up everynight at midnight according to the timezone set with TZ Example Usage: If set to 0 2 * * *, the backup script will run every day at 2:00 AM. +In a Cron-Expression, you define an interval for when to run jobs. This image uses Supercronic for crons, see https://github.com/aptible/supercronic#crontab-format or https://crontab-generator.org + **BACKUP_ENABLED:** Description: This environment variable indicates whether automatic backups are enabled or not. If set to a non-empty value, automatic backups will be disabled. -Example: - -```bash -DAYS_TO_KEEP=7 -BACKUP_CRON_EXPRESSION="0 2 * * *" -BACKUP_ENABLED=true -``` - ## Editing Server Settings ### With Environment Variables From b70d38b23b767f2708fef0b2c968849d36290536 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 18:20:01 -0500 Subject: [PATCH 21/34] Removed backup vars from docker compose --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0f560b5..ef5491a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,7 +21,5 @@ services: - 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="" - - BACKUP_ENABLED=true - - BACKUP_CRON_EXPRESSION=0 0 0 * * volumes: - ./palworld:/palworld/ From 4fe78686a4df110c95f199e71956d124e325fd25 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 18:21:00 -0500 Subject: [PATCH 22/34] Removed comment and extra line --- scripts/backup.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/backup.sh b/scripts/backup.sh index e479e2f..69f3319 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -6,7 +6,6 @@ fi DATE=$(date +"%Y-%m-%d_%H-%M-%S") FILE_PATH="/palworld/backups/palworld-save-${DATE}.tar.gz" - cd /palworld/Pal/ || exit tar -zcf "$FILE_PATH" "Saved/" @@ -17,4 +16,3 @@ fi echo "backup created at $FILE_PATH" -# Adding auto delete here From 63d775d7463118d81b7caa32d6cc9465340c8e17 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 18:21:37 -0500 Subject: [PATCH 23/34] Removed another comment --- scripts/start.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/start.sh b/scripts/start.sh index c07b50f..c08303f 100644 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -292,7 +292,6 @@ fi if [ "${BACKUP_ENABLED}" = true ]; then echo "BACKUP_ENABLED=${BACKUP_ENABLED}" - # Assuming BACKUP_CRON_EXPRESSION is set and is valid echo "$BACKUP_CRON_EXPRESSION bash /usr/local/bin/backup" > "/home/steam/server/crontab" supercronic "/home/steam/server/crontab" & fi From c08e9a30d60c207584986f90aa635734dba83161 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 18:22:40 -0500 Subject: [PATCH 24/34] Removed extra line --- scripts/backup.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/backup.sh b/scripts/backup.sh index 69f3319..43eecb4 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -15,4 +15,3 @@ if [ "$(id -u)" -eq 0 ]; then fi echo "backup created at $FILE_PATH" - From 8a8585c8c39f6b6b6931972e5149ae9579faed05 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 18:31:44 -0500 Subject: [PATCH 25/34] Fixed invalid cron expression in dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f763497..aea6aff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,7 @@ ENV PORT= \ TZ=UTC \ SERVER_DESCRIPTION= \ BACKUP_ENABLED=true \ - BACKUP_CRON_EXPRESSION=0 0 * * * + BACKUP_CRON_EXPRESSION="0 0 * * *" COPY ./scripts/* /home/steam/server/ RUN chmod +x /home/steam/server/init.sh /home/steam/server/start.sh /home/steam/server/backup.sh && \ From 5cb01c0cd9130c611c4f1bb241772b28801f265d Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 19:08:16 -0500 Subject: [PATCH 26/34] Changed curl to wget --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index aea6aff..21a55e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ENV SUPERCRONIC_URL=https://github.com/aptible/supercronic/releases/download/v0. SUPERCRONIC=supercronic-linux-amd64 \ SUPERCRONIC_SHA1SUM=cd48d45c4b10f3f0bfdd3a57d054cd05ac96812b -RUN curl -fsSLO "$SUPERCRONIC_URL" \ +RUN wget -q "$SUPERCRONIC_URL" \ && echo "${SUPERCRONIC_SHA1SUM} ${SUPERCRONIC}" | sha1sum -c - \ && chmod +x "$SUPERCRONIC" \ && mv "$SUPERCRONIC" "/usr/local/bin/${SUPERCRONIC}" \ From 6837bf638bacf5626dc54c271efd39b8c8f5c340 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 19:10:59 -0500 Subject: [PATCH 27/34] Updated link name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c4c7394..00f9318 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ It is highly recommended you set the following environment values before startin | RCON_ENABLED*** | Enable RCON for the Palworld server | true | true/false | | RCON_PORT | RCON port to connect to | 25575 | 1024-65535 | | QUERY_PORT | Query port used to communicate with Steam servers | 27015 | 1024-65535 | -| BACKUP_CRON_EXPRESSION | Setting affects frequency of automatic backups. | 0 0 * * * | Needs a Cron-Expression - See [Cron expression](#Configuring-Automatic-Backups-with-Cron) | +| BACKUP_CRON_EXPRESSION | Setting affects frequency of automatic backups. | 0 0 * * * | Needs a Cron-Expression - See [Configuring Automatic Backups with Cron](#Configuring-Automatic-Backups-with-Cron) | | BACKUP_ENABLED | Enables automatic backups | true | true/false | *highly recommended to set From 9d3581c641908a81d6ecf99f27302c8ac0a69936 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 19:21:21 -0500 Subject: [PATCH 28/34] Updated readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00f9318..f5708b1 100644 --- a/README.md +++ b/README.md @@ -209,7 +209,8 @@ The server is automatically backed up everynight at midnight according to the ti Example Usage: If set to 0 2 * * *, the backup script will run every day at 2:00 AM. -In a Cron-Expression, you define an interval for when to run jobs. This image uses Supercronic for crons, see https://github.com/aptible/supercronic#crontab-format or https://crontab-generator.org +In a Cron-Expression, you define an interval for when to run jobs. +This image uses Supercronic for crons, see [supercronic](https://github.com/aptible/supercronic#crontab-format) or [Crontab Generat](https://crontab-generator.org). **BACKUP_ENABLED:** From 1c1e89dc284109d2cc1bff1f1bb5500b56f3bf62 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 19:22:40 -0500 Subject: [PATCH 29/34] Fixed link title --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f5708b1..b341af3 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ It is highly recommended you set the following environment values before startin | RCON_ENABLED*** | Enable RCON for the Palworld server | true | true/false | | RCON_PORT | RCON port to connect to | 25575 | 1024-65535 | | QUERY_PORT | Query port used to communicate with Steam servers | 27015 | 1024-65535 | -| BACKUP_CRON_EXPRESSION | Setting affects frequency of automatic backups. | 0 0 * * * | Needs a Cron-Expression - See [Configuring Automatic Backups with Cron](#Configuring-Automatic-Backups-with-Cron) | +| BACKUP_CRON_EXPRESSION | Setting affects frequency of automatic backups. | 0 0 * * * | Needs a Cron-Expression - See [Configuring Automatic Backups with Cron](#configuring-automatic-backups-with-cron) | | BACKUP_ENABLED | Enables automatic backups | true | true/false | *highly recommended to set From 00716be73e1a32a0518f1cc65326ad37e071c479 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 19:25:39 -0500 Subject: [PATCH 30/34] Updated spacing in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b341af3..150de22 100644 --- a/README.md +++ b/README.md @@ -214,7 +214,7 @@ This image uses Supercronic for crons, see [supercronic](https://github.com/apti **BACKUP_ENABLED:** -Description: This environment variable indicates whether automatic backups are enabled or not. +Description: This environment variable indicates whether automatic backups are enabled or not. If set to a non-empty value, automatic backups will be disabled. ## Editing Server Settings From b14fba61541ba62f0fd60f29e452ad0a0d7ed65c Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 19:30:34 -0500 Subject: [PATCH 31/34] Updated readme --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 150de22..18792f6 100644 --- a/README.md +++ b/README.md @@ -207,15 +207,13 @@ The server will run a save before the backup if rcon is enabled. The server is automatically backed up everynight at midnight according to the timezone set with TZ -Example Usage: If set to 0 2 * * *, the backup script will run every day at 2:00 AM. +Set BACKUP_ENABLED enable or disable automatic backups (Default is enabled) -In a Cron-Expression, you define an interval for when to run jobs. +BACKUP_CRON_EXPRESSION is a cron expression, in a Cron-Expression you define an interval for when to run jobs. This image uses Supercronic for crons, see [supercronic](https://github.com/aptible/supercronic#crontab-format) or [Crontab Generat](https://crontab-generator.org). +Set BACKUP_CRON_EXPRESSION to change the default schedule. -**BACKUP_ENABLED:** - -Description: This environment variable indicates whether automatic backups are enabled or not. -If set to a non-empty value, automatic backups will be disabled. +Example Usage: If BACKUP_CRON_EXPRESSION to 0 2 * * *, the backup script will run every day at 2:00 AM. ## Editing Server Settings From 7e9631e83c14beddd9b3d1afef0bc9a231db379d Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 19:32:20 -0500 Subject: [PATCH 32/34] Updated readme --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 18792f6..e969859 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ It is highly recommended you set the following environment values before startin | RCON_ENABLED*** | Enable RCON for the Palworld server | true | true/false | | RCON_PORT | RCON port to connect to | 25575 | 1024-65535 | | QUERY_PORT | Query port used to communicate with Steam servers | 27015 | 1024-65535 | -| BACKUP_CRON_EXPRESSION | Setting affects frequency of automatic backups. | 0 0 * * * | Needs a Cron-Expression - See [Configuring Automatic Backups with Cron](#configuring-automatic-backups-with-cron) | +| BACKUP_CRON_EXPRESSION | Setting affects frequency of automatic backups. | 0 0 \* \* \* | Needs a Cron-Expression - See [Configuring Automatic Backups with Cron](#configuring-automatic-backups-with-cron) | | BACKUP_ENABLED | Enables automatic backups | true | true/false | *highly recommended to set @@ -213,7 +213,7 @@ BACKUP_CRON_EXPRESSION is a cron expression, in a Cron-Expression you define an This image uses Supercronic for crons, see [supercronic](https://github.com/aptible/supercronic#crontab-format) or [Crontab Generat](https://crontab-generator.org). Set BACKUP_CRON_EXPRESSION to change the default schedule. -Example Usage: If BACKUP_CRON_EXPRESSION to 0 2 * * *, the backup script will run every day at 2:00 AM. +Example Usage: If BACKUP_CRON_EXPRESSION to `0 2 * * *`, the backup script will run every day at 2:00 AM. ## Editing Server Settings From 1b7f5c91214da473c70d2c4ead18eee8e7e9f136 Mon Sep 17 00:00:00 2001 From: "Carlos M. Martinez" Date: Sun, 28 Jan 2024 19:35:34 -0500 Subject: [PATCH 33/34] Moved links for cron to tip --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e969859..8420cd3 100644 --- a/README.md +++ b/README.md @@ -210,9 +210,14 @@ The server is automatically backed up everynight at midnight according to the ti Set BACKUP_ENABLED enable or disable automatic backups (Default is enabled) BACKUP_CRON_EXPRESSION is a cron expression, in a Cron-Expression you define an interval for when to run jobs. -This image uses Supercronic for crons, see [supercronic](https://github.com/aptible/supercronic#crontab-format) or [Crontab Generat](https://crontab-generator.org). -Set BACKUP_CRON_EXPRESSION to change the default schedule. +> [!TIP] +> This image uses Supercronic for crons +> see [supercronic](https://github.com/aptible/supercronic#crontab-format) +> or +> [Crontab Generat](https://crontab-generator.org). + +Set BACKUP_CRON_EXPRESSION to change the default schedule. Example Usage: If BACKUP_CRON_EXPRESSION to `0 2 * * *`, the backup script will run every day at 2:00 AM. ## Editing Server Settings From 55086067b4fb55013e53584d55f07d2f2733faa8 Mon Sep 17 00:00:00 2001 From: Thijs van Loef Date: Mon, 29 Jan 2024 18:13:17 +0100 Subject: [PATCH 34/34] fix rcon.yaml not found --- scripts/backup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/backup.sh b/scripts/backup.sh index 43eecb4..4eaa81e 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -1,7 +1,7 @@ #!/bin/bash if [ "${RCON_ENABLED}" = true ]; then - rcon-cli save + rcon-cli -c /home/steam/server/rcon.yaml save fi DATE=$(date +"%Y-%m-%d_%H-%M-%S")