Backup & Restore guide

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.

Install Velero

To install Velero, you can follow the instructions here, 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.

Backup

You can create backups of all the Kubernetes resources and data by running the following commands:

velero backup create bugsnag-backup-namespace \
        --include-namespaces <YOUR_NAMESPACE> \
        --exclude-resources replicasets.apps && \
velero backup create bugsnag-backup-role \
        --include-namespaces kube-system \
        --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 <YOUR_NAMESPACE> 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.

Scheduling backups

If you wish to run a backup on a schedule, run the following commands:

velero schedule create bugsnag-backup-namespace-daily \
        --include-namespaces <YOUR_NAMESPACE> \
        --exclude-resources replicasets.apps \
        --schedule "0 7 * * *" && \
velero schedule create bugsnag-backup-role-daily \
        --include-namespaces kube-system \
        --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 <YOUR_NAMESPACE> 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-role-daily-<TIMESTAMP>

Restore

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-role
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.

 Restoring schedules backups

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>