83 lines
1.5 KiB
Markdown
83 lines
1.5 KiB
Markdown
# Restore Procedure Runbook
|
|
|
|
## Set Variables
|
|
|
|
```bash
|
|
VELERO_NS=openshift-adp
|
|
SRC_NS=n8n
|
|
TS=$(date +%Y%m%d-%H%M%S)
|
|
DST_NS=n8n-restore-test-$TS
|
|
RESTORE_NAME=n8n-restore-test-$TS
|
|
TEST_HOST=n8n-restore-$TS.apilab.us
|
|
```
|
|
|
|
## Create Namespace
|
|
```bash
|
|
oc create ns $DST_NS
|
|
```
|
|
|
|
## Apply Restore
|
|
```bash
|
|
cat <<EOF | oc apply -f -
|
|
apiVersion: velero.io/v1
|
|
kind: Restore
|
|
metadata:
|
|
name: $RESTORE_NAME
|
|
namespace: $VELERO_NS
|
|
spec:
|
|
backupName: $BACKUP_NAME
|
|
includeClusterResources: false
|
|
includedNamespaces:
|
|
- $SRC_NS
|
|
namespaceMapping:
|
|
$SRC_NS: $DST_NS
|
|
restorePVs: true
|
|
excludedResources:
|
|
- routes.route.openshift.io
|
|
EOF
|
|
```
|
|
|
|
## Monitor Restore
|
|
```bash
|
|
watch -n 5 "oc -n $VELERO_NS get restore $RESTORE_NAME -o jsonpath='{.status.phase}{\"\n\"}'"
|
|
```
|
|
|
|
## Check when complete
|
|
```bash
|
|
oc -n $VELERO_NS describe restore $RESTORE_NAME
|
|
```
|
|
|
|
## Monitor Deployments
|
|
```bash
|
|
oc -n $DST_NS rollout status deploy/postgres --timeout=10m
|
|
oc -n $DST_NS rollout status deploy/n8n --timeout=10m
|
|
```
|
|
|
|
## Create Route and Test
|
|
```bash
|
|
cat <<EOF | oc -n $DST_NS apply -f -
|
|
apiVersion: route.openshift.io/v1
|
|
kind: Route
|
|
metadata:
|
|
name: n8n-restore-test
|
|
spec:
|
|
host: $TEST_HOST
|
|
path: /
|
|
to:
|
|
kind: Service
|
|
name: n8n
|
|
port:
|
|
targetPort: 5678
|
|
tls:
|
|
termination: edge
|
|
insecureEdgeTerminationPolicy: Redirect
|
|
EOF
|
|
|
|
curl -kfsS https://$TEST_HOST/ >/dev/null && echo "PASS: UI reachable"
|
|
```
|
|
|
|
## Cleanup
|
|
```bash
|
|
oc -n $VELERO_NS delete restore $RESTORE_NAME
|
|
oc delete ns $DST_NS
|
|
``` |