Skip to content

Backup and restore

Backup and restore via Velero

Execute a backup via Velero

In the example we backup the complete cluster.

velero backup create ibexa-backup --wait -n velero

Execute a restore via Velero

In the example we restore a single application from a full backup.

velero restore create ibexa-restore --include-namespaces ibexa-production --from-backup ibexa-backup

Reset the caches

kubectl delete pods -l=app.kubernetes.io/name=cache -n ibexa-production

Reset the Symfony caches

kubectl delete pods -l=app.kubernetes.io/name=ibexa -n ibexa-production

Backup and restore via BASH

Execute a backup via BASH

In case your dataset is small you can follow this example. For large datasets your might want adapt a custom upgrade path depending on your Kubernetes setup including a snapshot of MySQL and Ibexa storage files.

SRC_MYSQL_DATABASE="ibexa"
SRC_MYSQL_PASSWORD="ibexa"
SRC_NAMESPACE="ibexa-test"
SRC_DIR="/opt/app-root/src/public/var"
POD=$(kubectl get pods -n $SRC_NAMESPACE --output=name --field-selector=status.phase!=Terminating | grep -i ".*-frontend-.*" | awk '{print $1}' | tail -n 1 | sed -e "s/^pod\///" )
echo "Selected frontend pod '$POD' for backup"
kubectl cp -n $SRC_NAMESPACE $POD:$SRC_DIR ./ibexa-storage
POD=$(kubectl get pods -n $SRC_NAMESPACE --output=name --field-selector=status.phase!=Terminating | grep -i ".*-mysql-0.*" | awk '{print $1}' | tail -n 1 | sed -e "s/^pod\///" )
echo "Selected mysql pod '$POD' for backup"
$(kubectl port-forward -n $SRC_NAMESPACE $POD 3306:3306 >/dev/null 2>&1 &)
timeout 30 bash -c "until echo > /dev/tcp/localhost/3306; do sleep 3; done"
mysqldump --opt --compress --column-statistics=0 --single-transaction --port=3306 -h127.0.0.1 -u root -p${SRC_MYSQL_PASSWORD} ${SRC_MYSQL_DATABASE} | gzip -c > ./ibexa-database.sql.tgz
pkill -f "port-forward"
echo "See ./ibexa-storage and ./ibexa-database.sql.tgz"

Execute a restore via BASH

  • Scale down the frontend and backend pods to 0
  • Inject your MySQL dump
  • Copy or move your files into the storage PV attached to frontend and backend pods
  • Scale up one backend pod
  • Run required Ibexa DXP database migrations in the backend pod
  • Clear all caches (session and persistence) in the backend pod
  • Reindex Ibexa DXP in the backend pod
  • Scale up the frontend and backend pods to the desired / initial values
  • Restart the varnish pod once
  • Finally check that everything works as expected.