Self-hosting
Updating
Moving to a new release: back up, check out the new tag, pull the images and start again. The migrations run before the API, and open tabs reload by themselves.
Before you start
- Read the release notes of the new tag on GitHub: they say what changed, new settings in
.env.example, and anything to do by hand. - Back up (Backups). Migrations only go forward: the backup is the only way back.
- Update one release at a time if you’re several behind, reading each one’s notes.
Update
From the repository’s folder:
git fetch --tags
git checkout v0.0.32 # the new release
cd selfhostCompare your .env with the new .env.example and add what’s new (diff .env.example .env
helps). The tag’s docker-compose.yml names its own images, so there’s no version to change in
.env (unless you set KLANG_VERSION there to pin one: remove that line). Then:
docker compose pull
docker compose up -d
docker compose restart caddy # so it reads the new release’s CaddyfileIf you build the images yourself, docker compose build instead of pull.
What happens:
migrateruns the new migrations, and the API and the gateways only start once it’s done. If one fails, the new API doesn’t start:docker compose logs migratesays why, and your backup is the way back.s3-initruns again and applies the store’s current policies.- People with Klang open get reconnected. If the app in an open tab is older than the new gateway accepts, it reloads itself at a quiet moment (not during a call, not with a message half written), so nobody has to refresh.
Check it with docker compose ps: every service running or healthy, and migrate and
s3-init Exited (0).
Your changes
git checkout only works if you haven’t edited the repository’s files.
- Your settings are in
.envand your changes to the services incompose.override.yml. Git ignores both, and an update never touches them. - An edited
Caddyfile(the panel’s address list, for example) is a change to a file of the repository. Keep it across the update withgit stashbeforegit checkoutandgit stash popafter, and check the result if the release changed the Caddyfile too.
Going back
The database can’t be migrated back. To return to the previous release, restore the backup you made before updating (Restore) with the previous tag checked out.
Cleaning up
Old images stay on disk. When the new release works, list Klang’s and remove the previous version’s by name:
docker image ls 'ghcr.io/klang-gg/*'
docker image rm ghcr.io/klang-gg/klang-api:0.0.31 # and the other four of that version