Backup and restore your BugSnag On-premise installation.
For backing up and restoring we recommend using Velero, which is an open source tool for managing backup and restore in Kubernetes. You can see the supported storage providers and cloud providers here.
We require that Velero is installed with Node Agent, as File System Backup is needed for backups to complete successfully. Note, there are specific instructions for each of the supported cloud providers so make sure to follow the correct installation guide. Once you have Velero setup on your cluster you can orchestrate the backup and restore from the Velero CLI.
Example command to install with Node Agent:
velero install \
--use-node-agent \
...
Once installation has completed, please ensure that both the Velero deployment is working correctly and Node Agent daemonset is fully rolled out on all nodes by running kubectl get pods --namespace velero
.
It is important to ensure that the node agent pods can be scheduled on all nodes. We recommend using a priority class such as the following:
kubectl create priorityclass velero-node-agent --value=500
The node agent daemonset can be updated to use this class as follows:
kubectl patch daemonset node-agent \
--namespace velero \
-p '{"spec": {"template": {"spec": {"priorityClassName": "velero-node-agent"}}}}'
Alternatively, if you are using the official helm chart to install, this can be set with the priorityClassName value.
You can create backups of all the Kubernetes resources and data by running the following commands:
velero backup create bugsnag-backup-namespace \
--include-namespaces default \
--exclude-resources replicasets.apps && \
velero backup create bugsnag-backup-cluster \
--exclude-namespaces default \
--exclude-resources namespaces \
--include-cluster-resources \
--selector app.kubernetes.io/part-of=bugsnag-on-premise,app.kubernetes.io/instance=<YOUR_INSTANCE_ID>
Where <YOUR_INSTANCE_ID>
can be found by running kubectl -n default get statefulset mongo -o jsonpath="{.metadata.labels.app\.kubernetes\.io/instance}"
You can check the progress of the backup by running the following command:
velero backup describe <BACKUP_NAME>
Once the backup has completed you can also check the logs of the backup by running:
velero backup logs <BACKUP_NAME>
This command can be useful for troubleshooting any backup issues.
The backups will be stored in the storage provider you are using, but you can also download the backup by running:
velero backup download <BACKUP_NAME>
This download will not include the disk snapshots but will include the Kubernetes resources and metadata relating to the disk snapshots.
If you wish to run a backup on a schedule, run the following commands:
velero schedule create bugsnag-backup-namespace-daily \
--include-namespaces default \
--exclude-resources replicasets.apps \
--schedule "0 7 * * *" && \
velero schedule create bugsnag-backup-cluster-daily \
--exclude-namespaces default \
--exclude-resources namespaces \
--include-cluster-resources \
--selector app.kubernetes.io/part-of=bugsnag-on-premise,app.kubernetes.io/instance=<YOUR_INSTANCE_ID> \
--schedule "0 7 * * *"
Where <YOUR_INSTANCE_ID>
can be found by running kubectl -n default get statefulset mongo -o jsonpath="{.metadata.labels.app\.kubernetes\.io/instance}"
The --schedule
flag expects cron notation, using UTC time eg. the example above will create backups daily at 7 am UTC and will have the following backup names:
bugsnag-backup-namespace-daily-<TIMESTAMP>
bugsnag-backup-cluster-daily-<TIMESTAMP>
You can get a list of the backups by running:
velero backup get
For restoring you can run the following command to restore a specific backup by name:
velero restore create --from-backup bugsnag-backup-cluster
velero restore create --from-backup bugsnag-backup-namespace
Like with backups you can check the progress of a restore using the following:
velero restore describe <RESTORE_NAME>
Once the restore has completed you can check the logs of the restore by running:
velero restore logs <RESTORE_NAME>
This command can be useful for troubleshooting any restore issues.
For restoring scheduled backups you can either follow the above instructions if you wish to specify the backup name. However if you wish to restore from the latest successful backup triggered by schedule <SCHEDULE-NAME>
you can do so by running:
velero restore create --from-schedule <SCHEDULE-NAME>