Hearth documentation

Upgrades, migrations and imports

Versions

Each Hearth build carries the commit it was built from, given as the REVISION build argument. The weekly summary lists the version every running container reports, so you can see at a glance that the web and jobs containers match.

Build from a known commit, and keep the previous image tagged until the new one has run for a day:

docker tag hearth:local hearth:previous
docker build --build-context pdfcraft-git=../hearth-pdfcraft/.git \
  --build-arg REVISION=$(git rev-parse --short HEAD) -t hearth:local .

Database migrations

Hearth's database changes are numbered migrations inside the binary. They run when the server starts (MIGRATE_ON_START, true by default), inside a Postgres advisory lock, so several containers starting at once are safe: one migrates, the others wait.

Where a separate step must migrate first, as the Kubernetes chart does with its Job, set MIGRATE_ON_START=false on the servers and run:

hearth migrate

hearth migrate needs only Postgres.

Migrations only go forward. Never rename or delete a migration file in a build of your own: a renamed migration runs again, and a new file that takes an old number is skipped.

Before an upgrade

  1. Read what changed since your build, in particular new settings. A setting that becomes required stops Hearth at start until you add it, with a message naming it.

  2. Dump the database:

    docker compose exec -T hearth-postgres pg_dump -U hearth -Fc hearth > hearth-$(date +%F).dump
    
  3. Check that the last backup succeeded, if you use Hearth's own (Backups).

Upgrading

  1. Build the new image.

  2. Recreate the Hearth containers:

    docker compose up -d hearth hearth-jobs
    
  3. Wait for /readyz, then sign in and open a few screens.

  4. If the new version names a new image for Hearth Office, ClamAV, LiveKit or Vaultwarden (in its deploy/ folder), update those services as well.

People who had Hearth open get the new web app when they reload the page. Phone apps keep working unless you raise their minimum build (Native apps).

Going back

Hearth does not migrate a database down. To go back:

  1. Stop the Hearth containers.

  2. Restore the dump you made before the upgrade:

    docker compose exec -T hearth-postgres pg_restore -U hearth -d hearth --clean --if-exists < hearth-2026-11-30.dump
    
  3. Start the previous image (hearth:previous).

  4. Run hearth sync new-epoch, so the sync apps compare their folders with the restored database:

    docker compose exec -T hearth /hearth sync new-epoch
    

Anything people changed after the dump (new files' records, messages, events) is lost from the database. Files written to the store in the meantime stay on disk and are found again by the next scan.

Notes' file format

When a new version changes how Notes stores notebooks, bring a person's notebooks up to date with:

docker compose exec -T hearth /hearth notes migrate --user alice

Without --apply it only reports what it would change. With --apply it writes the changes; every file it writes keeps its old content as a named version. Running it again changes nothing, and finishes a run that was stopped. --report FILE writes the report as JSON. To undo:

docker compose exec -T hearth /hearth notes migrate --user alice --undo [--run ID]

hearth notes reindex --user alice (or --all) builds Notes' index again from the files alone, and is safe at any time.

Moving from Nextcloud

hearth import nextcloud copies one Nextcloud account into one Hearth account. Nextcloud is only read, never changed.

  1. In Nextcloud, under Settings, Security, make an app password for the account.

  2. Make the Hearth account (by invitation or hearth user create).

  3. See what there is to copy:

    docker compose exec -T hearth /hearth import nextcloud \
      --url https://cloud.example.org --nc-user alice \
      --password-file /dev/stdin --user alice < app-password.txt
    

    With none of --calendars, --contacts, --notes or --files, it lists each calendar and address book with its number of items, the notes, and the top-level folders with their sizes.

  4. Copy, with --copy and what you want:

    docker compose exec -T hearth /hearth import nextcloud \
      --url https://cloud.example.org --nc-user alice \
      --password-file /dev/stdin --user alice --copy \
      --calendars --contacts --notes --files /Documents --files /Photos \
      < app-password.txt
    

--dry-run reports and writes nothing; --report FILE writes the report as JSON; --max-bytes N stops before N bytes. Quota and free disk space are checked first.

Running it again copies only what changed in Nextcloud since. It never overwrites or deletes anything it did not make: something already in place, or a copy changed in Hearth since, is left alone and reported.

People's phones and desktop sync apps from Nextcloud can then be pointed at Hearth, which speaks the same WebDAV, CalDAV and CardDAV.

Moving photos from Immich

hearth import immich copies one Immich account's photos and videos into one Hearth account's Photos. Immich is only read.

  1. In Immich, under Account settings, API keys, make a key with only these permissions: asset.read, asset.download, asset.statistics, user.read, stack.read, partner.read, and album.read (for albums) and person.read and face.read (for people). A key that may change anything is refused.

  2. See what there is:

    docker compose exec -T hearth /hearth import immich \
      --url https://photos.example.org --key-file /dev/stdin --user alice < immich-key.txt
    
  3. Copy, with --copy, and --albums and --people if wanted.

Originals are copied byte for byte into /Photos/<year>/<year-month>/, with dates, places, descriptions, ratings, favourites, archive, stacks, Live Photos and RAW files with their JPEG. A photo the account already has is not copied again. Immich's trash, locked folder, other accounts' photos and external libraries are not copied. The importer is tested with Immich 3 and refuses another major version.

To repeat the import every night in the night window:

docker compose exec -T hearth /hearth import immich nightly \
  --url https://photos.example.org --key-file /dev/stdin --user alice --albums --people < immich-key.txt
docker compose exec -T hearth /hearth import immich nightly --list
docker compose exec -T hearth /hearth import immich nightly --user alice --off