Self Host Wizard Docs

Home, admin panel and set-up wizard (home)

Home, admin panel and set-up wizard on a Self Host Wizard box: the home piece, served at app.<apps domain>, forward sign-in, memory limit 30 MB.

At a glance

FieldValue
Addresshttps://app.<apps domain>
Sign-inforward: Caddy asks Authelia before the app sees a request (forward auth)
Memory limit30 MB (ram_mb: measured peak × 1.3)
Host servicethx-app.service
Needslldap, authelia
Needed bynothing
Open without sign-in/welcome/* /api/v1/welcome/* /static/* /api/v1/deploy/*
Licence (from the README)Apache-2.0
Upstream (from the README)https://app.<apps

Turn it on

thx enable adds home and everything it needs to the box's state; thx apply then installs it. Apps are applied only once site_domain is set.

sudo thx enable home
sudo thx apply

Engineering notes (pieces/home/README.md)

The app at https://app.<apps domain>: Home (the launcher everyone opens), the admin panel (People, Domains, Apps, Health) and the first-run set-up wizard. Ours, Go, Apache-2.0. Source: cmd/thx-app, internal/webapp, web/app. Design: web/app/design/DESIGN-PLAN.md, web/app/DESIGN.md.

Not a container

Unlike the other pieces, home is a host binary run by systemd (thx-app.service), not a compose project. It makes every change by running the thx CLI, which needs root on the host (state in /etc/thx, docker, the firewall); a container would need all of that mounted in, which is the host with extra steps. It listens on 127.0.0.1:18096 only. piece.toml therefore has unit = "thx-app.service" and binaries = ["thx-app"] instead of a compose.yaml (a host-unit piece, docs/pieces.md): thx apply copies thx-app next to thx in /usr/local/bin, writes the unit, and restarts it when the binary changed.

How people reach it

  • auth = "forward": Caddy asks Authelia first and passes Remote-User, Remote-Groups, Remote-Name, Remote-Email. thx-app trusts those headers only on the host app.<apps domain>; Caddy must also strip any client-sent Remote-* headers.
  • Four paths skip forward auth: /welcome/* and /api/v1/welcome/* (a new person's one-time link to choose a password, before they have one), /static/*, and /api/v1/deploy/* (website uploads: the site's deploy key is the only credential, and the handler never reads Remote-*).
  • Before the box has a name, the wizard is served on the bare IP. thx-app link -ip <public ip> prints a one-time link (https://<ip>/#t=<token>, one hour, one use). The token is in the URL fragment, so it never reaches a log; the page trades it for a set-up session cookie (thx_setup, Secure, HttpOnly, SameSite=Strict, 12 hours). Only hashes are stored, in /var/lib/thx-app/setup.json (0600). Running the command again issues a new link and ends the old one.

A new person, end to end

An admin adds a person in People (POST /api/v1/people → thx user add, LLDAP only). Nothing else is provisioned, because nothing else needs to be: Stalwart finds the mailbox in LLDAP by mail, Drive's spaces (/me, /org/<org>, /team/<org>/<team>) come from the forward-auth groups, Radicale and the OIDC apps read the same groups. The invite mail carries one link and says what is waiting: username, address, teams, and exactly the apps Home will show them.

The link (/welcome/<token>) sets the password with thx user passwd, then signs the person in at Authelia server-side (POST <-authelia>/api/firstfactor, default http://127.0.0.1:9091, with X-Forwarded-Host: auth.<apps domain>) and passes Authelia's session cookie on, so "Open your office" lands them inside. If Authelia refuses or is down, the password is still saved and the page asks them to sign in; nothing is lost.

Home, per person

  • Which cells a person sees follows the piece: a forward-auth piece with [forward] groups (Status, Analytics: admins) is shown only to members of those groups, in a "For admins" group, since Authelia would answer anyone else 403. Counts in the strip count visible apps only.
  • The sign-in note on a cell follows the piece's auth: ldap/none say the app asks for the office password; oidc/forward say nothing (the office sign-in carries over); the vault adds its master password. thx-app carries the same embedded pieces/ as thx, both built from one tree and installed by one apply.
  • /password: a signed-in person changes their own password. The current one is checked by signing in to LLDAP as them (/auth/simple/login); the new one goes to thx user passwd on stdin. Rate-limited per person. (Authelia's own reset and change pages are off on the box.)
  • /connect: mail, calendar and contacts settings, plus /connect/apple.mobileconfig, an unsigned Apple profile with the IMAP/SMTP/CalDAV/CardDAV accounts and no password; its UUIDs are stable per box and person, so downloading it again replaces the installed one. The calendar login is the LLDAP uid (Radicale's ldap_user_attribute = uid); mail takes the address. There are no per-device app passwords: LLDAP and Radicale have no such thing, and Stalwart checks passwords against LLDAP here, so every device uses the office password.

What it reads

  • /etc/thx/state.json (companies, domains, apps), read fresh on each request.
  • /srv/thx/site/stats.json (Health, the memory meter).
  • LLDAP over its GraphQL API at 127.0.0.1:17170, signed in as the read-only thx-readonly account; the password is read from /etc/thx/secrets/lldap/secret_bind_password at each login.
  • DNS: each domain's own nameservers, 1.1.1.1 and 8.8.8.8.
  • Authelia at 127.0.0.1:9091 (flag -authelia), only to sign a new person in after the welcome link.

Measured

test.sh builds the binary, walks the wizard's way in against a scratch root, then serves 600 requests: peak RSS (VmHWM) 23 MB since the binary carries the embedded pieces/ (20 MB before). ram_mb = 30 (23 × 1.3). The thx commands it starts are not in that figure.

Known gaps

  • LLDAP keeps no last sign-in time, so People cannot show one.
  • thx apply runs under systemd-run --wait as its own unit (thx-app-<job id>), output to /var/lib/thx-app/<job id>.log while it runs, so restarting thx-app (which an apply that updates thx-app does) no longer stops an install. The job's progress view is in memory, though: after a restart the page loses track of that run; its output stays in that log file (removed only when thx-app saw the run end) and the outcome shows in the box's state.
  • Teams, extra addresses, backups and the bill page are not built yet (no data source).

Facts on this page come from these files in the selfhostwizard repository:

  • pieces/home/piece.toml
  • pieces/home/README.md
  • internal/piece/piece.go

This page is generated from the code at build time, so it changes when the code does.