Automated world backups#593
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
World Backups with Scheduled S3 Uploads
Adds automatic world data backups with configurable scheduling and optional upload to Amazon S3. Operators can protect against data loss from hardware failure, accidental deletions, or bad config changes without any external tooling. The system creates consistent point-in-time snapshots by briefly locking the MUD during archive creation, then uploads to S3 after the lock is released so players experience minimal disruption.
Also fixes a few rough edges in the config admin page around redacted/secret values and empty fields.
Changes
Admins can download a world backup on demand — A "Download World Backup" button on the admin home page creates a
.tar.gzarchive of all world data and streams it to the browser. A confirmation dialog warns that the server will be briefly unresponsive. Only admin-role users see the button (not moderators).Operators can schedule automatic backups — A new
Backup.Scheduleconfig option supportsnightly,weekly, ormonthlyautomatic backups, all running at 3:00 AM server time. The scheduler runs as a background goroutine, re-reads config each cycle, and can be signaled to recalculate immediately when backup settings change. Setting the schedule toneveror leaving it empty disables automatic backups.Backups can be uploaded to Amazon S3 — When
Backup.S3.Enabledis true, completed archives are automatically uploaded to a configured S3 bucket. Supports bucket name, region, key prefix, and credentials via config or environment variables (BACKUP_S3_ACCESS_KEY,BACKUP_S3_SECRET_KEY). Uses the AWS SDK v2 with static credentials and least-privilege IAM policy guidance.Config changes trigger live rescheduling — An
OnChangedcallback system in the config package lets subsystems react to runtime config mutations. The backup scheduler uses this to immediately recalculate the next backup time when anyBackup.*key is updated, without requiring a server restart.Full backup documentation in the admin panel — A new "Backup Guide" docs page walks operators through the entire S3 setup process: creating an AWS account, creating a bucket, setting up an IAM user with least-privilege permissions, obtaining access keys, configuring GoMud, and verifying the setup. Includes a config reference table, environment variable reference, and troubleshooting guide.
Config wizard supports backup settings — The config wizard now includes a Backup section with all backup-related fields, including enum selection for the schedule and clearly described S3 fields.
Redacted config values can no longer be accidentally saved — Both the config page UI and the
PATCH /admin/api/v1/configendpoint now reject attempts to save the*** REDACTED ***placeholder string as a config value, preventing operators from accidentally overwriting secrets with the display placeholder.Empty config values are visually distinguished — Config keys with empty string values now show
(empty)in italicized placeholder styling instead of a blank cell, making it easier to tell whether a value is unset vs. whitespace.Admin-only route protection — A new
RequireAdminmiddleware restricts endpoints to admin-role users only (unlikeRequirePermissionwhich also allows mods with the right permission). The backup download endpoint uses this to ensure only full admins can trigger server-locking operations.