Skip to content

Self-hosting

Updates, backups and restore

Installing a new release, release approval, automatic rollback, database and file backups, and the restore drill.

Last updated:

A new release

The new package is unpacked into a directory of its own and installed:

sudo ./deploy.sh --pubkey release.pub --env /etc/journalos/prod.env --pg-env /etc/journalos/postgres.env

The release must first be registered and approved in the operator console; an unapproved release stops with nothing changed. deploy.sh then verifies the package, loads the images, records the schema versions, turns on maintenance mode (pages and the API answer 503 except health), takes a pre-upgrade database backup, runs the migrations, starts the services and waits for the health check to pass three times in a row.

Rollback

If the health check does not pass, the migrations are rolled back to the recorded schema versions and the previous images start again. If the schema cannot be rolled back, the system stays in maintenance mode and is restored from the pre-upgrade backup.

Backups

  • Database: pgBackRest with a full backup weekly, a differential one daily and continuous WAL archiving (at least every five minutes). Backups are compressed and AES-256 encrypted; four full backups, about four weeks of point-in-time recovery, are kept.
  • Files: new files are copied every fifteen minutes into the backup store, encrypted and with their checksums verified.

Backups are in the BACKUP_DIR directory; it should be a disk or network share separate from the data disk. Keep a copy of the encryption keys (PGBACKREST_REPO1_CIPHER_PASS and BACKUP_FILES_KEYS) away from the server, in the institution's password vault; without them nothing can be restored.

The restore drill

The drill script in the package restores a backup into a temporary database on a network of its own, checks the audit chains, the schema versions and a sample of files, and reports the recovery time and the data-loss window:

sudo ./docker/drill.sh --env-file /etc/journalos/prod.env --set latest

The script reads the installation's image versions and backup directory from prod.env. The steps of a real restore (stopping the application, emptying the data volume, restoring a backup or a point in time, restoring files) are in the installation guide.

A question this page does not answer? Write to us.