Backup and Restore
Backup and Restore
You can create backups to safeguard your SwaggerHub On-Premise data and settings. These backups can be helpful in the following situations:
To protect your data in the event of a Virtual Machine malfunction or failure.
To transfer your data to a new SwaggerHub On-Premise instance (for example, when switching hypervisors).
Swaggerhub On-premise is delivered via Kubernetes cluster: on a standalone Virtual Machine or integrated into an existing Kubernetes cluster.
To ensure data protection and facilitate recovery in case of system disruptions, we recommend employing Velero, an open-source tool designed for backing up and restoring Kubernetes clusters.
Velero supports both manual and automated backup schedules and comes equipped with a handy command-line interface (CLI) for convenient management. These backups can be stored in various locations, including cloud storage providers like:
Amazon Web Services (AWS)
Microsoft Azure
Google Cloud Platform (GCP)
network file servers (NFS)
Before using Velero, verify its compatibility with the version of KOTS installed on your Kubernetes cluster. To ascertain the KOTS version of your SwaggerHub instance:
Navigate to the Admin Console.
Locate the version displayed at the bottom.
For updated information on supported and compatible Velero versions for specific KOTS versions, refer to the Understanding Backup and Restore documentation on Replicated Docs.
To learn more about using Velero, go to Snapshot Guide and Velero documentation.
What Data is Backed up
There are two kinds of snapshots you can create:
Full snapshots - backs up your SwaggerHub data and cluster information
Partial snapshots - backs up your SwaggerHub application data only
For more information, go to Replicated documentation on What Data is Backed Up.
SwaggerHub versions
A backup can be restored only to the same version of SwaggerHub from which it was taken. For example, a backup from version 2.3.0+111 cannot be restored to version 2.3.1+111 or 2.4.0+118. Redeploying/downgrading to previous version of SwaggerHub using KOTS is not supported due to potential data migrations during upgrades.
External databases
If you're using external databases, Velero won't back up those databases. You need to create separate backups for those databases.
Embedded Kubernetes Cluster
VM (embedded cluster) installations come with Velero pre-installed and Velero is accessible via the Admin Console.
Note
VM-level snapshots created in the hypervisor are not supported as the backup and restore method for VM-based installations of SwaggerHub On-Premise 2.x.
Existing Kubernetes clusters
The existing cluster installation doesn't include a built-in backup and restore tool. We recommend you employ Velero as your backup and restore solution.
To install Velero, we recommend deploying it as a Pod within the cluster, rather than installing it on every node. This approach simplifies management and reduces resource consumption. For detailed instructions on installing Velero in an existing cluster, go to Install the Velero CLI in an Online Cluster.
Backup and Restore
We advise you to create a complete backup of your SwaggerHub On-Premise system. This encompasses both your application and the KOTS/Admin Console configuration. With a full backup, you can:
Restore application and admin console data
Restore only application data
Restore only admin console data
for more information, go to Understanding Backup and Restore.
Storage Settings
Before taking a backup, you need to configure Velero with a location to store the backup files. This ensures that your backup data is securely stored and easily accessible for restoration purposes.
For instructions on how to configure the storage destination, go to Update Storage Settings.
Warning
We recommend that customers DO NOT use the "Internal Storage" option, as backups will be lost if there are unrecoverable problems with the installation.
Create a Full Backup
Create a backup in the Admin Console:
Login to Admin Console.
Go to Snapshots and navigate to Full Snapshots (Instance).
Click Start a snapshot.
(Alternative) Create a Backup from the CLI:
kubectl kots backup --namespace <namespace>
Create a partial backup
Create a backup with the Admin Console:
Login to Admin Console.
Go to Snapshots and navigate to Partial Snapshots (Application)
Select the application you want to use from the drop-down menu if you have more than one to choose from.
Scheduling backups
Schedule your backup:
Login to Admin Console.
Go to Snapshots and navigate to Settings & Schedule
Select Full snapshot (Instance) or Partial snapshots (Application)
Tick Enable automatic scheduled snapshots.
Configure the automatic backup schedule. Select one from the following options as Schedule: Hourly, Daily, Weekly, Custom.
For more information, go to Scheduled backup.
Restore Backups
Restore Full Backup
Restore a full backup from the Admin Console.
Restore a full backup from the Admin Console.
Go to Snapshots and navigate to Full Snapshots (Instance).
Select the backup you want to restore.
Click the Restore from this backup (circular button).
Copy and run the command in CLI.
(Alternative) Restore a full backup from the CLI.
When KOTS is installed on a cluster, use the following command to retrieve a list of existing backups:
kubectl kots get backup
To start restoring, use the following command. Use your backup name.
kubectl kots restore --from-backup <backup-name>
To check a list of restored backups, use the following command:
kubectl kots restore ls
Restore Partial Backup
Restore a backup from the Admin Console:
Login to Admin Console.
Go to Snapshots and navigate to Partial Snapshots (Application).
Select the backup you want to restore.
Click the Restore from this backup (circular button).
Enter the application slug.
Click Confirm and restore.
Partial restore from a full backup (CLI)
When KOTS is installed on a cluster, use the following command to retrieve a list of existing backups:
kubectl kots get backup
To start restoring, use the following command. Use your backup name.
kubectl kots restore --from-backup <backup-name> --exclude-admin-console
To check a list of restored backups, use the following command:
kubectl kots restore ls