๐Ÿ’พBackup and Restore

Infrastructure overview

Here's are the storage worth backing up:

  • PostgreSQL

  • Laputa Storage & MongoDB

  • Curity config

  • S3

PostgreSQL

Backup

You can run a Kubernetes CronJob to dump the database. Set these parameters in the values.yaml:

Example with S3

If you want to backup to S3, you would use the mountpoint-s3-csi-driver and mount the S3 bucket at /backup/pgdump:

Restore

  1. Find a way to connect to the database. You can forward the service port if you have admin access to the Kubernetes cluster:

  1. Restore the backup using the command:

MongoDB

No backup utilities are available for MongoDB at the moment, and it is not planned as well.

We plan to deprecated Laputa and MongoDB, which are legacy services from Toucan v2.

It's possible that the utilities in v2 and expect to work the same. However, this guide will use proper tools.

This guide will guide you through the steps required to backup and restore Toucan's MongoDB database outside of Kubernetes.

A better approach is to use a Kubernetes CronJob to dump the database, in which you won't need to run the restore command manually and won't need to forward the port.

Backup

  1. Get the MongoDB credentials:

  1. Forward the MongoDB port if you have admin access to the Kubernetes cluster:

  1. Mongo dump:

Restore

  1. Get the MongoDB credentials:

  1. Forward the MongoDB port if you have admin access to the Kubernetes cluster:

  1. Mongo restore:

Use --dryRun to test before restoring.

Garage S3

Check out their documentation for backup and restore.

Persistent Volume backup (Laputa Storage, Garage S3, MongoDB, Curity config, PostgreSQL)

Persistent Volume backups are filesystem snapshots, and not logical backups.

Backup

By using Kubernetes, you have used a storage provisioner to provision a volume for Laputa. Most storage provisioner can backup the data automatically.

See either your cloud provider or the storage provisioner documentation for more information.

Here's a non-exhaustive list of storage provisioners with backup capabilities:

You can also look at external-snapshotter if you want a Kubernetes-native way to handle snapshots. In which, some provider implements its API:

To create a snapshot using external-snapshotter,

  1. Create a VolumeSnapshotClass (if not present):

You can verify your snapshot class by using kubectl get volumesnapshotclass.

  1. Create a VolumeSnapshot:

After creating the snapshot, you should get a VolumeSnapshotContent.

Restore

You can restore a snapshot using the Web UI of your cloud provider.

If you are using external-snapshotter, to restore a snapshot, you need to reference the VolumeSnapshot in the PersistentVolumeClaim. Set these parameters in the values to restore the snapshot:

If you fear losing data, remember to set the retainPolicy to Retain on the PersistentVolume. You should delete the existing StatefulSet and PersistentVolumeClaim before upgrading the chart. If the retainPolicy is set to Delete, the previous data will be lost.

Last updated

Was this helpful?