Skip to content

Backup restore#714

Open
chengxicx wants to merge 2 commits into
LuteOrg:developfrom
chengxicx:feat/backup-restore
Open

Backup restore#714
chengxicx wants to merge 2 commits into
LuteOrg:developfrom
chengxicx:feat/backup-restore

Conversation

@chengxicx

Copy link
Copy Markdown

Adds a complete end-to-end backup and restore workflow:
image

One-click backup trigger available on the Settings page; archives include the database, configuration files, and book library data
Supports rolling back the system state from any historical backup snapshot
Preserves all user custom preferences (backup directory path, MeCab binary path, etc.) during restoration, preventing overwrites from outdated configs stored in backups
Implements SQLite connection pool reset logic to maintain valid database connections after swapping database files during restore

chengxicn added 2 commits July 25, 2026 01:28
- Add restore_backup endpoint to upload and restore from backup files
- Preserve system-specific settings (backup_dir, mecab_path) during restore
- Add _add_missing_default_settings to ensure TTS and other settings exist
- Add before_request hook to reset SQLAlchemy engine after restore
- Handle missing backup directory gracefully (auto-create or return empty list)
- Add try/except guards for settings loading after restore from older versions
- Handle missing current_language_id after restore

Allows users to restore from backup files uploaded via web UI,
while preserving system-specific paths that should not be overwritten.
- Move imports to top level (sqlite3, tempfile, shutil, secure_filename)
- Fix line-too-long issues
- Prefix unused parameter with underscore
- Add pylint disable for too-many-locals
@chengxicx
chengxicx force-pushed the feat/backup-restore branch from 83e8df9 to 71f24ad Compare July 24, 2026 17:29
@jzohrab

jzohrab commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR @chengxicx . There was already a PR open for this at #666, what is different about this PR?

Restoring backups is such a massive thing that I'm not sure how much I want to automate it :-) I don't know if there will be primary key issues with any things like audio files, images, etc. This may require a lot of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants