Skip to content

Restoring a Backup

MrJSA edited this page Nov 2, 2026 · 3 revisions

Use this when the server crashed, you moved to a new server, or you want to go back to an earlier state.

1. Install the shop

On a new server, install the shop as described in Installation (steps 1–6), with the same domains as before. Use the same or a newer shop version than the one the backup was made with. You do not need to set up anything in the admin — all settings come back with the backup.

(Restoring on the existing server: skip this step.)

2. Restore in the admin

  1. Log in to the admin as a superadmin (on a new server: with the initial admin password from the install).
  2. Go to Settings → Export & Backups → Restore a Backup.
  3. Enter your backup repository and its access token (on the existing server the saved ones are used — leave the fields empty) and click Show backups.
  4. Select the backup you want (normally the newest, at the top). Encrypted backups are marked 🔒 encrypted.
  5. Encrypted backup: under Private key of the backups, choose your key file (shop-backup-key.txt) or paste its AGE-SECRET-KEY-1… line. The key is only used for this restore: it is sent in the request itself (never in the address or a header), held in memory, and neither saved nor logged.
  6. Tick I understand that all current data of this shop is replaced by the backup and click Restore selected backup.

The shop downloads the backup, checks it and loads it. This takes from a few seconds to a few minutes, depending on the size. The database restore is all-or-nothing: if anything goes wrong, the shop's data stays exactly as it was and the error is shown. Afterwards the shop restarts by itself and the admin takes you to the login page.

The restore only runs the SQL of the backup. A file that contains other commands for the database program (psql), which could start programs on the server, is refused with an error and nothing is changed. Still, a backup is loaded with full rights on the database: only restore backups you made yourself.

Instead of picking a backup on GitHub you can also upload a downloaded shop-backup-….zip.age (or an older unencrypted shop-backup-….zip) file there (up to 50 MB), together with the private key.

Message What to do
This backup is encrypted. Enter the private key … Choose your key file or paste the AGE-SECRET-KEY-1… line.
This private key does not belong to a public key the backup was encrypted with Wrong key file, e.g. an old one. Backups made before a key change need the old private key.
This is not an age private key You entered the public key (age1…). Restoring needs the private key from the same key file.

Restoring into a test or local copy? Tick Switch automatic backups off after restoring, so the copy does not write its own backups into the repository of your live shop.

3. Done

  • Log in to the admin with your old admin username and password (the accounts come back with the backup).
  • Orders, customers, products, settings, payment and email settings are all back.
  • The backup settings come back too, so automatic backups continue on the new server without setting them up again.

A backup made with a newer shop version is refused with a message — update the shop first (Settings → System & Updates), then restore.

Restoring on the command line

Only needed if the admin cannot be reached. Download the backup file from your backup repository (→ Releases → Assets) and, on your own computer, decrypt it with your private key (so the key never goes to the server):

age -d -i shop-backup-key.txt -o shop-backup-20261025-020000.zip shop-backup-20261025-020000.zip.age

(Older unencrypted .zip backups need no decryption.) Copy the .zip into the shop folder on the server (e.g. scp shop-backup-20261025-020000.zip user@your-server:/opt/rustwebshop/), delete the decrypted copy on your computer, and run on the server:

cd /opt/rustwebshop
sudo apt install -y unzip
unzip shop-backup-20261025-020000.zip -d restore

# Stop the shop, load the database, start the shop again
docker compose stop backend storefront admin
docker compose exec -T db psql -v ON_ERROR_STOP=1 --single-transaction -U shop_user -d shop_db < restore/database.sql
docker compose start backend storefront admin

# Copy the uploaded images and files back; they must belong to the backend's user (uid 10001)
docker compose cp restore/uploads/. backend:/app/uploads/
docker compose exec -u 0 backend chown -R 10001:10001 /app/uploads

# Clean up
rm -rf restore shop-backup-20261025-020000.zip

Clone this wiki locally