Add Kopia to disaster recovery for ongoing backups
- Install Kopia in Step 1 (core utilities) - Add Step 9: Reconnect Kopia repository after restore - Backups now work immediately after disaster recovery - Update README with 9-step recovery process
This commit is contained in:
@@ -231,11 +231,15 @@ sudo ./ubuntu-post-install.sh --restore
|
|||||||
|
|
||||||
### What the Recovery Does
|
### What the Recovery Does
|
||||||
|
|
||||||
1. **Finds your backup drive** - Shows available drives, auto-detects Kopia repo
|
1. **Installs core utilities** - openssh-server, git, curl, Kopia, etc.
|
||||||
2. **Installs Docker** - If not already installed
|
2. **Finds your backup drive** - Shows available drives, auto-detects Kopia repo
|
||||||
3. **Lists snapshots** - Shows all available backups, lets you choose
|
3. **Gets Kopia password** - For repository access
|
||||||
4. **Restores services** - Detects which apps were backed up, restores them all
|
4. **Installs Docker** - If not already installed
|
||||||
5. **Starts containers** - Optionally starts all services immediately
|
5. **Lists snapshots** - Shows all available backups, lets you choose
|
||||||
|
6. **Restores from backup** - Extracts files to temp location
|
||||||
|
7. **Selects services** - Whiptail checklist to pick which services to restore
|
||||||
|
8. **Starts containers** - Optionally starts all services immediately
|
||||||
|
9. **Reconnects Kopia** - Sets up ongoing backups to the same repository
|
||||||
|
|
||||||
### What Gets Restored
|
### What Gets Restored
|
||||||
|
|
||||||
@@ -1044,12 +1048,14 @@ This script is provided as-is for Ubuntu 24.04 Desktop installations.
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
- **v2.9**: Immich photo library, Watchtower, documentation
|
- **v2.9**: Immich photo library, Watchtower, recovery improvements
|
||||||
- **Immich**: Now asks for photo storage location (default: `~/drives/primary/photos`)
|
- **Immich**: Now asks for photo storage location (default: `~/drives/primary/photos`)
|
||||||
- **Immich**: External library support for existing photos (read-only, no duplication)
|
- **Immich**: External library support for existing photos (read-only, no duplication)
|
||||||
- **Immich**: Storage template guidance for yyyy/mm folder organization
|
- **Immich**: Storage template guidance for yyyy/mm folder organization
|
||||||
- Added Watchtower for container update monitoring (notify-only by default)
|
- Added Watchtower for container update monitoring (notify-only by default)
|
||||||
- Documented what Docker data lives where and what gets backed up
|
- Documented what Docker data lives where and what gets backed up
|
||||||
|
- **Recovery**: Now installs Kopia during recovery (Step 1)
|
||||||
|
- **Recovery**: Reconnects Kopia repository after restore (Step 9) for ongoing backups
|
||||||
- **v2.8**: MeshCentral Server and improved recovery
|
- **v2.8**: MeshCentral Server and improved recovery
|
||||||
- Added MeshCentral Server (self-hosted remote management, web-based RDP/terminal)
|
- Added MeshCentral Server (self-hosted remote management, web-based RDP/terminal)
|
||||||
- Recovery mode now installs core utilities first (openssh-server, git, curl, etc.)
|
- Recovery mode now installs core utilities first (openssh-server, git, curl, etc.)
|
||||||
|
|||||||
@@ -139,6 +139,15 @@ run_disaster_recovery() {
|
|||||||
whiptail \
|
whiptail \
|
||||||
2>/dev/null || echo " ⚠ Some packages may have failed"
|
2>/dev/null || echo " ⚠ Some packages may have failed"
|
||||||
|
|
||||||
|
# Install Kopia for backup management
|
||||||
|
echo "Installing Kopia..."
|
||||||
|
if ! command -v kopia &> /dev/null; then
|
||||||
|
curl -s https://kopia.io/signing-key | gpg --dearmor -o /usr/share/keyrings/kopia-keyring.gpg 2>/dev/null
|
||||||
|
echo "deb [signed-by=/usr/share/keyrings/kopia-keyring.gpg] https://packages.kopia.io/apt/ stable main" | tee /etc/apt/sources.list.d/kopia.list
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y kopia 2>/dev/null || echo " ⚠ Kopia install failed"
|
||||||
|
fi
|
||||||
|
|
||||||
# Start SSH
|
# Start SSH
|
||||||
systemctl enable ssh 2>/dev/null || true
|
systemctl enable ssh 2>/dev/null || true
|
||||||
systemctl start ssh 2>/dev/null || true
|
systemctl start ssh 2>/dev/null || true
|
||||||
@@ -449,6 +458,36 @@ run_disaster_recovery() {
|
|||||||
echo "✓ Cleaned up temp files"
|
echo "✓ Cleaned up temp files"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Step 9: Reconnect Kopia for future backups
|
||||||
|
echo ""
|
||||||
|
echo "Step 9: Setting up future backups"
|
||||||
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||||
|
echo ""
|
||||||
|
echo "Reconnecting Kopia to backup repository for future backups..."
|
||||||
|
|
||||||
|
if command -v kopia &> /dev/null && [ -n "$KOPIA_REPO" ]; then
|
||||||
|
# Reconnect to the repository
|
||||||
|
if kopia repository connect filesystem --path="$KOPIA_REPO" --password="$KOPIA_PASSWORD" 2>/dev/null; then
|
||||||
|
echo "✓ Kopia reconnected to repository"
|
||||||
|
echo " Repository: $KOPIA_REPO"
|
||||||
|
|
||||||
|
# Verify backup scripts exist
|
||||||
|
if [ -f "$DOCKER_DIR/kopia/backup-containers.sh" ]; then
|
||||||
|
chmod +x "$DOCKER_DIR/kopia/backup-containers.sh" 2>/dev/null || true
|
||||||
|
echo "✓ Backup script ready: $DOCKER_DIR/kopia/backup-containers.sh"
|
||||||
|
else
|
||||||
|
echo " ⚠ Backup script not found - run normal install to set up"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo " ⚠ Could not reconnect to repository"
|
||||||
|
echo " Run manually: kopia repository connect filesystem --path=\"$KOPIA_REPO\""
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo " ⚠ Kopia not available or repository not found"
|
||||||
|
echo " Run the normal install script to set up backups"
|
||||||
|
fi
|
||||||
|
echo ""
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||||
echo "DISASTER RECOVERY COMPLETE"
|
echo "DISASTER RECOVERY COMPLETE"
|
||||||
@@ -456,6 +495,9 @@ run_disaster_recovery() {
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Services restored to: $DOCKER_DIR"
|
echo "Services restored to: $DOCKER_DIR"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo "Backups: $(command -v kopia &>/dev/null && kopia repository status &>/dev/null && echo "✓ Connected" || echo "⚠ Not connected")"
|
||||||
|
echo " Run backups: $DOCKER_DIR/kopia/backup-containers.sh"
|
||||||
|
echo ""
|
||||||
echo "To check running containers:"
|
echo "To check running containers:"
|
||||||
echo " docker ps"
|
echo " docker ps"
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user