Add disaster recovery mode for one-click restore from backup

New features:
- --restore flag for disaster recovery mode
- Interactive mode selector at script start (N=Normal, R=Recovery)
- Full disaster recovery flow:
  1. Show available drives, auto-mount if device path given
  2. Auto-detect Kopia repository
  3. Try to find password in backed-up .env, or prompt
  4. Install Docker if needed
  5. List available snapshots, let user choose or use 'latest'
  6. Restore snapshot to temp location
  7. Detect all docker-compose.yml files = services to restore
  8. Copy services to ~/docker/
  9. Optionally start all containers
  10. Cleanup temp files

Removed old buried import section that only showed manual instructions.

Documentation:
- Added Disaster Recovery section to README
- Added --restore to command-line options
- Documented what gets restored and requirements
- Added v2.7 changelog entry
This commit is contained in:
Claude
2026-01-01 22:24:44 +00:00
parent 1f92245faf
commit c9d3276d36
2 changed files with 365 additions and 44 deletions
+65 -1
View File
@@ -7,6 +7,7 @@ Automated setup script for Ubuntu 24.04 Desktop that installs essential tools, c
- **Modular** - Every component is optional with y/n prompts
- **Dry-run mode** - Preview what would be installed without making changes
- **Unattended mode** - Run with defaults for automated/scripted installs
- **Disaster recovery** - One-click restore from Kopia backup after system failure
- **Logging** - All output logged to `/var/log/post-install.log`
- **Local backup** - rsync to 1-4 drives with customizable names
- **Cloud backup** - Encrypted backup to Google Drive, OneDrive, or 40+ providers
@@ -191,6 +192,9 @@ sudo ./post-install.sh --dry-run
# Automated install with defaults (no prompts)
sudo ./post-install.sh --unattended
# Disaster recovery - restore from Kopia backup
sudo ./post-install.sh --restore
# Show help
sudo ./post-install.sh --help
```
@@ -201,7 +205,59 @@ sudo ./post-install.sh --help
- Install Docker
- Install fail2ban (since password auth is enabled)
- Enable UFW firewall
- Skip Samba, NetBird, RustDesk, Backup system
## Disaster Recovery
If your OS drive fails, you can restore everything from a Kopia backup.
### One-Click Recovery
```bash
# 1. Install fresh Ubuntu 24.04
# 2. Connect your backup drive
# 3. Download and run the script
wget https://raw.githubusercontent.com/outis1one/post-ubuntu-install/main/ubuntu-post-install.sh
chmod +x ubuntu-post-install.sh
sudo ./ubuntu-post-install.sh --restore
```
### What the Recovery Does
1. **Finds your backup drive** - Shows available drives, auto-detects Kopia repo
2. **Installs Docker** - If not already installed
3. **Lists snapshots** - Shows all available backups, lets you choose
4. **Restores services** - Detects which apps were backed up, restores them all
5. **Starts containers** - Optionally starts all services immediately
### What Gets Restored
Everything in `~/docker/` that Kopia backed up:
- **App configs** - All settings, users, preferences
- **Databases** - Immich, Mealie, Traccar, etc.
- **Media metadata** - Emby/Jellyfin watch history, thumbnails
- **Minecraft worlds** - Saves, mods, permissions
- **Frigate** - Camera configs, detection settings
- **All other container data**
### Recovery Requirements
- Fresh Ubuntu 24.04 installation
- Backup drive with Kopia repository
- Kopia password (stored in `~/docker/kopia/.env` on backup, or remembered)
### Interactive Mode
When you run the script without `--restore`, you'll be asked:
```
INSTALLATION MODE
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
[N] Normal install - Fresh install or modify existing
[R] Disaster recovery - Restore from Kopia backup
Select mode (N/R) [N]:
```
### 5. Follow Interactive Prompts
@@ -980,6 +1036,14 @@ This script is provided as-is for Ubuntu 24.04 Desktop installations.
## Changelog
- **v2.7**: Disaster recovery mode
- **One-click restore** from Kopia backup after system failure
- New `--restore` flag for disaster recovery mode
- Interactive mode selector at script start: Normal install or Disaster recovery
- Auto-detects Kopia repository on backup drives
- Auto-detects and restores all backed-up Docker services
- Installs Docker if needed, starts all containers after restore
- Recovery flow: Mount drive → Find repo → Enter password → Select snapshot → Restore → Start
- **v2.6**: FindMyDevice, Frigate-Notify, and resilient install
- Added FindMyDevice server (self-hosted Android tracking)
- Added Frigate-Notify (push alerts for Frigate AI detections)