feat: Implement comprehensive restore functionality for Immich

- Added `restore-immich.sh` script to handle complete restoration from backups.
- Implemented database restoration with integrity checks and error handling.
- Added uploads restoration with proper ownership and permissions setup.
- Introduced validation script `validate-immich-backups.sh` for backup integrity checks.
- Created test suite `test-immich-restore.sh` to validate restoration functionality with mock data.
- Enhanced logging and notification features for restoration processes.
- Updated README.md with detailed usage instructions for backup and restore workflows.
This commit is contained in:
Peter Wood
2025-06-03 14:38:55 -04:00
parent 48e51fa094
commit c1479a8b0c
5 changed files with 1188 additions and 46 deletions

View File

@@ -20,6 +20,9 @@ This repository contains various shell scripts for managing media-related tasks
- **`backup-plex.sh`**: Enhanced Plex backup script with integrity verification, incremental backups, and advanced features.
- **`restore-plex.sh`**: Script to restore Plex data from backups with safety checks.
- **`validate-plex-backups.sh`**: Script to validate backup integrity and monitor backup health.
- **`backup-immich.sh`**: Comprehensive Immich backup script with PostgreSQL database and upload directory backup to B2 storage.
- **`restore-immich.sh`**: Complete Immich restoration script with database and upload directory restoration from backups.
- **`validate-immich-backups.sh`**: Immich backup validation script with integrity checks and restoration command generation.
### Management Scripts
@@ -194,6 +197,45 @@ Specialized backup system for Plex Media Server with database-aware features. Fo
./restore-plex.sh plex-backup-20250125_143022.tar.gz
```
### Immich Photo Management Operations
```bash
# Create comprehensive Immich backup (database + uploads)
./immich/backup-immich.sh
# Test backup process without uploading to B2
./immich/backup-immich.sh --dry-run
# Backup without uploading to cloud storage
./immich/backup-immich.sh --no-upload
# Validate existing Immich backups
./immich/validate-immich-backups.sh
# Test restoration with dry-run (recommended first)
./immich/restore-immich.sh \
--db-backup ./immich_backups/immich_db_backup_20250603_140000.sql.gz \
--uploads-backup ./immich_backups/immich_uploads_20250603_140000.tar.gz \
--dry-run
# Complete restoration from backup files
./immich/restore-immich.sh \
--db-backup ./immich_backups/immich_db_backup_20250603_140000.sql.gz \
--uploads-backup ./immich_backups/immich_uploads_20250603_140000.tar.gz
# Restore database only (skip uploads)
./immich/restore-immich.sh \
--db-backup ./immich_backups/immich_db_backup_20250603_140000.sql.gz \
--uploads-backup ./immich_backups/immich_uploads_20250603_140000.tar.gz \
--skip-uploads
# Restore uploads only (skip database)
./immich/restore-immich.sh \
--db-backup ./immich_backups/immich_db_backup_20250603_140000.sql.gz \
--uploads-backup ./immich_backups/immich_uploads_20250603_140000.tar.gz \
--skip-db
```
## Automation and Scheduling
### Daily Media Backup
@@ -218,6 +260,16 @@ Specialized backup system for Plex Media Server with database-aware features. Fo
0 7 * * * /home/acedanger/shell/validate-plex-backups.sh --fix
```
### Automated Immich Backup
```bash
# Add to crontab for daily Immich backup at 4 AM
0 4 * * * /home/acedanger/shell/immich/backup-immich.sh
# Add weekly validation (Sundays at 9 AM)
0 9 * * 0 /home/acedanger/shell/immich/validate-immich-backups.sh
```
### Weekly Comprehensive Validation Report
```bash
@@ -242,7 +294,7 @@ This repository includes extensive documentation organized by component and func
```
📁 docs/ - Technical documentation and guides
📁 setup/ - Setup and configuration files
📁 setup/ - Setup and configuration files
📁 plex/ - Plex Media Server scripts and docs
📁 immich/ - Immich photo management scripts
📁 crontab/ - Crontab management system
@@ -260,7 +312,7 @@ This repository includes extensive documentation organized by component and func
- **[Environment Backup System](./docs/env-backup-system.md)**: Environment and configuration backup
- **[Backup Environment Safety Guide](./docs/backup-env-safety-guide.md)**: Safety guidelines for environment backups
#### Media Server Management
#### Media Server Management
- **[Plex Scripts Documentation](./plex/README.md)**: Comprehensive Plex backup, restoration, and management
- **[Plex Backup Guide](./plex/plex-backup.md)**: Detailed Plex backup system documentation
@@ -358,7 +410,7 @@ Test the AI setup:
# Test Gemini integration
echo "Test text" | fabric -p summarize
# Test local Ollama integration
# Test local Ollama integration
echo "Test text" | fabric -p summarize -m ollama:phi3:mini
```