Rename the CLI binary and all references from `wild` to `wildcloud` across Go source, packaging scripts, docs, and e2e tests. Add missing CLI commands: app restart, operation cancel.
7.2 KiB
Restoring Backups
This guide covers how to restore applications from Wild Cloud backups. The restore system uses a blue-green deployment model — data is restored to a standby namespace so you can verify it before switching traffic.
Understanding the Blue-Green Restore
Wild Cloud restores follow a three-phase process:
Restore → Switch → Cleanup
- Restore: Creates a standby namespace with restored data. Your active app keeps running untouched.
- Switch: Redirects traffic from the active deployment to the standby. The standby becomes the new active.
- Cleanup: Removes the previous active deployment and resources.
This means restores are safe — if something goes wrong, your active app is still running.
Before You Start
Make sure you have:
- kubectl access to your cluster
- Backup destination accessible (same destination where backups were stored)
- The app deployed (or at least added) to your instance
List available backups first:
wildcloud backup list gitea
Restoring Applications
Full Restore (Automatic)
The simplest approach runs all three phases automatically:
wildcloud restore gitea --auto
This restores the latest backup, switches traffic, and cleans up the old deployment in one operation.
Full Restore from Specific Backup
wildcloud restore gitea 20250314T021530Z --auto
Step-by-Step Restore (Recommended for Critical Apps)
For production apps, run each phase separately so you can verify between steps:
Step 1: Restore to standby
wildcloud restore gitea
This creates a standby namespace (e.g., gitea-green) with the restored database and files. Your active app continues running in its current namespace.
Step 2: Verify the standby
Check that the restored app is working:
# Check pods in the standby namespace
kubectl get pods -n gitea-green
# Check logs
kubectl logs -n gitea-green deploy/gitea
# View the recovery plan
wildcloud restore plan gitea
Step 3: Switch traffic
wildcloud restore switch gitea
This updates the active deployment color in config.yaml and redirects traffic to the standby namespace.
Step 4: Clean up
wildcloud restore cleanup gitea
This removes the previous active namespace and resources.
Web UI
Navigate to Backups > [app], select a backup, and click Restore. The UI tracks recovery plan progress through each phase.
Partial Restores
Restore only specific components:
# Database only
wildcloud restore gitea --components postgres
# Persistent volumes only
wildcloud restore gitea --components pvc
# Config/manifests only (skip data)
wildcloud restore gitea --skip-data
# Multiple specific components
wildcloud restore gitea --components postgres,pvc
How Each Component Is Restored
PostgreSQL Databases
The restore creates a standby database named {dbName}_{standbyColor} (e.g., gitea_green):
- Downloads the
.dumpfile from the backup destination - Creates the standby database and user
- Runs
pg_restorewith the dump file - Deploys the app to the standby namespace with kustomize patches that rewrite database connection strings to point to the standby database
MySQL Databases
Similar to PostgreSQL — creates a standby database, imports the gzip-compressed SQL dump, and patches connection strings.
Persistent Volumes (Longhorn)
- Triggers a Longhorn restore from the native backup, creating new volumes with standby naming
- Generates kustomize patches that bind standby PVCs to the restored volumes via
spec.volumeName - Cache/temp volumes (names containing
-cacheor-tmp) are skipped
Configuration
Extracts the tar.gz archive containing manifests, kustomization, and app-specific config/secrets to the standby app directory.
Viewing Recovery Plans
Each restore operation creates a recovery plan that tracks progress across all phases:
wildcloud restore plan gitea
The plan shows:
- Current status (restoring, restored, switching, switched, cleaning_up, cleaned_up, or failed)
- Which strategies ran (postgres, longhorn-native, config)
- Per-strategy status and details
- Timestamps for each phase
Common Restore Scenarios
Rolling Back After a Bad Update
# List available backups
wildcloud backup list gitea
# Restore from before the problematic update
wildcloud restore gitea 20250310T020000Z --auto
Complete Application Loss
If an app's namespace was deleted or corrupted:
# Make sure the app is added to the instance
wildcloud app add gitea
# Deploy the app (creates namespace and base resources)
wildcloud app deploy gitea
# Restore data from backup
wildcloud restore gitea --auto
Database-Only Recovery
If the app is running but the database is corrupted:
# Restore only the database to standby
wildcloud restore gitea --components postgres
# Verify the restored database
kubectl exec -n postgres deploy/postgres -- \
psql -U postgres -d gitea_green -c "SELECT count(*) FROM repository;"
# Switch to the restored database
wildcloud restore switch gitea
# Clean up
wildcloud restore cleanup gitea
Cross-Cluster Migration
On the source cluster:
wildcloud backup gitea
On the target cluster:
wildcloud app add gitea
wildcloud app deploy gitea
wildcloud restore gitea --auto
When Things Go Wrong
Restore Fails Mid-Way
If the restore phase fails, your active app is untouched. The standby namespace may contain partial data. You can:
- Fix the issue and retry:
wildcloud restore gitea - Check what went wrong:
wildcloud restore plan gitea - Clean up the failed standby manually:
kubectl delete namespace gitea-green
Switch Fails
If the switch phase fails, the standby is fully populated and ready. You can:
- Retry the switch:
wildcloud restore switch gitea - Inspect both namespaces and manually update config if needed
App Won't Start After Restore
Check file permissions and ownership in the restored PVCs. Try scaling to zero and back:
kubectl scale deployment/gitea -n gitea-green --replicas=0
kubectl scale deployment/gitea -n gitea-green --replicas=1
No Backups Found
# List all backups for the app
wildcloud backup list gitea
# Check backup destination is configured
wildcloud config get backup.destination
Verifying a Successful Restore
After any restore, verify:
# Check pods are running
kubectl get pods -n gitea
# Check logs for errors
kubectl logs -n gitea deploy/gitea
# Test database connectivity
kubectl exec -n postgres deploy/postgres -- \
psql -U postgres -d gitea -c "SELECT 1;"
# Test web access
curl -f https://gitea.example.com/
Best Practices
- Test restores regularly in a test environment. Backups are worthless if restore doesn't work.
- Use step-by-step restore for production apps so you can verify before switching traffic.
- Monitor after restore — watch the app more closely than usual for a few days.
- Communicate with users before performing restores that involve downtime.
Next Steps
- Making Backups — Set up backup schedules and destinations
- Disaster Recovery — Full cluster rebuild from backups