Maintenance
A self-hosted instance needs three things from its operator: updates, a backup, and an eye on certificates. All of it happens on the server, on the System page of the dashboard, or under Settings, Advanced. Managed beta instances are maintained by us, so this page only applies to self-hosted installs.
Updating
Releases are git tags in the form vX.Y.Z, built by CI into a Docker image. When a newer release exists, the System page shows its release notes and an update button. Automatic updates are set under Settings, Advanced.
Manual Updates
The System page shows an "Update to vX.Y.Z" button. It swaps the app to the new version with all data intact and takes about a minute, during which the dashboard is unreachable. Only an owner can start it, because it changes the running code for every member.
cd /opt/knecht
git fetch --tags && git checkout vX.Y.Z
sed -i 's/^KNECHT_VERSION=.*/KNECHT_VERSION=vX.Y.Z/' .env
docker compose pull && docker compose up -d
Automatic Updates
Under Settings, Advanced, the panel "Automatic updates" has a field for a cron expression in server time, for example 0 3 * * * for nightly at 03:00. Once set, Knecht updates itself as soon as a new release exists and no run is active. Leave the field empty to update by hand.
What an Update Covers
The update covers everything Knecht runs on, the DDEV version included, since DDEV ships inside Knecht's image. After an update that brings a new DDEV version, the first environment start waits a few minutes while Knecht pulls the new DDEV images. Sessions started after that boot at normal speed.
The host itself only runs Docker, which stays with the operating system's package updates.
Instances installed before v0.14.0 still have a DDEV CLI on the host. Knecht no longer uses it. It can stay, or be removed with sudo apt-get remove ddev.
Pre-Releases
Tags with a hyphen, such as v0.3.0-rc.1, are pre-releases. CI builds them like any release, but they are never offered as an update and a normal install ignores them. To test one, fetch the installer from that tag and pin the same tag with KNECHT_REF, so installer and version cannot diverge:
curl -fsSL https://raw.githubusercontent.com/knecht-works/knecht-cloud/v0.3.0-rc.1/scripts/install.sh \
| sudo env KNECHT_DOMAIN=knecht.example.com KNECHT_REF=v0.3.0-rc.1 bash
Once the matching stable release is published, the instance offers it as a regular update. Updating from a stable version to a pre-release is not possible.
Cleanup
The System page runs an hourly cleanup and offers the same categories for a manual run: removed sessions and projects, Docker images, and the package cache, each with its own checkbox. All of them are preselected except the Knecht cache, which covers the Nitro cache, the model catalog, and the release check, and is only cleared by hand.
A manual run reports how much disk space it freed.
Backup and Rollback
All state lives in /data/knecht/data: the SQLite database, run archives, and uploaded database dumps. Back that folder up, or snapshot the whole server. Project checkouts under /data/knecht/projects are disposable, Knecht clones them again when needed.
NUXT_SESSION_PASSWORD in /opt/knecht/.env. A backup of the data folder alone cannot be restored without that file. Keep a copy of the .env as well, ideally separate from the data backup.Database migrations run forward only. Checking out an older release does not roll the schema back. Take a copy of /data/knecht/data before an update if you want a safe way back, and restore the copy together with the older tag.
On a Mac, both folders live inside the Lima VM. Reach them through limactl shell knecht, or back up the VM disk as a whole.
Locked-Out Owners
When no owner can sign in, the server prints the reset link an owner would otherwise create, see Forgotten Passwords:
cd /opt/knecht
docker compose exec knecht node scripts/reset-password.mjs <username>
Without a username, the script lists the usernames. So we got your back in case you forget that too!
Certificates
Caddy handles TLS on its own. It fetches the dashboard certificate on first start and a preview's certificates while its environment boots, so the first visit does not wait. Nothing needs renewing by hand.
Let's Encrypt issues at most 50 new certificates per week per domain. Each newly visited preview hostname uses one, renewals do not. A team with many sessions per week can hit that limit. The way out is a wildcard certificate for the preview zone:
- Delegate the preview subzone to a DNS provider with an API, for example
preview.knecht.example.com NS -> Hetzner DNS. The main zone stays where it is. - Build Caddy with the matching DNS plugin.
- In
/opt/knecht/Caddyfile, replaceon_demandwithtls { dns <provider> }.