diff --git a/README.md b/README.md index d0b7c21..3dd992c 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ A Python web application for organizing and managing your LEGO instruction manua - 📊 **Statistics Dashboard**: View collection statistics and insights - 🖼️ **Image Gallery**: View instruction images in an organized gallery - 📄 **PDF Support**: View and download PDF instructions directly +- 💾 **Backup & Restore**: One-click archive of the database plus every uploaded file, ready to restore anywhere ## 🚀 Quick Start @@ -90,6 +91,10 @@ BRICKSET_PASSWORD=your-password # Upload Settings MAX_CONTENT_LENGTH=52428800 # 50MB SETS_PER_PAGE=20 + +# Backups +BACKUP_FOLDER=backups +BACKUP_KEEP=5 ``` ### Brickset API Setup @@ -128,9 +133,12 @@ lego-instructions-manager/ ├── app/ │ ├── models/ # Database models │ ├── routes/ # Application routes/views -│ ├── services/ # Business logic (API, file handling) +│ ├── services/ # Business logic (API, file handling, backups) │ ├── templates/ # HTML templates -│ └── static/ # CSS, JS, uploaded files +│ ├── static/ # CSS, JS, uploaded files +│ └── cli.py # flask backup commands +├── backups/ # Backup archives (git-ignored) +├── docs/ # Documentation ├── migrations/ # Database migrations ├── tests/ # Unit tests ├── requirements.txt # Python dependencies @@ -167,16 +175,21 @@ flask --app run.py shell ## 📊 Database Schema ### User -- id, username, email, password_hash, created_at +- id, username, email, password_hash, is_admin, created_at ### Set - id, set_number, set_name, theme, year_released, piece_count -- brickset_id, image_url, user_id, created_at, updated_at +- is_moc, moc_designer, moc_description +- brickset_id, image_url, cover_image, user_id, created_at, updated_at ### Instruction -- id, set_id, file_type, file_path, file_name, file_size +- id, set_id, file_type, file_path, file_name, file_size, thumbnail_path - page_number, user_id, uploaded_at +### ExtraFile +- id, set_id, file_name, original_filename, file_path, file_type, file_size +- description, category, uploaded_at, uploaded_by + ## 🔒 Security Notes - Passwords are hashed using bcrypt @@ -206,7 +219,29 @@ gunicorn -w 4 -b 0.0.0.0:8000 "run:app" 4. **Set up nginx** as a reverse proxy 5. **Enable HTTPS** with Let's Encrypt -6. **Regular backups** of database and uploads folder +6. **Regular backups** — see below + +## 💾 Backup & Restore + +Full in-place backup of the database plus every uploaded PDF, image, cover, +thumbnail and extra file — into a single verifiable `.zip`. + +From the admin UI: **Admin → Backup & Restore** (`/admin/backup/`) — runs in the +background with a progress bar, shows what's missing or orphaned, and lets you +download, verify, restore or delete archives. + +From the command line: + +```bash +flask backup create --label pre-docker +flask backup list +flask backup verify lim-backup-....zip +flask backup restore lim-backup-....zip --mode fresh +``` + +Stored paths are normalised to forward slashes, so a Windows-made backup +restores cleanly onto Linux — which is how the move to Docker works. +Full runbook: [`docs/BACKUP_AND_MIGRATION.md`](docs/BACKUP_AND_MIGRATION.md). ## 🐛 Troubleshooting @@ -252,3 +287,5 @@ For issues and questions: --- **Built with ❤️ for LEGO enthusiasts** + +Created by: Jess Rogerson (yelling commands at Claude.AI)