From c1704b3a0aa0041c94f8b3e481cf85833eb3e03b Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt <2270806+jammsen@users.noreply.github.com> Date: Mon, 12 Aug 2024 12:18:53 +0200 Subject: [PATCH 1/4] added backup-announce feature-toggle from #272 --- CHANGELOG.md | 3 +++ Dockerfile | 1 + default.env | 1 + docs/ENV_VARS.md | 1 + scripts/backupmanager.sh | 24 ++++++++++++++++-------- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fc272f..566bab4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog [Back to main](README.md#changelog) +## 2024-08-12 + +- added support to turn off backup-announcements, to have less spammy chat ingame, but errors will always be announced @Jadiction @jammsen (#272) ## 2024-06-24 diff --git a/Dockerfile b/Dockerfile index 5659687..363aff0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -64,6 +64,7 @@ ENV DEBIAN_FRONTEND=noninteractive \ STEAMCMD_VALIDATE_FILES=true \ # Backup-settings BACKUP_ENABLED=true \ + BACKUP_ANNOUNCE_MESSAGES_ENABLED=true \ BACKUP_CRON_EXPRESSION="0 * * * *" \ BACKUP_RETENTION_POLICY=true \ BACKUP_RETENTION_AMOUNT_TO_KEEP=72 \ diff --git a/default.env b/default.env index f365fdd..80f010f 100644 --- a/default.env +++ b/default.env @@ -7,6 +7,7 @@ ALWAYS_UPDATE_ON_START=true STEAMCMD_VALIDATE_FILES=true # Backup-settings BACKUP_ENABLED=true +BACKUP_ANNOUNCE_MESSAGES_ENABLED=true BACKUP_CRON_EXPRESSION=0 * * * * BACKUP_RETENTION_POLICY=true BACKUP_RETENTION_AMOUNT_TO_KEEP=72 diff --git a/docs/ENV_VARS.md b/docs/ENV_VARS.md index e6446d7..8be91f1 100644 --- a/docs/ENV_VARS.md +++ b/docs/ENV_VARS.md @@ -18,6 +18,7 @@ These settings control the behavior of the Docker container: | ALWAYS_UPDATE_ON_START | Updates the server on startup | true | Boolean | | STEAMCMD_VALIDATE_FILES | Set to enabled SteamCMD will also validate the gameserver files, making sure nothing is corrupted and also overwrite any file changes of the source | true | Boolean | | BACKUP_ENABLED | Backup function, creates backups in your `game` directory | true | Boolean | +| BACKUP_ANNOUNCE_MESSAGES_ENABLED | While creating backups, this controls if announces are posted to the gameserver; Important: Errors will always be announced! | true | Boolean | | BACKUP_CRON_EXPRESSION | Needs a Cron-Expression - See [Cron expression](#cron-expression) | 0 * * * * (meaning every hour) | Cron-Expression | | BACKUP_RETENTION_POLICY | Set to enabled, will cleanup old backups | true | Boolean | | BACKUP_RETENTION_AMOUNT_TO_KEEP | Defines how many backups in numbers to keep | 72 | Integer | diff --git a/scripts/backupmanager.sh b/scripts/backupmanager.sh index 5b21b21..d14118a 100644 --- a/scripts/backupmanager.sh +++ b/scripts/backupmanager.sh @@ -5,6 +5,7 @@ source /includes/colors.sh source /includes/rcon.sh # Default values if the environment variables exist +LOCAL_BACKUP_ANNOUNCE_MESSAGES_ENABLED=${BACKUP_ANNOUNCE_MESSAGES_ENABLED} # Defines if messages should be announced via rcon LOCAL_BACKUP_PATH=${BACKUP_PATH} # Directory where the backup files are stored LOCAL_GAME_PATH=${GAME_PATH} # Directory where the game save files are stored LOCAL_GAME_SAVE_PATH=${GAME_SAVE_PATH} # Directory where the game save files are stored @@ -136,19 +137,26 @@ function create_backup() { mkdir -p "${LOCAL_BACKUP_PATH}" - rconcli broadcast "$(get_time) Saving in 5 seconds..." - sleep 5 - rconcli broadcast "$(get_time) Saving world..." - rconcli save - rconcli broadcast "$(get_time) Saving done" - sleep 15 - rconcli broadcast "$(get_time) Creating backup..." + if [[ -n $LOCAL_BACKUP_ANNOUNCE_MESSAGES_ENABLED ]] && [[ $LOCAL_BACKUP_ANNOUNCE_MESSAGES_ENABLED == "true" ]]; then + rconcli broadcast "$(get_time) Saving in 5 seconds..." + sleep 5 + rconcli broadcast "$(get_time) Saving world..." + rconcli save + rconcli broadcast "$(get_time) Saving done" + sleep 15 + rconcli broadcast "$(get_time) Creating backup..." + else + rconcli save + fi + if ! tar cfz "${LOCAL_BACKUP_PATH}/${backup_file_name}" -C "${LOCAL_GAME_PATH}/" --exclude "backup" "Saved" ; then broadcast_backup_failed ee ">>> Backup failed" else - broadcast_backup_success + if [[ -n $LOCAL_BACKUP_ANNOUNCE_MESSAGES_ENABLED ]] && [[ $LOCAL_BACKUP_ANNOUNCE_MESSAGES_ENABLED == "true" ]]; then + broadcast_backup_success + fi es ">>> Backup '${backup_file_name}' created successfully" fi From aa55582ee7674ae7e298e9e206c9fb5793d93acc Mon Sep 17 00:00:00 2001 From: diaoyiran Date: Tue, 13 Aug 2024 14:36:44 +0800 Subject: [PATCH 2/4] feat: Add ENV Support for server config setting SupplyDropSpan --- Dockerfile | 3 ++- configs/PalWorldSettings.ini.template | 2 +- default.env | 1 + docs/ENV_VARS.md | 1 + includes/config.sh | 4 ++++ 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 363aff0..3d0dace 100644 --- a/Dockerfile +++ b/Dockerfile @@ -178,7 +178,8 @@ ENV DEBIAN_FRONTEND=noninteractive \ SHOW_PLAYER_LIST=false \ ALLOW_CONNECT_PLATFORM=Steam \ ENABLE_WORLD_BACKUP=false \ - LOG_FORMAT_TYPE=Text + LOG_FORMAT_TYPE=Text \ + SUPPLY_DROP_SPAN=180 EXPOSE 8211/udp EXPOSE 25575/tcp diff --git a/configs/PalWorldSettings.ini.template b/configs/PalWorldSettings.ini.template index efb9b7f..f9c926c 100644 --- a/configs/PalWorldSettings.ini.template +++ b/configs/PalWorldSettings.ini.template @@ -1,2 +1,2 @@ [/Script/Pal.PalGameWorldSettings] -OptionSettings=(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,BaseCampMaxNumInGuild=4,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,AutoSaveSpan=30.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,bInvisibleOtherGuildBaseCampAreaFX=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName="Default Palworld Server",ServerDescription="",AdminPassword="",ServerPassword="",PublicPort=8211,PublicIP="",RCONEnabled=False,RCONPort=25575,Region="",bUseAuth=True,BanListURL="https://api.palworldgame.com/api/banlist.txt",RESTAPIEnabled=False,RESTAPIPort=8212,bShowPlayerList=False,AllowConnectPlatform=Steam,bIsUseBackupSaveData=True,LogFormatType=Text) \ No newline at end of file +OptionSettings=(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAliveMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,BaseCampMaxNumInGuild=4,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,AutoSaveSpan=30.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,bInvisibleOtherGuildBaseCampAreaFX=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName="Default Palworld Server",ServerDescription="",AdminPassword="",ServerPassword="",PublicPort=8211,PublicIP="",RCONEnabled=False,RCONPort=25575,Region="",bUseAuth=True,BanListURL="https://api.palworldgame.com/api/banlist.txt",RESTAPIEnabled=False,RESTAPIPort=8212,bShowPlayerList=False,AllowConnectPlatform=Steam,bIsUseBackupSaveData=True,LogFormatType=Text,SupplyDropSpan=180) \ No newline at end of file diff --git a/default.env b/default.env index 80f010f..830ac81 100644 --- a/default.env +++ b/default.env @@ -121,3 +121,4 @@ SHOW_PLAYER_LIST=false ALLOW_CONNECT_PLATFORM=Steam ENABLE_WORLD_BACKUP=false LOG_FORMAT_TYPE=Text +SUPPLY_DROP_SPAN=180 diff --git a/docs/ENV_VARS.md b/docs/ENV_VARS.md index 8be91f1..292861b 100644 --- a/docs/ENV_VARS.md +++ b/docs/ENV_VARS.md @@ -150,6 +150,7 @@ Information sources and credits to the following websites: | ALLOW_CONNECT_PLATFORM | AllowConnectPlatform | Looks like Cross-Play, but according to official documentation, isnt working yet and no more infos given on this; See: https://tech.palworldgame.com/settings-and-operation/configuration | Steam | String | | ENABLE_WORLD_BACKUP | bIsUseBackupSaveData | Enables internal world backup inside the game-server; off by default, because we have our own backup solution | false | Boolean | | LOG_FORMAT_TYPE | LogFormatType | Log format Text or Json | Text | Enum | +| SUPPLY_DROP_SPAN | SupplyDropSpan | Interval for supply drop (and meteorite drop) (minutes) | 180 | Integer | ** Updates to descriptions taken from [this reddit post](https://www.reddit.com/r/Palworld/comments/19bumby/settings_explanation/) ** diff --git a/includes/config.sh b/includes/config.sh index 86f2788..5ea7f37 100644 --- a/includes/config.sh +++ b/includes/config.sh @@ -332,6 +332,10 @@ function setup_palworld_settings_ini() { e "> Setting LogFormatType to '$LOG_FORMAT_TYPE'" sed -E -i "s/LogFormatType=[a-zA-Z]*/LogFormatType=$LOG_FORMAT_TYPE/" "$GAME_SETTINGS_FILE" fi + if [[ -n ${SUPPLY_DROP_SPAN+x} ]]; then + e "> Setting SupplyDropSpan to '$SUPPLY_DROP_SPAN'" + sed -E -i "s/SupplyDropSpan=[0-9]*/SupplyDropSpan=$SUPPLY_DROP_SPAN/" "$GAME_SETTINGS_FILE" + fi es ">>> Finished setting up PalWorldSettings.ini" } From fd7f2e4cc7c5c0383c9e095b891d9c1ebacddaed Mon Sep 17 00:00:00 2001 From: diaoyiran Date: Thu, 15 Aug 2024 09:49:17 +0800 Subject: [PATCH 3/4] fix: add missing changelog entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 566bab4..134df3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog [Back to main](README.md#changelog) +## 2024-08-15 + +- added support for variable SUPPLY_DROP_SPAN @KyleDiao (#279) + ## 2024-08-12 - added support to turn off backup-announcements, to have less spammy chat ingame, but errors will always be announced @Jadiction @jammsen (#272) From cfeb6d39eb41198fb593fe72390ec9c0a7cb8d73 Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt <2270806+jammsen@users.noreply.github.com> Date: Fri, 20 Sep 2024 20:34:28 +0200 Subject: [PATCH 4/4] Added process-based healthcheck from #275 --- CHANGELOG.md | 4 ++++ Dockerfile | 3 +++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 566bab4..f2ab9f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Changelog [Back to main](README.md#changelog) +## 2024-09-20 + +- added process-based Healthcheck @jammsen (#275) + ## 2024-08-12 - added support to turn off backup-announcements, to have less spammy chat ingame, but errors will always be announced @Jadiction @jammsen (#272) diff --git a/Dockerfile b/Dockerfile index 363aff0..6b9558b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -209,5 +209,8 @@ RUN mkdir -p "$BACKUP_PATH" \ VOLUME ["${GAME_ROOT}"] +HEALTHCHECK --interval=10s --timeout=10s --start-period=30s --retries=3 \ + CMD pgrep -x "PalServer-Linux" >/dev/null 2>&1 || exit 1 + ENTRYPOINT ["/entrypoint.sh"] CMD ["/scripts/servermanager.sh"]