feat(backup): 玩过的世界每天在停服后自动打一个定时恢复点,按服按 owner 保留 7 个、90 天过期

This commit is contained in:
Lemon-miaow committed 2026-09-27 00:02:49 +08:00
1 parent d6e1a6464c
commit 8ef7112dab
29 files changed
+1028 -59

No files matched your search

+10 -8
View File
@@ -4196,13 +4196,15 @@ persisted_auth_source_blocks() {
# persisted_archive_block echoes the operator-owned [archive] keys an earlier run
# left behind — the retention window, the pre-reap warn offsets, the local cap,
# the on-demand backup retention/count/cooldown — so a re-run does not silently
# revert them to the built-ins (felis reaper, felis backup and felis api read
# these from the config Secret; defaults: 90d retention, 3d/1d warnings, no cap,
# manual backups kept 30d, 5 per server, one per 10m). store and local_path are
# NOT carried: this script owns them (FELIS_ARCHIVE_LOCAL_PATH must equal the
# mount). Same first-readable-file rule as persisted_smtp_block; warn_before must
# be a single-line TOML array (the shape every writer here emits).
# the on-demand backup retention/count/cooldown, the scheduled backup
# period/count/retention — so a re-run does not silently revert them to the
# built-ins (felis reaper, felis backup and felis api read these from the config
# Secret; defaults: 90d retention, 3d/1d warnings, no cap, manual backups kept
# 30d, 5 per server, one per 10m, a scheduled backup a day kept 7 per server for
# 90d). store and local_path are NOT carried: this script owns them
# (FELIS_ARCHIVE_LOCAL_PATH must equal the mount). Same first-readable-file rule
# as persisted_smtp_block; warn_before must be a single-line TOML array (the
# shape every writer here emits).
persisted_archive_block() {
local f out
for f in "${STATE_DIR}/felis.host.toml" "${STATE_DIR}/felis.pod.toml"; do
@@ -4210,7 +4212,7 @@ persisted_archive_block() {
out="$(awk '
/^[[:space:]]*\[/ { sect = $0; next }
sect ~ /^[[:space:]]*\[archive\][[:space:]]*$/ &&
/^[[:space:]]*(retention|warn_before|max_local_bytes|manual_retention|manual_keep|manual_cooldown)[[:space:]]*=/ { print }
/^[[:space:]]*(retention|warn_before|max_local_bytes|manual_retention|manual_keep|manual_cooldown|scheduled_every|scheduled_keep|scheduled_retention)[[:space:]]*=/ { print }
' "$f")"
[ -n "$out" ] || continue
printf '%s\n' "$out"
+6
View File
@@ -1452,6 +1452,9 @@ local_path = "/stale/path"
retention = "30d"
manual_keep = 3
manual_cooldown = "1h"
scheduled_every = "12h"
scheduled_keep = 14
scheduled_retention = "45d"
[offsite]
endpoint = "https://objects.example"
@@ -1503,6 +1506,9 @@ expect "url stays installer-owned" 'url = "registry.felis.svc:5000"' "$out"
expect "a re-run carries the archive retention window" 'retention = "30d"' "$out"
expect "a re-run carries the on-demand backup count" 'manual_keep = 3' "$out"
expect "a re-run carries the on-demand backup cooldown" 'manual_cooldown = "1h"' "$out"
expect "a re-run carries the scheduled backup period" 'scheduled_every = "12h"' "$out"
expect "a re-run carries the scheduled backup count" 'scheduled_keep = 14' "$out"
expect "a re-run carries the scheduled backup retention" 'scheduled_retention = "45d"' "$out"
expect "the archive mount stays installer-owned" 'local_path = "/a"' "$out"
expect "the panel learns the public game port" 'game_port = 25570' "$out"
expect "a re-run keeps the off-site bucket, set apart from the next section" '[offsite]