Back up and update self-hosted n8n safely
How to back up a self-hosted n8n: the encryption key, workflows and credentials, plus a safe update routine that leaves a way back if a new version breaks.
Installing n8n takes ten minutes. Keeping it for two years is the real job: you need a backup you have actually restored once, and an update routine that does not end with every credential showing "could not be decrypted". This guide covers both, for n8n running in a single container with its default SQLite database — the way most small teams run it, and the way the Keenrig catalog installs it.
What a complete n8n backup contains
Everything n8n needs lives in its data folder, /home/node/.n8n inside the official image. Three things in there matter:
- database.sqlite — workflows, credentials (encrypted), execution history, users and settings.
- The encryption key: n8n generates a random one on first launch and saves it in this same folder, unless you set N8N_ENCRYPTION_KEY before the first start.
- Anything else in the folder, such as custom nodes or binary data stored on disk.
The encryption key is the part people lose. n8n encrypts every saved credential with it. Restore the database onto an instance with a different key and your workflows come back, but every API key, OAuth token and password in them is unreadable — you re-enter them one by one. So the rule is simple: the database and the key travel together, always.
Option 1: copy the whole data folder
The most reliable backup is the entire volume, ideally taken at a quiet moment when no workflow is running. On Keenrig that is what the backup command does: it snapshots the instance, including each app’s volume, encrypts it with a passphrase you choose, and sends it to a folder on the server, a mounted NAS or your own S3 bucket. The Backup page in the admin panel prints the exact commands; they look like this:
# run as root; set the target and passphrase first
export KEENRIG_BACKUP_TARGET=dir # or s3
export KEENRIG_BACKUP_CONFIG=/mnt/backups
export KEENRIG_BACKUP_PASSPHRASE='a long passphrase you store elsewhere'
/var/lib/keenrig/bin/keenrig-box backup --data /var/lib/keenrig
/var/lib/keenrig/bin/keenrig-box backups # list snapshotsEncryption cannot be turned off, because the snapshot also carries the server’s own master key. That cuts both ways: lose the passphrase and the backup is useless. Store it in a password manager that does not live on the same server.
Option 2: export workflows and credentials with the n8n CLI
A second, portable copy is worth having: plain JSON you can read, diff and import into any n8n, including n8n Cloud. The n8n CLI exports both. Run it inside the container (the App ID is shown on the app’s page in the Keenrig admin panel):
CID=$(sudo docker ps -q --filter label=keenrig.com.id=<app-id> | head -n 1)
sudo docker exec -u node $CID n8n export:workflow --all --output=/home/node/.n8n/exports/workflows.json
sudo docker exec -u node $CID n8n export:credentials --all --output=/home/node/.n8n/exports/credentials.jsonWithout --decrypted, exported credentials stay encrypted with your key — safe to store, but useless without the key. With --decrypted they are plain text: handy for a migration, dangerous to leave lying around. Keep the export inside the data folder as above and it is also picked up by the next volume backup.
Test the restore once
A backup you have never restored is a hope, not a backup. Rent a throwaway VPS for an hour, install Keenrig, point it at the same backup target and passphrase, and restore:
/var/lib/keenrig/bin/keenrig-box restore --data /var/lib/keenrig --from <snapshot-id>
# or only n8n, leaving other apps and settings untouched:
/var/lib/keenrig/bin/keenrig-box restore --data /var/lib/keenrig --from <snapshot-id> --app <app-id>A full restore refuses to run over a server that already holds data, by design: there is no force flag. Open n8n, run a workflow that uses a stored credential, and you know the key came along.
Updating n8n without losing a week
n8n’s own docs ask you to update at least once a month and to read the release notes for breaking changes first. n8n follows semantic versioning, so a new major version is the one that may need action from you. As of November 2026 that is concrete: n8n 3.0 shipped in late October 2026 with breaking changes, including the removal of several legacy nodes. Before a major jump, open Settings → Migration Report in n8n (global admins only): it lists the workflows the new version will affect. A routine that works:
- Take a fresh backup right before the update, not last week’s.
- Read the release notes for every version between yours and the target.
- Move one step at a time when the gap is large, rather than leaping across a major version.
- Update during a quiet hour: in single-container mode, executions running at that moment can be cut off.
- Afterwards, open a few workflows that use credentials and run them by hand.
On Keenrig, each catalog app is pinned to an exact image digest, so n8n never updates itself behind your back — a reinstall gives you the same build. The app’s Configuration tab shows the image it runs; change it there when you decide to move. Keenrig starts the new version before stopping the old one, and if the new container fails to start, the old one keeps serving. What it cannot undo is a database migration the new version has already run. That is what the backup from step one is for.
What this does not cover
- Scheduled backups: today Keenrig backups run by command. Put the command in a cron job if you want it nightly; scheduling inside the admin panel is in progress.
- Queue mode with Postgres and Redis: the backup steps differ (you dump Postgres instead of copying a SQLite file), and the catalog entry does not set it up.
- Automatic rollback of n8n’s own database migrations: if an update migrates the database and you need to go back, you restore the backup.
- Addon databases: the backup command does not yet include dumps of separate database addons. n8n in the catalog keeps everything in its own volume, so it is not affected.
If you have not installed n8n yet, the n8n page in the Keenrig app catalog shows exactly what the entry sets up, and the free Starter plan runs it with no limit on apps.