Finalize debug restore procedure

This commit is contained in:
Ruben Hensen
2025-03-05 13:49:43 +01:00
parent a67d8df7e6
commit 502d9959a5
2 changed files with 19 additions and 49 deletions
+17 -47
View File
@@ -24,17 +24,9 @@ cd backup-testing
2. Make the scripts executable: 2. Make the scripts executable:
```bash ```bash
chmod +x setup-credentials.sh test-velero-backup.sh validate-restore.sh chmod +x test-velero-backup.sh validate-restore.sh
``` ```
3. Set up your MinIO credentials:
```bash
./setup-credentials.sh
```
This script will look for credentials in `~/.velero/credentials-velero` or prompt you to create them.
## Running a Backup Test ## Running a Backup Test
Execute the test script with appropriate parameters: Execute the test script with appropriate parameters:
@@ -44,34 +36,18 @@ Execute the test script with appropriate parameters:
--s3-access-key <ACCESS_KEY> \ --s3-access-key <ACCESS_KEY> \
--s3-secret-key <SECRET_KEY> \ --s3-secret-key <SECRET_KEY> \
--backup-name <BACKUP_NAME> \ --backup-name <BACKUP_NAME> \
--original-namespace mbgwp \ --original-namespace <NAMESPACE> \
--test-namespace mbgwp --test-namespace <NAMESPACE>
```
```bash
./test-velero-backup.sh \
--s3-access-key YOUR_ACCESS_KEY \
--s3-secret-key YOUR_SECRET_KEY \
--original-namespace immich
``` ```
This will: This will:
1. Create a temporary K3d cluster + Create a temporary K3d cluster
2. Install Longhorn for storage + Install Velero configured to access your MinIO backup location
3. Install Velero configured to access your MinIO backup location + List available backups
4. List available backups + Allow you to test restoring a specific backup
5. Allow you to test restoring a specific backup
To restore a specific backup, run: To restore a specific backup, run:
```bash
./test-velero-backup.sh \
--s3-access-key YOUR_ACCESS_KEY \
--s3-secret-key YOUR_SECRET_KEY \
--original-namespace immich \
--backup-name specific-backup-name
```
## Testing Specific Applications ## Testing Specific Applications
### Immich ### Immich
@@ -80,25 +56,19 @@ For testing Immich backups:
```bash ```bash
./test-velero-backup.sh \ ./test-velero-backup.sh \
--s3-access-key YOUR_ACCESS_KEY \ --s3-access-key <ACCESS_KEY> \
--s3-secret-key YOUR_SECRET_KEY \ --s3-secret-key <SECRET_KEY> \
--backup-name immich \
--original-namespace immich \ --original-namespace immich \
--test-namespace immich-test --test-namespace immich
kubectl port-forward service/helm-immich-server -n immich 8080:2283
``` ```
Reachable on `localhost:8080`
### NextCloud
For testing NextCloud backups:
```bash ## Testing with Volume Snapshots (not tested yet)
./test-velero-backup.sh \
--s3-access-key YOUR_ACCESS_KEY \
--s3-secret-key YOUR_SECRET_KEY \
--original-namespace nextcloud \
--test-namespace nextcloud-test
```
## Testing with Volume Snapshots
To test CSI volume snapshot backups: To test CSI volume snapshot backups:
@@ -110,7 +80,7 @@ To test CSI volume snapshot backups:
--include-volume-snapshots --include-volume-snapshots
``` ```
## Customizing Validation ## Customizing Validation (not tested yet)
You can extend the `validate-restore.sh` script to perform application-specific validation checks: You can extend the `validate-restore.sh` script to perform application-specific validation checks:
@@ -126,7 +96,7 @@ You can extend the `validate-restore.sh` script to perform application-specific
--custom-validation-script ./your-custom-validation.sh --custom-validation-script ./your-custom-validation.sh
``` ```
## Troubleshooting ## Troubleshooting (not tested yet)
If you encounter issues: If you encounter issues:
+2 -2
View File
@@ -271,7 +271,7 @@ else
--namespace-mappings $ORIGINAL_NAMESPACE:$TEST_NAMESPACE \ --namespace-mappings $ORIGINAL_NAMESPACE:$TEST_NAMESPACE \
--include-namespaces $ORIGINAL_NAMESPACE \ --include-namespaces $ORIGINAL_NAMESPACE \
--exclude-namespaces kube-system,kube-public,kube-node-lease,velero \ --exclude-namespaces kube-system,kube-public,kube-node-lease,velero \
--exclude-resources certificates.cert-manager.io \ --exclude-resources certificates.cert-manager.io \
--wait --wait
fi fi
@@ -281,7 +281,7 @@ velero restore get
# Wait for pods to be ready # Wait for pods to be ready
echo "Waiting for pods to be ready..." echo "Waiting for pods to be ready..."
kubectl wait --for=condition=ready pod --all -n $TEST_NAMESPACE --timeout=300s || true kubectl wait --for=condition=ready pod --all -n $TEST_NAMESPACE --timeout=600s || true
# 8. Run validation script (create it first if it doesn't exist) # 8. Run validation script (create it first if it doesn't exist)
# if [[ ! -f ./validate-restore.sh ]]; then # if [[ ! -f ./validate-restore.sh ]]; then