Automated Data Backups
Note: This information applies to SwaggerHub On-Premise.
To automate the backups of your SwaggerHub On-Premise data and configuration, you can use this bash script:
https://s3.amazonaws.com/onprem-files/get-backup.sh
The script creates a backup and then copies it from the VM storage to the specified local DOWNLOAD_DIR
. Backup file names include the timestamp, for example:
backup_2018-03-05-11-51-37UTC.tar.gz # SwaggerHub On-Premise v. 20180116, 1.18.0 and later
backup_1519853159685.tar.gz # earlier versions use Unix timestamps
Parameters
Before running the script, specify the configuration parameters at the top of the script:
HOST=https://swaggerhub.mycompany.com ADMIN=admin ADMIN_PASSWORD=p@55w0rd DOWNLOAD_DIR=/path/to/folder
The parameters are:
Parameter | Description |
---|---|
| Should be |
| The username and password of the administrator user in your SwaggerHub On-Premise instance. This is the user created during the SwaggerHub On-Premise installation. |
| A local folder to copy the backup to. For example, |
Run the script
On Unix and Mac
Make the script executable if needed:
chmod +x /path/to/get-backup.sh
Now, you can run it from a terminal prompt:
/path/to/get-backup.sh
You can also schedule the script to run as a cron job.
On Windows
Windows users can run bash scripts using Windows Subsystem for Linux (available for Windows 10), Cygwin or Git Bash (<Git>\git-bash.exe
), and schedule the scripts using Windows Task Manager.
Additional backup strategies
In addition to data and configuration backups, we recommend that you create full VM backups of your SwaggerHub On-Premise instance regularly. Refer to the documentation on your VM hypervisor to learn how to automate VM backups.