Skip to main content
Installation

Upgrade and backup

New-version notices, online and offline upgrade from the console, automatic rollback, manual upgrade and manual recovery, and how to back up and restore.

An upgrade only replaces images and deployment files; .env and data/ are kept. The database schema is upgraded when the service starts, the licence is not affected and no reactivation is needed.

Always upgrade in the original installation directory.

New-version notices

The service checks for a new version 1 minute after it starts and every 24 hours after that. The version information carries a Reallysec release signature and is used only if the signature verifies. If the signature is wrong, the file is damaged or the site cannot be reached, no notice appears; the reason is shown only under System settings > Upgrade (系统设置 > 升级).

  • When a new version exists, the super administrator sees New version x.y.z in the top bar. Selecting it opens System settings > Upgrade, with the release notes, release date and a download link for the offline package for this architecture. Other users see no notice.
  • Select Check for updates to check now, at most once every 30 seconds.
  • The bastion never upgrades itself; the super administrator starts every upgrade.
  • On air-gapped networks, set UPDATE_URL= in .env and run docker compose up -d. No online check is made after that, and the page says that online update checks are turned off. Offline upgrade packages can still be uploaded.

One-click upgrade from the console

Prerequisites

  • The bastion was deployed from the official package and uses SQLite.
  • The upgrade helper is running on the host; the Upgrade page shows that it is running. If not, run sudo ./install.sh updater <installation directory> as root; see Installation.
  • The super administrator works from a console sign-in. API tokens cannot start an upgrade.

Online upgrade

  1. Under System settings > Upgrade, select Upgrade to x.y.z.
  2. Read the notice and select Start upgrade.

Only images the host does not already have are downloaded; if the remote desktop proxy image is unchanged, it is not downloaded again.

Offline upgrade

  1. Get the offline upgrade package bastion-<version>-linux-<arch>.tar.gz and its signature file .tar.gz.sig from the download link on the Upgrade page or from your supplier.
  2. Under Offline upgrade, choose both files and select Upload and verify. The bastion checks the signature, architecture and version, and then reports that the package signature is valid and ready.
  3. Select upgrade, read the notice and select Start upgrade.

Upgrade steps

The console shows the progress of each step live:

  1. Verify signature: an online upgrade downloads and verifies the version information again; an offline upgrade verifies the package signature.
  2. Download images (online upgrade) or extract them from the offline package, checking the SHA-256 and signature of each.
  3. Load images and take the new version's deployment files and upgrade helper from them.
  4. Back up the database: stop the service and copy the database to backups/upgrade-<old version>-to-<new version>-<time>/ in the installation directory.
  5. Switch version: change BASTION_VERSION in .env, replace docker-compose.yml (the old file is kept as docker-compose.yml.bak-<old version>) and run docker compose up -d.
  6. Health check: the new version must report healthy 3 times in a row, within at most 5 minutes including the schema upgrade.

After a successful upgrade, the upgrade helper replaces itself with the one shipped in the new version and restarts.

If a step fails

  • Steps 1 to 3: nothing is changed.
  • Step 4: the old version is started again.
  • Steps 5 and 6: automatic rollback. The old .env and docker-compose.yml are restored, the database is restored from the step 4 backup and the old version is started.

From stopping the service in step 4 to finishing step 6, the service is usually down for under a minute and sessions in progress are disconnected. Sign-in tokens are held only in memory, so after the restart every user, including the administrator who started the upgrade, must sign in again. Upgrade at a quiet time.

After signing in again, check the result on the Upgrade page. Every update check, offline package upload, upgrade request and upgrade result is listed under Upgrade history (升级记录).

If the current version cannot upgrade straight to the target version, the page names the intermediate version to upgrade to first.

Manual recovery

Recover by hand only if the console shows Rollback failed (回滚失败) or Interrupted (已中断). In the installation directory, run:

cd /opt/bastion
docker compose stop bastion
# Restore the pre-upgrade deployment files (if present)
cp .upgrade/rollback/.env .env && cp .upgrade/rollback/docker-compose.yml docker-compose.yml
# Restore the database (pick the latest backup)
rm -f data/sqlite/*
cp backups/upgrade-<...>/* data/sqlite/
docker compose up -d

Manual upgrade

If the upgrade helper is not installed or one-click upgrade is unavailable, upgrade by hand:

tar xzf bastion-<new version>-linux-amd64.tar.gz && cd bastion-<new version>-linux-amd64
gunzip -c images.tar.gz | docker load
cd /opt/bastion
# Back up first, as described below
cp docker-compose.yml docker-compose.yml.bak && cp <new package directory>/docker-compose.yml .
sed -i 's/^BASTION_VERSION=.*/BASTION_VERSION=<new version>/' .env
docker compose up -d

Backup

Back up the whole data directory with the service stopped

data/ holds both the database and the .encryption-key that decrypts it, so a backup is equivalent to every asset password in clear text and must be stored encrypted:

cd /opt/bastion
docker compose stop bastion
# Enter an encryption passphrase when prompted
tar czf - data .env docker-compose.yml | gpg -c -o /backup/bastion-$(date +%F).tar.gz.gpg
chmod 600 /backup/bastion-*.gpg
docker compose start bastion

To restore, run gpg -d bastion-<date>.tar.gz.gpg | tar xz in the installation directory.

Export a backup from the console

The super administrator can also export a backup under System settings > Backup and restore (备份与恢复). It is encrypted with a passphrase you set and does not include recordings; see System settings.

The licence is bound to the host. After restoring a backup on another host, the licence stops working and must be activated again.

On this page