mirror of
https://github.com/xCyanGrizzly/DragonsStash.git
synced 2026-09-21 13:31:42 +00:00
docs: amend backup design for durable STL retention
This commit is contained in:
@@ -8,11 +8,14 @@
|
||||
|
||||
Dragon's Stash currently persists PostgreSQL in a Docker named volume and stores uploaded STL files in the `manual_uploads` volume. A Docker volume protects data from container recreation, but it is not an off-host backup. A host disk failure, accidental deletion, corruption, or ransomware event could destroy both the database and the files it references.
|
||||
|
||||
The worker currently deletes manual-upload directories after processing. The backup feature will change that behavior for new uploads so the existing `manual_uploads` volume becomes a durable STL archive. Files already deleted before this change cannot be reconstructed by the backup feature.
|
||||
|
||||
The Telegram worker and bot also persist authentication/session state in `tdlib_state` and `tdlib_bot_state`. These files are sensitive and losing them requires Telegram re-authentication.
|
||||
|
||||
## Goals
|
||||
|
||||
- Protect PostgreSQL data and uploaded STL files against loss of the application host.
|
||||
- Preserve newly uploaded STL files after worker processing so the backup contains completed uploads, not only in-flight uploads.
|
||||
- Store backups on a Synology NAS over an authenticated, host-restricted NFS share.
|
||||
- Create one recoverable snapshot containing related database and file state.
|
||||
- Retain 30 daily recovery points.
|
||||
@@ -25,6 +28,7 @@ The Telegram worker and bot also persist authentication/session state in `tdlib_
|
||||
- Building an in-app backup-management UI.
|
||||
- Backing up temporary ZIP processing data in `tmp_zips`.
|
||||
- Copying the raw `postgres_data` volume as the primary database backup.
|
||||
- Recovering STL binaries that were deleted by older worker runs before durable retention was enabled.
|
||||
- Providing protection against loss of the NAS itself. A later Synology Hyper Backup task can replicate this repository to another device or cloud destination.
|
||||
|
||||
## Selected approach
|
||||
@@ -76,6 +80,8 @@ The systemd timer invokes one backup command at the chosen nightly time. The com
|
||||
|
||||
The service-stop window ensures that application writes and TDLib session updates do not occur while the corresponding file volumes are being captured. A failed run must never trigger retention pruning.
|
||||
|
||||
New `ManualUploadFile` rows carry a retention timestamp. Restore verification requires retained file paths to exist and reports older rows without a retention timestamp as legacy warnings, because those binaries may already have been deleted before this feature was enabled.
|
||||
|
||||
## Restore flow
|
||||
|
||||
The restore tooling and documentation will support this sequence:
|
||||
@@ -115,6 +121,7 @@ The restore process must be safe to rehearse against a disposable Compose projec
|
||||
- A nightly systemd timer creates a Restic snapshot on the Synology share.
|
||||
- A snapshot includes PostgreSQL, all uploaded STL files, and both Telegram session volumes.
|
||||
- At least 30 daily recovery points are retained without duplicating unchanged STL content unnecessarily.
|
||||
- Newly uploaded STL files remain in `manual_uploads` after worker processing and are included in subsequent backup snapshots.
|
||||
- A simulated host-loss restore reconstructs the database and uploaded files in a disposable Compose environment.
|
||||
- A failed backup leaves services running and preserves the last known-good snapshot.
|
||||
- The restore procedure is documented well enough for an operator to execute without reading the implementation.
|
||||
|
||||
Reference in New Issue
Block a user