Restore Core Hub from a backup
This guide shows how to put a backup made with Backups with Gluesync Connect back on the same host, or on a new machine. The restore is a command that runs while Core Hub is stopped.
In this guide
-
Choose the backup and download it.
-
Prepare the host.
-
Run the restore with Docker or on a bare install.
-
Start Core Hub and check the result.
-
Fix the errors the command prints.
Goal |
Bring a Core Hub installation back from an encrypted backup |
Audience |
Gluesync administrators with access to the Core Hub host |
Level |
Advanced |
Time |
20 to 60 minutes, depending on the size of the backup |
Area |
Deploy and run → Core Hub |
Applies to |
Gluesync 2.3 |
Before you begin
Make sure that:
-
You have the recovery key that the backup is sealed to. It starts with
GSRK1-. If you rotated the key, use the key that was current when the backup was made. The key ID shown next to the backup in Gluesync Connect tells you which one; -
You can open the site in Gluesync Connect with a role that may download backups (owner or admin), or you already have the backup file;
-
The host has Core Hub of the same release as the backup, or a newer one. The restore refuses a backup made by a newer release. See The release rule;
-
You have free space in the Core Hub data folder: about twice the size of the unpacked backup, plus the size of the backup file when the command downloads it;
-
You can stop Core Hub on the host.
|
The restore replaces the databases and the configuration files of the installation. It moves the files that are in the way aside and does not delete them. Still, stop and read the next section before you run it on a host that is in use. |
Choose the case
| Case | Options | Notes |
|---|---|---|
Same host: Core Hub was damaged or you need an earlier state |
|
The data folder already holds an installation, so the restore asks for |
New machine, the original is gone |
|
Install Core Hub, stop it, then restore. The restored installation keeps the identity of the original in Gluesync Connect. |
New machine, the original is still running |
|
Without |
--reset-connect clears the Gluesync Connect pairing stored in the restored database. The copy starts without a pairing and enrols as a new site when you pair it again. See When the original Core Hub still runs.
Guide steps
UI
-
Sign in to Gluesync Connect and open the site.
-
Open the Backups tab.
-
Find the backup you want. Each backup shows when it was made, its size, until when it is kept, its key and the Core Hub version.
-
Select Download. Gluesync Connect gives you a link that is valid for 10 minutes.
-
Either save the file to the host, or copy the link and give it to the restore command. The command downloads it itself, over HTTPS only.
|
Pick the newest backup unless you want an earlier state. Gluesync Connect keeps the newest backup of a site even when it is older than your plan’s retention. |
CLI
-
On a new machine, install Gluesync with the kit, in the same release as the backup or a newer one. See Install with the kit. You do not need to start it.
-
Stop Core Hub and the other Gluesync services. On Linux:
sudo gluesync stop. See Gluesync Control for Linux. -
Write down the address and the folder where Core Hub keeps its data. In a container that folder is
/opt/gluesync/data.
CLI
Pass the key through an environment variable. A key given as an argument is visible to every user of the machine.
read -r -s -p "Recovery key: " GS_RESTORE_RECOVERY_KEY
export GS_RESTORE_RECOVERY_KEY
The key is read in any case, with or without the dashes. If the command finds no key in the arguments or in GS_RESTORE_RECOVERY_KEY, and it runs in a terminal, it asks for the key and does not echo it.
CLI
Use this form when Core Hub runs in a container from the Gluesync kit. The container entry point accepts the restore options. The command runs a one-off container from the Core Hub image, with the data folder of your installation mounted. Put the backup file in that folder first, so that the container sees it.
docker run --rm \
-v <data folder on the host>:/opt/gluesync/data \
-e GS_RESTORE_RECOVERY_KEY \
<Core Hub image> \
./entrypoint.sh --restore-backup /opt/gluesync/data/backup.gsbk --force
<data folder on the host> is the folder that the core-hub service mounts as /opt/gluesync/data in the Compose file of your kit. <Core Hub image> is the image of that service. -e GS_RESTORE_RECOVERY_KEY passes the variable you set in the previous step, without writing the key in the command.
To let the command download the backup, give it the link instead of the file, in quotes, and leave out the file:
docker run --rm \
-v <data folder on the host>:/opt/gluesync/data \
-e GS_RESTORE_RECOVERY_KEY \
<Core Hub image> \
./entrypoint.sh --restore-backup "https://<link from Gluesync Connect>" --force
To run the restore from Compose, replace the command of the core-hub service for one run. GS_RESTORE_RECOVERY_KEY with no value passes the variable from your shell, so the key is not written in the file:
services:
core-hub:
command: ["./entrypoint.sh", "--restore-backup", "/opt/gluesync/data/backup.gsbk", "--force"]
environment:
- GS_RESTORE_RECOVERY_KEY
Remove the command line again before you start Gluesync.
On Windows containers, the container entry point takes the options directly. Leave out ./entrypoint.sh and give the path inside the container, for example docker run <Core Hub image> --restore-backup C:\opt\gluesync\data\backup.gsbk.
Add --reset-connect at the end of the options when the original Core Hub still runs. Drop --force when the data folder holds no installation.
CLI
Use this form when Core Hub runs directly on the host with Java 21. Run it from the folder Core Hub runs from, with the same environment variables that start Core Hub (DATA_DIR and, if you use it, COMMONS_CONFIG_DIR).
export DATA_DIR=/opt/gluesync/data
java -jar <path to the Core Hub jar> --restore-backup ./backup.gsbk --force
With a download link:
java -jar <path to the Core Hub jar> --restore-backup "https://<link from Gluesync Connect>" --force
Pass --data-dir <folder> to restore into a folder other than DATA_DIR. Add --reset-connect when the original Core Hub still runs.
CLI
The command checks the backup before it touches the installation:
-
It decrypts the backup into a scratch folder inside the data folder.
-
It checks that the backup comes from the same release as this Core Hub, or from an older one.
-
It checks the size and the SHA-256 checksum of every file.
-
It runs the SQLite integrity check on every database.
-
Only then does it move the files that are in the way to
.pre-restore-<timestamp>in the data folder, and put the restored files in their place. It removes the write-ahead log files of the databases.
If any check fails, the installation is not changed. If placing the files fails halfway, the command puts the previous files back.
A successful restore prints a summary and exits with status 0:
Backup restored into /opt/gluesync/data
taken: <date and time> by Core Hub <version>
files: <number>
database: gluesync.db (schema <number>, integrity check passed)
moved aside: previous files are in /opt/gluesync/data/.pre-restore-<timestamp>
Start Core Hub normally to use the restored installation.
Lines starting with warning: can follow the file list. See Warnings after the restore.
| Exit status | Meaning |
|---|---|
|
The backup was restored. |
|
The command line is wrong, or there is no usable recovery key. |
|
The restore failed. The message after |
UI
-
Start Gluesync as you normally do. On Linux:
sudo gluesync start. If the backup came from an older release, Core Hub migrates the databases at the first start. -
Sign in to the Control Plane with a user that existed when the backup was made. The password is the one it had at that time.
-
Open Pipelines and check that your pipelines, agents and connections are there.
-
Open Settings → License and check the license.
-
Open a connection and test it.
-
If you did not use
--reset-connect, check that the Gluesync Connect tunnel is online. If you did, pair the new Core Hub with Gluesync Connect again. -
When you are sure about the result, delete the
.pre-restore-<timestamp>folder in the data folder. It holds the files of the previous installation, with their credentials.
The restored installation is the one of the time of the backup. A change made after that time is not in it. Check each pipeline before you rely on it.
When the original Core Hub still runs
A Core Hub has one identity in Gluesync Connect, stored in its database. A restored copy has the same identity as the original. If both run, they take each other’s tunnel down.
--reset-connect removes the stored pairing from the restored database. After the restore:
-
the backup settings are kept: backups stay on and the recovery key still works, because its public half is part of the restored settings;
-
the copy has no pairing, so the Backup screen shows Waiting for Connect until you pair it with Gluesync Connect;
-
the copy enrols as a new site;
-
on the free plan, only one site of the organization can back up. After pairing, the new site shows Unavailable with the site limit message while the original site holds the single place. It backs up once the original site releases the place in Gluesync Connect, or you upgrade the plan.
The release rule
The restore accepts a backup made by the same release or an older one. It refuses a backup made by a newer release, because its databases can use a schema this release cannot open, and Core Hub never migrates a database to an older schema.
To restore a backup made by a newer release, install that release or a newer one first. A newer Core Hub migrates the restored databases when it starts. After that, you cannot go back to the older release with these databases.
Warnings after the restore
The summary can show these warnings. The restore succeeded in each case.
| Warning | What to do |
|---|---|
The SSL keystore was restored to |
The keystore was restored inside the data folder and |
|
Stop Core Hub before you start it again on the restored data. |
The storage key is still the default one… |
The backup was made with the placeholder storage key. See Move to production. |
Core Hub runs in DEBUG mode… |
The backup came from a development installation. |
The version of this Core Hub ( |
A development build reports no release number. Use a Core Hub release at least as new as the backup. |
Troubleshooting
Errors that start with Error: mean the command did not start. Exit status 1.
Errors that start with Restore failed: mean the restore stopped. Exit status 2. The installation is unchanged, except for the case in Placing the files.
The command line and the key
| Problem | Possible cause | What to do |
|---|---|---|
|
A flag the command does not know. |
Use only |
|
A value that no flag asked for, for example an unquoted download link split by a shell. |
Put the link in quotes. The command never prints the value, so a key pasted in the wrong place does not reach your log. |
|
The flag has no value. |
Give the path of the backup file, or the link. |
|
The flag is the last argument, or the next argument starts with |
Give the value. |
|
There is no key and no terminal to ask for it. |
Set |
|
The text is not a recovery key. |
Copy the recovery key again. Do not use the key ID or a public key. |
|
The key was cut or has extra characters. |
Copy the whole key. Letters |
|
A character is wrong. |
Compare the key with your copy. |
|
You passed the key as an argument. |
No action for this run. Use the environment variable next time. |
Opening the backup
| Problem | Possible cause | What to do |
|---|---|---|
|
Wrong path, or the file is not visible inside the container. |
Check the path. With Docker, mount the file with |
|
The key is valid but it is not the one that sealed this backup. Typical after a key rotation. |
Use the key with the first ID. The Backups tab in Gluesync Connect shows the key ID of each backup. |
|
The file is not a backup, or the download saved an error page. |
Download the backup again. |
|
The backup uses a newer container format. |
Restore with a newer Core Hub release. |
|
The file is damaged. |
Download the backup again. If it fails again, choose another backup. |
|
The download stopped early or the file was cut. |
Download the backup again and compare the size with the one in Gluesync Connect. |
|
The file is damaged or was changed after it was written. |
Download the backup again. If it fails again, choose another backup. |
|
The part of the file that holds the locked data key is damaged. The recovery key is the right one. |
Download the backup again. If it fails again, choose another backup. |
Checking the contents
| Problem | Possible cause | What to do |
|---|---|---|
|
The archive inside the backup is damaged. |
Choose another backup. |
|
The file is encrypted correctly but it is not a Core Hub backup, or it is damaged. |
Choose another backup. |
|
The backup uses a newer layout. |
Use a newer Core Hub release. |
|
The Core Hub on this host is older than the one that made the backup. |
Install that release or a newer one. See The release rule. |
|
The data folder has databases or a bootstrap file. This is the case on the same host, and on a new machine where Core Hub already started. |
Add |
|
The disk of the data folder is too full. |
Free space, or restore into another folder with |
|
The backup is damaged or was modified. |
Choose another backup. Do not try to repair the file. |
|
The backup holds a file the restore does not accept. |
Choose another backup, or restore with a newer Core Hub release. |
|
The backup was made without the main database. |
Choose another backup. |
|
A database in the backup is damaged. The backup was made from a damaged database, or it was damaged since. |
Choose an earlier backup. If all fail, contact MOLO17 Support. |
|
The pairing cannot be removed. |
Run the restore again without |
Placing the files
| Problem | Possible cause | What to do |
|---|---|---|
|
A file could not be moved, for example for a permission problem or a full disk. |
Fix the cause named in the message. Check the folder in the message for files that were not put back, and copy them back by hand. Then run the restore again. |
|
The user running the command cannot write there. |
Run the command as the user that owns the data folder. |
Downloading
| Problem | Possible cause | What to do |
|---|---|---|
|
The link expired. |
Select Download again in Gluesync Connect and run the command at once. |
|
Gluesync Connect or the storage refused the request. |
Check that the link is complete and in quotes. Request a new one. |
|
The link starts with |
Use the |
|
The link is cut or has characters a shell changed. |
Copy the link again, in single quotes. |
|
A network error. |
Check that the host reaches the address, through your proxy or firewall. Then run the command again. |
|
The connection broke, or the file is larger than the 32 GiB limit of the command. |
Run the command again. If it persists, download the file with a browser and restore from the file. |
|
The address does not lead to the backup. |
Request a new link. |
|
Something the command did not foresee. The Core Hub log has the details. |
Contact MOLO17 Support with the message and the Core Hub log. |
Related guides
Contact MOLO17 Support if you need assistance with a restore.