horizon-server: backups, restore and automatic backups

`backup [NAME]` zips the world and the settings into backups/; on a running server it turns saving
off, flushes, zips and turns saving back on, so the game stays up. `restore BACKUP` puts a backup's
world in place and keeps the current one in backups/replaced-<time>/; a running server restarts with
it. `[backups] every = "6h"`, `keep = 12` in server.toml back up on a schedule and prune the
automatic backups only. The control API gains GET/POST /api/v1/backups and POST /api/v1/restore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-16 20:10:58 +02:00
parent e8832190d1
commit 3510764cc6
8 changed files with 611 additions and 15 deletions
+2
View File
@@ -15,6 +15,8 @@ serde_json = "1"
toml = "1.1"
# Edits server.toml in place, keeping the owner's comments and order.
toml_edit = "0.25"
# Backups: one zip anyone can open, Windows included.
zip = { version = "2", default-features = false, features = ["deflate"] }
[target.'cfg(unix)'.dependencies]
# SIGINT/SIGTERM/SIGHUP: stop the game cleanly when the terminal or the service manager asks.