Restore a Docker Installation
If you experience problems with your Hub installation, you may need to restore to the most recent working version. Common scenarios that require that you restore an installation include:
You are unable to upgrade your installation successfully and need to restore the previously-installed version.
The database of your installation breaks and you need to restore the current version from a backup copy of your database.
In both cases, you can restore your installation using a valid backup of your Hub database. If your backups are out of date, you can attempt to restore your installation using valid copies of your configuration and data files. Restoration is only possible if you have either a valid backup or a copy of your database that is not corrupted.
You should test this procedure on a regular basis to make sure you can use your backup files to restore your installation after an outage or attack.
Before you begin, make sure you have a backup copy of the database that you want to restore. Note the location of the backup copy so you are sure to select the correct file during this procedure.
If you're rolling back to the previous installation version after an unsuccessful upgrade, use the backup that you created prior to installation. If you ignored this prerequisite, locate a backup file that corresponds with the version of your previous installation.
If you're attempting to restore the current installation, locate an archived backup file in the directory that is set as the Backup location that corresponds with the current version of your installation.
Restore an Installation from a Backup Copy of Your Database
To restore your database to the current or previous version, you need to reinstall Hub and use the backup as the Upgrade Source during installation.
When you restore to a previous version of Hub, use a backup that corresponds to the version of the product that you want to restore.
To restore your database from a backup:
Stop the Hub service. For details, see Start and Stop Docker Container.
Clean the contents of the
confdirectories. You need to clean the content of these two Hub-specific directories on the host machine. For more details, see Create and Configure Directories chapter of the installation instructions.
Make sure that the backup file that you wish to restore is located in the
backupsHub directory on the host machine. The backup file must also be accessible to the user
13001:13001that runs Hub service inside the container. For instance, on a Linux host machine, you can use the following commands to ensure the access:
chmod 750 <path to the backup file on the host machine> chown 13001:13001 <path to the backup file on the host machine>
When you run the docker image, you need to map this directory to the corresponding directory inside the container -
Execute the following command to run a container with Hub server:
docker run -it --name <hub-server-instance> \ -v <path to data directory>:/opt/hub/data \ -v <path to conf directory>:/opt/hub/conf \ -v <path to logs directory>:/opt/hub/logs \ -v <path to backups directory>:/opt/hub/backups \ -p <port on host>:8080 \ jetbrains/hub:<version>
For more details about running Hub container and command parameters, see Run Hub Docker Container.
Hub image starts the web-based Configuration Wizard. In a browser, open the URL of the Configuration Wizard displayed in the console output.
In the Configuration Wizard, select the Upgrade option.
On the Select Upgrade Source page, select your backup as the Upgrade Source and click the Next button.
Review Hub server settings, then click the Upgrade button.
Hub service starts with the data from the backup file.