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
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.
Dump the database:
docker compose exec -T hearth-postgres pg_dump -U hearth -Fc hearth > hearth-$(date +%F).dumpCheck that the last backup succeeded, if you use Hearth's own (Backups).
Upgrading
Build the new image.
Recreate the Hearth containers:
docker compose up -d hearth hearth-jobsWait for
/readyz, then sign in and open a few screens.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:
Stop the Hearth containers.
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.dumpStart the previous image (
hearth:previous).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.
In Nextcloud, under Settings, Security, make an app password for the account.
Make the Hearth account (by invitation or
hearth user create).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.txtWith none of
--calendars,--contacts,--notesor--files, it lists each calendar and address book with its number of items, the notes, and the top-level folders with their sizes.Copy, with
--copyand 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
- Calendars and task lists keep every event and task exactly, with recurrences, reminders and attendees. No invitations or mail are sent, and no reminder rings for what is past.
- Address books keep every card, with photos and groups.
- Notes go into a notebook "Nextcloud Notes", each category a section.
- Files keep their times, favourites, tags and earlier versions. Every copied file is checked against what was read.
- Not copied: what others shared with the account, the birthdays calendar, end-to-end encrypted folders, mail, Talk, Passwords, Deck, and the account's own shares.
--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.
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, andalbum.read(for albums) andperson.readandface.read(for people). A key that may change anything is refused.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.txtCopy, with
--copy, and--albumsand--peopleif 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