Merge pull request #14 from outis1one/claude/docker-selfhosted-apps-QFDqX

Add Kopia to disaster recovery for ongoing backups
This commit is contained in:
outis1one
2026-01-01 22:56:04 -05:00
committed by GitHub
2 changed files with 54 additions and 6 deletions
+12 -6
View File
@@ -231,11 +231,15 @@ 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
1. **Installs core utilities** - openssh-server, git, curl, Kopia, etc.
2. **Finds your backup drive** - Shows available drives, auto-detects Kopia repo
3. **Gets Kopia password** - For repository access
4. **Installs Docker** - If not already installed
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
@@ -1042,12 +1046,14 @@ This script is provided as-is for Ubuntu 24.04 Desktop installations.
## 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**: External library support for existing photos (read-only, no duplication)
- **Immich**: Storage template guidance for yyyy/mm folder organization
- Added Watchtower for container update monitoring (notify-only by default)
- 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
- Added MeshCentral Server (self-hosted remote management, web-based RDP/terminal)
- Recovery mode now installs core utilities first (openssh-server, git, curl, etc.)
+42
View File
@@ -139,6 +139,15 @@ run_disaster_recovery() {
whiptail \
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
systemctl enable ssh 2>/dev/null || true
systemctl start ssh 2>/dev/null || true
@@ -449,6 +458,36 @@ run_disaster_recovery() {
echo "✓ Cleaned up temp files"
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 "DISASTER RECOVERY COMPLETE"
@@ -456,6 +495,9 @@ run_disaster_recovery() {
echo ""
echo "Services restored to: $DOCKER_DIR"
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 " docker ps"
echo ""