Self Host Wizard Docs

thx command reference

Every thx command, its arguments and what it does, read from the usage text in cmd/thx/main.go.

thx is the one program that installs and runs a box. These are its 38 commands, exactly as its own usage text lists them. Commands that change the box edit /etc/thx/state.json; thx apply then makes the box match it.

A command run with the wrong arguments exits 2 and prints this list; any other failure exits 1, unless its line says otherwise.

Box settings

thx set public_ip

thx set public_ip <ipv4>

What it does: the box's public (reserved) IP

thx set site_domain

thx set site_domain <domain>|''

What it does: which domain serves the showcase site; apps live under it as <host>.<domain>

thx set showcase on|off

thx set showcase on|off

What it does: on: the site domain shows the showcase site even with the home app on (off: it sends people to the home app)

Domains

thx domain add

thx domain add <domain> [--org ORG]

What it does: serve a domain (apex + www); adds ORG if new

thx domain rm

thx domain rm <domain>

thx domain ls

thx domain ls

thx domain upstream

thx domain upstream <d> <port> [--cloudflare]

What it does: serve the apex from a web app on 127.0.0.1:<port> (0: stop); --cloudflare: proxied by Cloudflare (internal CA, its IPs only)

Companies and teams

thx org add

thx org add <org> [--title T]

What it does: add a company (LDAP groups org-<org>, org-<org>-admins)

thx org title

thx org title <org> <title>

What it does: change a company's display name

thx team add

thx team add <org> <team>

What it does: add a team (LDAP group team-<org>-<team>)

thx org app

thx org app <org> <piece> on|off

What it does: turn an installed app on or off for one company's people

Static websites

thx site add

thx site add <host> [--org ORG]

What it does: serve a static website (apex or one-label subdomain of a company domain) from /srv/thx/sites/<id>/current

thx site rm

thx site rm <host>

What it does: stop serving it (its files are kept until site purge)

thx site ls

thx site ls [--json] [--removed]

thx site deploy

thx site deploy <host> [--by LABEL] [--id ID]

What it does: put up a new version; a .tar.gz on stdin refuse unless the host is still site ID

thx site rollback

thx site rollback <host> [RELEASE]

What it does: serve an earlier version again

thx site purge

thx site purge <id>

What it does: delete a removed site's files

Apps (pieces)

thx pieces

thx pieces [--json]

What it does: list every piece and whether it is enabled

thx enable

thx enable <piece>...

What it does: enable pieces and everything they need

thx disable

thx disable <piece>...

What it does: disable pieces (data and secrets are kept)

thx secret set

thx secret set <piece> <key>

What it does: store an input the piece needs; value on stdin

People

thx user add

thx user add <uid> --email ADDR --name "NAME" [--org ORG]... [--team ORG/TEAM]... [--org-admin ORG]... [--admin] [--password-stdin | --no-password]

What it does: create an LLDAP user; without a password flag prints a generated initial password once; a bare --team TEAM works with exactly one --org; the first admin also receives noreply@<site_domain>

thx user passwd

thx user passwd <uid>

What it does: set the password; one line on stdin

thx user join|leave

thx user join|leave <uid> <group>

What it does: admins, org-ORG, org-ORG-admins or team-ORG-TEAM

thx user suspend

thx user suspend <uid>

What it does: no sign-in anywhere; the password is replaced

thx user resume

thx user resume <uid>

What it does: lift it (then set a password: user passwd)

thx user rm

thx user rm <uid>

What it does: delete the user (never the last admin)

thx user alias add|rm

thx user alias add|rm <uid> <addr>

What it does: an extra address (on any served domain) for a user

Mail

thx mail send

thx mail send --to ADDR --subject S

What it does: send a plain-text mail from noreply@<site_domain>; body on stdin

Running the box

thx apply

thx apply [--events json] [--only PART]

What it does: bring this box to the state in /etc/thx/state.json; --events json adds progress lines (docs/pieces.md); --only runs one part (a piece, or system) after system

thx post-up

thx post-up <piece>

What it does: rerun a piece's post_up (run daily by thx-post-up@<piece>.timer)

thx verify

thx verify

What it does: probe the box; exits 1 if any probe fails

thx stats

thx stats

What it does: write the site's stats.json (run by thx-stats.service)

DNS

thx dns

thx dns <domain>

What it does: the DNS records the domain's owner publishes for mail (region from state, else instance metadata)

Outgoing mail through the relay

thx relay status

thx relay status <domain> [--json]

What it does: where outgoing mail through the relay stands (the provider's side is by hand: thx holds no API key)

thx relay dkim

thx relay dkim <domain> <selector> <target> [--verified]

What it does: record the DKIM CNAME your cloud console shows

thx relay check

thx relay check

What it does: sign in to the relay's SMTP with the stalwart relay_* inputs; exit 1 refused, 3 could not ask

thx relay test

thx relay test --to ADDR

What it does: send one test through the relay as noreply@; exit 1/3

Notes from the usage text

  • every command but verify and stats takes --root DIR (tests use a scratch dir).

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

  • cmd/thx/main.go

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