Repository navigation
v6.7.0
One can always go back: Nik takes its own backups and proves they restore, an upgrade is rehearsed before it touches the data, and an account is protected by more than a password.
After updating, set the backup passphrase: nothing is backed up until it is set. Read Upgrading.
What changed
- Nik takes its own backups: the database and the store of files in one encrypted file, every 6 hours at first, kept by retention (the latest 8 good ones and one a week for 4 weeks). The passphrase is its own, not
SECRET_KEY. - Each backup is proven to restore: restored into a scratch database and compared — the schema, the rows of every table, the checksum of every file.
- A copy on a second host over SFTP, sent by the automation worker; the backend still has no way out. Upgrade snapshots are copied too.
- Administrators are told when a backup fails, fails its test, is missed, gets old, when the directory fills or the copy fails.
deploy/restore.shputs a backup back, on the same server or a new one;deploy/rollback.shputs back the snapshot of an upgrade.- An upgrade is rehearsed: a snapshot, then the migrations on a copy. When they fail there the data is not touched and the page says what failed.
- A second factor at sign-in (an authenticator app, ten recovery codes), which one switch can require of administrators.
- Sessions end when unused (30 minutes for an administrator, 8 hours for everybody else) and can be seen and ended, one's own and, for an administrator, anybody's.
- Failed sign-ins wait instead of locking; administrators can be limited to listed networks.
- "Full backup" is "Export as one file", and importing one adds to the server instead of replacing it.
- Fixed: a browser's earlier session stayed alive after a new sign-in; a forwarded address was believed whoever sent it; a request from another site was not refused; a failed migration left the API restarting for ever.
Upgrading
git pull
podman compose up -d --build
- The compose file gained one volume,
backups(setNIK_BACKUP_DIRin.envfirst to keep backups on another disk). Migrations0048_backupsand0049_two_factorrun after a snapshot and a rehearsal. - Set the backup passphrase in Settings → System → Backup and write it down: no backup is taken until then, and none can be restored without it. Then the second host, if there is one.
- An administrator's session unused for 30 minutes now ends. People signed in stay signed in through the upgrade; nobody is asked for a second factor until the switch is on. Set up your own first.
- A change of an account's roles signs it out.
- Remove any override that sets
FORWARDED_ALLOW_IPS=*. - Run
sudo deploy/install-systemd.shagain to remove the old backup timer.
Choices made
- The database part of a backup is Nik's own dump, not
pg_dump: the image has no PostgreSQL 18 client. It reads the schema and every table in one transaction and is tested by a restore each time; it refuses a database that holds things Nik does not make (a view, a trigger or a function of one's own, a table outsidepublic). To be looked at again with point-in-time recovery. - Restoring is a command on the server, with the stack stopped or on a new host, not a button on a running one.
- No new service in the compose file: the backend takes and tests backups, the automation worker sends the copy.
- Only SFTP as a second place; no S3.
- Every 6 hours, 8 kept and 4 weekly: each backup holds the whole store, and the screen says how much room the kept ones take.
- The key can travel inside the encrypted backup (off at first): without
SECRET_KEYthe stored secrets cannot be read after a restore, so.envis kept elsewhere or the key is included. - A stopped upgrade answers the health check with 200 and
upgrade-stopped, so the page can say what happened; a monitor reads the body. - After a restore or a rollback nobody is signed in; second factors, recovery codes and the sign-in settings are kept.
- Changing the passphrase or the backup settings, deleting and downloading a backup need a signed-in administrator, not an API key; taking and verifying one do not.
- Only administrators can be required to have a second factor; everybody may set one up. It applies at once, to open sessions too.
- TOTP only: no passkeys, no "remember this browser", no single sign-on.
- Setting a second factor up asks for the password, unless the sign-in is of a moment ago.
- API keys are not asked for a second factor; an administrator's key obeys the listed networks.
- Waits, not locks: a lock lets anyone keep an account out.
Known limits
- Under rootless podman, and on Docker Desktop, the server sees one address for every caller: administrators' networks cannot be listed there (the screen says so and refuses), and waits are by account only.
- Nothing between two backups is recovered: up to 6 hours at the first settings. Point-in-time recovery is not in this version.
- The second host must be reachable directly from the automation worker (no proxy for SFTP).
- A backup must be readable by the unprivileged user of the container for
deploy/restore.sh; the script says so when it is not. - After a restore on the second host the copy settings still point at that host.
- A stored credential used by the backup destination is not listed under the credential's uses.
- The old import brings accounts with the passwords they had on the other server.
Not verified on real systems
- Podman, rootless or not, and SELinux hosts: every proof ran on Docker. What the guides say of podman follows how it is documented to work.
- Sizes: nothing above an 800 MB store and a 1.35 GB database was backed up, restored or rehearsed.
deploy/rollback.shchecking out the earlier release was not run (always with--no-checkout); the rest of the script was.- SFTP was proven against one OpenSSH server in a container, not the real second host.
- Migrations
0048and0049, the snapshot and the rehearsal have not met the database of the server. - The sign-in changes were tested by the suites; no one has enrolled a phone against the running server yet.
- The end-to-end suite stops at times on the development machine for a wrong password check that is the machine's own fault; the runs counted are clean ones.