🔄 Add Comprehensive Backup Management System

 New Features:
- Complete backup lifecycle management (create, list, download, delete, cleanup)
- Web-based backup interface with real-time status updates
- Individual backup deletion and bulk cleanup for old backups
- Docker-aware backup operations with volume persistence
- Automated backup scheduling and retention policies

📁 Added Files:
- backup.py - Core backup script for creating timestamped archives
- docker_backup.sh - Docker-compatible backup wrapper script
- app/templates/backup.html - Web interface for backup management
- BACKUP_SYSTEM.md - Comprehensive backup system documentation
- BACKUP_GUIDE.md - Quick reference guide for backup operations

🔧 Enhanced Files:
- Dockerfile - Added backup.py copy for container availability
- docker-compose.yml - Added backup volume mount for persistence
- app/routes/api.py - Added backup API endpoints (create, list, delete, cleanup)
- app/routes/main.py - Added backup management route
- app/templates/index.html - Added backup management navigation
- README.md - Updated with backup system overview and quick start

🎯 Key Improvements:
- Fixed backup creation errors in Docker environment
- Added Docker-aware path detection for container operations
- Implemented proper error handling and user confirmation dialogs
- Added real-time backup status updates via JavaScript
- Enhanced data persistence with volume mounting

💡 Use Cases:
- Data protection and disaster recovery
- Environment migration and cloning
- Development data management
- Automated maintenance workflows
This commit is contained in:
2025-08-01 13:01:15 -04:00
parent faaddba185
commit 9e4c21996b
12 changed files with 2515 additions and 1 deletions

View File

@@ -11,6 +11,11 @@ A modern Flask web application for generating and managing QR codes with authent
- **Customizable Styling**: Different QR code styles (square, rounded, circle)
- **Logo Integration**: Add custom logos to QR codes
- **Click Tracking**: Monitor short URL usage and statistics
- **🆕 Comprehensive Backup System**: Full backup lifecycle management
- Create backups on-demand or automated
- Download, delete, and cleanup old backups
- Web-based backup management interface
- Docker-aware backup operations
- **Docker Deployment**: Production-ready containerization
- **Responsive Design**: Modern web interface that works on all devices
@@ -493,6 +498,60 @@ curl http://localhost:5000/health
This project is licensed under the MIT License - see the LICENSE file for details.
## 💾 Backup & Restore System
The QR Code Manager includes a comprehensive backup system for data protection and migration.
### Quick Start
**Create Backup:**
- Via Web: Navigate to backup management page → "Create Backup"
- Via API: `curl -X POST http://localhost:8066/api/backup/create`
- Via CLI: `python backup.py` or `./docker_backup.sh`
**Manage Backups:**
- **List**: View all backups with timestamps and sizes
- **Download**: Get backup files directly from web interface
- **Delete**: Remove individual backups with confirmation
- **Cleanup**: Bulk remove backups older than 7 days
### What Gets Backed Up
Each backup includes:
- ✅ All QR code data and metadata
- ✅ Short URL database
- ✅ Dynamic link page configurations
- ✅ Generated QR code images
- ✅ Application settings
### Restore Process
```bash
# 1. Stop application
docker compose down
# 2. Extract backup to data directory
cd data/
unzip ../backups/backup_20250801_143022.zip
# 3. Restart application
docker compose up -d
```
### Automated Backups
**Daily Backup (2 AM):**
```bash
0 2 * * * cd /opt/qr-code_manager && ./docker_backup.sh
```
**Weekly Cleanup:**
```bash
0 3 * * 0 curl -X POST http://localhost:8066/api/backup/cleanup
```
> 📖 **Detailed Documentation**: See [BACKUP_SYSTEM.md](BACKUP_SYSTEM.md) for complete backup system documentation.
## 🤝 Contributing
1. Fork the repository