Upgrades and rollback
Upgrading
Section titled “Upgrading”With Compose, point KEPT_IMAGE in .env at the new release and:
docker compose pulldocker compose up -dYour own build from a checkout instead: git pull, docker build -t kept:local ., then
docker compose up -d with KEPT_IMAGE=kept:local.
A release can change compose.yaml too; its notes say so. Download the release’s file over yours
(curl -fsSLO https://raw.githubusercontent.com/keptinventory/kept/v<version>/compose.yaml, or
compose.full.yaml if you run that one); .env stays as it is.
Settings that need the new compose.yaml
Section titled “Settings that need the new compose.yaml”compose.yaml hands Kept the settings it names, and no others. An upgrade to 1.14.5 that only
changes KEPT_IMAGE keeps 1.14.4’s file, which doesn’t pass KEPT_HTTP_SIGN_IN_DAYS or
KEPT_EXTRA_ADDRESSES and sets KEPT_TRUSTED_PROXIES itself. Those lines in .env do nothing until
you download 1.14.5’s compose.yaml (or compose.full.yaml) and run docker compose up -d.
Backups set up from Admin → Backups (1.14.9)
Section titled “Backups set up from Admin → Backups (1.14.9)”From 1.14.9, compose.yaml gives the kept service the database owner’s login, which the nightly
backup needs, so a bucket or SFTP target is set up in Admin → Backups with nothing else to change.
Download 1.14.9’s compose.yaml (or compose.full.yaml) to get it
(above); until then Admin → Backups says “Backups can’t
run yet”. A compose.override.yaml that added the owner login for backups can go (it does no harm
if it stays); its directory mounts stay.
Caddy and Ollama moved to compose.full.yaml
Section titled “Caddy and Ollama moved to compose.full.yaml”From 1.14.5, compose.yaml runs Kept and its database only. Caddy (the https
profile), Ollama (the ollama profile) and the commented split deployment are in
compose.full.yaml: the same file plus those. If you use Caddy or Ollama, download
compose.full.yaml instead and set COMPOSE_FILE=compose.full.yaml in .env:
curl -fsSLO https://raw.githubusercontent.com/keptinventory/kept/v<version>/compose.full.yamlecho COMPOSE_FILE=compose.full.yaml >> .envdocker compose --profile https up -d # the profiles you use: https, ollama or bothOtherwise the next download of compose.yaml drops Caddy: Compose calls its container an orphan,
and once that is gone, Kept is left on plain http. Kept’s services, the network and the volumes
(Caddy’s certificates in caddy-data, the models in ollama) are the same in both files, so
nothing is lost. Without Caddy or Ollama, nothing changes.
Behind your own proxy, KEPT_TRUSTED_PROXIES in .env reaches Kept from 1.14.5. Before,
compose.yaml set its own value, so a line in .env was ignored and every visitor shared the
proxy’s sign-in limits. A value already in .env takes effect once you’ve downloaded 1.14.5’s
compose.yaml (above); one in a
compose.override.yaml can move to .env. With compose.full.yaml’s Caddy, leave it empty or
keep 172.29.72.200 in the list (reverse proxies).
Sign-in links (1.14.0)
Section titled “Sign-in links (1.14.0)”1.14.0 moves Kept to better-auth 1.7.13, which fixes an advisory where an OAuth sign-in’s state could be used as a magic link to sign in as someone else (GHSA-965c-763c-88jm). A magic link mailed, or a Google or OIDC sign-in started, before the upgrade no longer works: ask for a new link, or sign in again.
Install without a clone (1.13.0)
Section titled “Install without a clone (1.13.0)”Since 1.13.0 compose.yaml needs no copy of the repository and no database passwords: a one-shot
bootstrap service makes the logins on every start. An install made before keeps working as it
is: its five KEPT_DB_*_PASSWORD lines in .env are used as given
(an install from before 1.13.0). Two things to
know: an empty KEPT_IMAGE no longer builds the checkout (it runs the release compose.yaml
names), and the owner’s password is read from the kept-owner volume once .env no longer holds
it (the owner login).
The one-shot migrate service runs kept migrate first: the migrations apply once, under a
database lock, before the new version serves a request. Kept’s migrations only add (a column or
table is dropped or renamed only across two releases), so the previous version still runs against
the new schema, which is what makes going back possible.
Read the release notes before a major version (1.x to 2.0).
The image moved (1.8.0)
Section titled “The image moved (1.8.0)”Since 1.8.0 the image is ghcr.io/keptinventory/kept and the chart
oci://ghcr.io/keptinventory/charts/kept. Releases up to 1.7.1 stay at
ghcr.io/ibrahimroshdy/kept, which gets no new versions. To upgrade, change the image name once:
- Compose:
KEPT_IMAGE=ghcr.io/keptinventory/kept:1.8.0. - Helm:
image.repository: ghcr.io/keptinventory/kept, or install the chart from its new address.
The signing key is the same, so cosign verify --key cosign.pub ghcr.io/keptinventory/kept:<version>
works as before (Verify a release).
Knowing there’s a new version
Section titled “Knowing there’s a new version”Kept can check for new versions, and it is off by default. On, it asks GitHub once a day, and
once after each upgrade, for the latest release of the repository its image was built from, sending nothing but the request (no
version, no instance identifier). Nothing is downloaded or installed. KEPT_UPDATE_CHECK=true
turns it on and locks it; false locks it off.
The switch is in Admin → Sign-up, under “New versions”. Admin → Status says “Kept X is available” when a newer release exists, and its Check now asks at once. After an upgrade the notice goes at once, and Kept asks again within the hour.
The snapshot before every upgrade
Section titled “The snapshot before every upgrade”When kept migrate finds pending migrations on a database that already has data, and a backup
target is configured, it first takes a database-only restic snapshot tagged pre_upgrade. If the
snapshot fails, nothing is migrated and the command stops with the reason. The last 3
pre-upgrade snapshots are kept.
- No backup target: Kept migrates anyway, logs it loudly, and Admin → Status says it was “upgraded without a backup” until the next good backup.
KEPT_UPGRADE_SNAPSHOT=off(orkept migrate --skip-snapshot) skips it on purpose.- The Home Assistant app never takes one: Home Assistant’s backup before the update is the way back.
- A brand-new database never takes one.
For this to work, the migrate service needs the keys and the backup settings as well as the owner
login. The Compose file gives it all three; a directory target also needs its mount on migrate
(backups).
Going back one version
Section titled “Going back one version”To roll back, run the previous release’s image again: KEPT_IMAGE back to the old tag, then
docker compose up -d. There are no down migrations; the previous version runs on the newer schema.
Kept records each release’s migrations in the database, and checks at start:
- the database is one release ahead of the image: Kept starts, and Admin → Status says it was rolled back from X;
- more than one release ahead, or ahead by migrations no recorded release made: Kept refuses to
start (
downgrade_refused) and names both versions. That is the moment to restore the pre-upgrade snapshot instead.KEPT_ALLOW_DOWNGRADE=1forces the start, and the force is audited.
From 1.14.4 back to 1.14.3: 1.14.3’s map has a 1 m minimum. A room under 1 m a side keeps its size until someone taps Done in Arrange, which saves it at 1 m (or refuses, if that makes it overlap the next room). To keep those sizes, don’t arrange the map until you are back on 1.14.4.
Postgres major upgrades
Section titled “Postgres major upgrades”Kept’s Compose file pins Postgres 18 by digest, and its dependency updates never propose a major bump. A new major version is a dump and restore, never a tag change on the existing volume (the data files of one major version don’t open in another):
- Take a backup and let it finish:
docker compose run --rm --no-deps --entrypoint kept kept admin backup. - Stop Kept:
docker compose stop kept. - Change the
dbimage to the new major version, on a new volume (renamekept-dbincompose.yaml, or move the old one aside); keep the old volume until you’re done. docker compose up -d db: the init script creates the roles and extensions in the empty database.- Restore the backup into it, then
docker compose up -d.
Kept’s image carries the client tools of the Postgres major version it supports, and the restore checks they match the server’s.