Manual Backup and Restore
Restoring a Backup on a New Instance
When restoring a backup on a new instance, follow these steps to avoid errors and ensure proper functionality.
Address IP Configuration Issues
-
During restoration, the new instance may retain the IP address of the original instance.
-
If AutoMocking is enabled, update the IP address to match the new instance. Use the Maintenance Operations
bulk-replacefeature to ensure the new IP address matches the required settings for your environment.
Log Out Users Before Backup and Restore
-
Ensure all users log out before starting the backup or restore process.
-
If users remain logged in, they may encounter a
TOKEN_UNKNOWNerror and lose access to Swagger Studio. -
To resolve this issue, users should clear their cookies and site data, and then log in again.
Match Product Versions
- Restore backups only to the same version of Swagger Studio they were created on.
Maintain File Naming and Structure
-
Do not rename the
.tarfiles generated during backup. -
Place all required files in the target directory without modifying their names. The restore script relies on these file names and their locations.
Use the Same Search Type
- The search type on the new instance must match the search type used on the original instance. If they differ, the
registry-apiwill return a 500 status code.
Run Scripts with Correct Permissions
- Depending on your environment, execute scripts as sudo or use an account with the required permissions.
Test Procedures Before Production
- Test the backup and restore process in a non-production environment before applying it to production.
Handle External Database Configurations
-
If you use an external database, modify the
backup-restore-external-db.shscript to accommodate your database’s specifics. -
Swagger Studio does not provide support for external database configurations.
Create a backup of an internal database
Store backups outside the Swagger Studio installation environment to ensure retrieval after a critical failure.
-
Download the following backup script and paste it to a machine that can access the cluster: https://maintenance.sonp.swaggerhub.com/backup-restore-dbs.sh
-
Make the script privileges executable:
chmod +x backup-restore-dbs.sh -
Create a directory to store the backup, for example,
mkdir db-dump. -
Execute the script:
./backup-restore-dbs.sh dump <NAMESPACE> <PATH>Define the following parameters in the script:
-
<NAMESPACE>- the existing location of Swagger Studio installation. -
<PATH>- the intended location of the backup.
-
Restore a backup of an internal database
-
Execute the script:
./backup-restore-dbs.sh restore <NAMESPACE> <PATH>Define the following parameters in the script:
-
<NAMESPACE>- the existing location of Swagger Studio installation. -
<PATH>- the intended location of the backup.
-
-
Deploy a new sequence in the Admin Console. You can do that, for example, by changing any value in the config.
Create a backup of an external database
-
Download the following backup script and yaml files required for the script. Save these files to the EC2 instance where Swagger Studio is installed.
-
Make the script privileges executable:
chmod +x backup-restore-external-db.sh -
Execute the script:
./backup-restore-external-db.sh dump <NAMESPACE>Define the following parameters in the script:
<NAMESPACE>- the existing location of Swagger Studio installation.
Restore a backup of an external database
-
Execute the script:
./backup-restore-external-db.sh restore <NAMESPACE>Define the following parameters in the script:
<NAMESPACE>- the existing location of Swagger Studio installation.
-
Deploy a new sequence in the Admin Console. You can do that, for example, by changing any value in the config.