Bootstrap Oneliner
(Through the API: Gitea sends anonymous /raw/ requests to its sign-in page.)
Modifies SSH config to allow root login with a key
tmp=$(mktemp) && curl -fsSL "https://gitea.thewrightserver.net/api/v1/repos/josh/TWS-Semaphore/raw/bootstrap.sh?ref=main" -o "$tmp" && chmod +x "$tmp" && bash "$tmp"; rm -f "$tmp"
Example Command From Semaphore Instance
ssh-copy-id -i /root/.ssh/id_ed25519.pub root@
create-instance.yml
Creates a new container on a dev host (orion by default), ready for Dev HA Init. Every new container starts in the dev stack.
Run it from the Create Instance template (Dev Stack Hosts inventory) with the limit set to one node and these extra vars:
| Var | Default | Notes |
|---|---|---|
vmid |
(required) | n8n takes it from /cluster/nextid |
instance_name |
(required) | lowercase DNS name; becomes the hostname and the name in Catalyst, Tailscale and Patchmon |
cores |
2 |
1–8 |
memory_mb |
2048 |
256–16384 |
disk_gb |
8 |
2–200, on tws-zfs |
ticket |
optional TheWrightServer ticket number, written into the description |
It uses the newest Debian 13 template (downloading it to local if the node has none), creates an unprivileged container with nesting and keyctl, no swap and DHCP on vmbr0, adds the two raw lxc lines Tailscale needs for /dev/net/tun, starts it and waits for an IPv4 address. The last line of the output is GODDARD_RESULT {...} with the vmid, name, node, IP and template.
Re-running with the same vmid and name changes nothing. A vmid or name already used by another guest stops the run before anything is created.
onboard-instance.yml
Onboards a container after create-instance.yml and Dev HA Init: joins the tailnet as tag:tws-instance, lets Semaphore log in as root by key, and installs the Patchmon agent. It runs on the container's Proxmox node through pct exec, so it works before the container is on the tailnet.
Run it from the Onboard Instance template (Dev Stack Hosts inventory) with the limit set to the container's node. n8n (Instance Lifecycle - Prepare Posture) sends the extra vars:
| Var | Notes |
|---|---|
vmid, instance_name |
the container must be running, have that hostname and have /dev/net/tun |
ts_authkey |
single-use, pre-authorized key tagged tag:tws-instance, minted for the run |
patchmon_url, patchmon_api_id, patchmon_api_key |
from Patchmon's auto-enrollment |
patchmon_skip |
true when Patchmon already has the host reporting |
Semaphore's own public key (~/.ssh/id_*.pub on the Semaphore controller) is read at run time, so no key is stored here. Each step checks first, so re-running is safe. The last line of the output is GODDARD_RESULT {...} with the tailnet address and what changed.
The extra vars, including the Tailscale key and the Patchmon host credentials, show in Semaphore's task history. The Tailscale key is single-use and expires within the hour.
instance-hardware.yml
Gives one container a bigger root disk, the node's GPU, or both: what pct resize and pct set --devN do as root on its node. Proxmox lets only root pass a device through, which is why this is a playbook and not an API call.
Run it from the Instance Hardware template with the limit set to the node that holds the container and these extra vars:
| Var | Default | Notes |
|---|---|---|
vmid |
(required) | the container; the run stops before changing anything if it isn't on this node |
disk_gb |
grow the root disk to this many GB (2–500). Never shrinks: a smaller figure is refused | |
gpu |
true passes the node's render device in, false takes it out; left out, the device isn't touched |
|
gpu_device |
/dev/dri/renderD128 |
The device goes in with Proxmox's own devN: option, which makes it root's inside the container, so an unprivileged container can use it. A device change takes effect at the container's next start, so a running container is restarted when, and only when, the device was added or removed.
A container with a devN: line starts only on a node that has that device. Every node of its HA rule must have one, and the device has to come out (gpu=false) before the guest is demoted to the dev stack.
Re-running with the same vars changes nothing. The last line of the output is GODDARD_RESULT {...} with the disk size and the device before and after, and whether the container was restarted.
ping.yml
Checks that Semaphore can reach instances without changing anything: it logs in and runs id, then an Ansible ping (which needs Python on the instance). Run it from the Ping Instance template with the limit set to one or more instance names; without a limit it pings the whole Instances inventory. Each host prints GODDARD_RESULT {"host", "user", "python"}.
App roles (converted from community-scripts)
Each app is a role, roles/app_<app>/, converted from its community-scripts ct/<app>.sh and install/<app>-install.sh. A role installs on a fresh container and updates an existing one, so running it again is the update. roles/app_<app>/upstream.yml records the upstream commit, a sha256 of each source file and the container size from the ct script; the weekly upstream check re-hashes those files and, when one changes, a ticket is cut and a PR updates the role.
Versions are pinned
Every role names the exact release it runs (<app>_version in its defaults/main.yml), and so does exportarr.yml. An update is a pull request that raises the pin; running Deploy App for any other reason leaves the version alone (TheWrightServer #1915).
cs_coregh_releaserefuseslatest(unlessgh_allow_latest) and refuses a pin older than what is installed (unlessgh_allow_downgrade), so a stale pin fails instead of downgrading. Ghost and Grafana check the same way; Grafana installs the exact apt version.- Tags are written as upstream names them (
v3.16.0for Prometheus,4.5.9for Chevereto). The installed version is kept without thevin/root/.<app>. uvis a build tool: an installed uv is left at its version unlessuv_versionis passed, and a host without it getsuv_default_version.
Deploys don't upgrade packages
The cs_core helpers install what is missing and leave what is installed at its version: PHP, Node.js, MySQL and PostgreSQL use state: present; npm is brought up to date only right after Node.js is installed; Composer self-updates only with composer_self_update=true; PriceBuddy's Chrome is present. Patch releases of these arrive with the weekly patch run, which is announced and watched, and not as a side effect of a deploy (TheWrightServer #1915). A different Node.js major is still replaced, and MySQL and PostgreSQL majors are still done by hand.
The shared login
Roles that create an admin account use tws_admin_user and tws_admin_email from group_vars/all.yml, and the password tws_admin_password: the contents of a root-only file on the Semaphore host, /etc/tws/credentials/admin-password, which josh writes himself. The password is never in this repository, n8n, an extra var or a task log; every task that handles it is no_log. Without the file, roles generate a random password per app as before and keep it in /root/<app>.admin.
- New installs use the shared password;
/root/<app>.adminthen says where the password lives instead of holding it. - Existing accounts move with
tws_admin_password_sync=trueon a normal deploy of the app. Each app checks first and changes nothing when the shared password already works, sets it with the app's own method, proves it, and only then replaces the old password in/root/<app>.admin. The same run rolls out a new shared password later. Methods: Laravel'sHash(Paymenter, Pterodactyl Panel, PriceBuddy), bcryptjs from Ghost's own install and from Bigcapital's server container,@node-rs/argon2from AirTrail's, Chevereto'spassword-reset -x, Grafana'sreset-admin-password. - Helpers:
roles/tws_shared_login(require,tools,laravel,record). PriceBuddy'sAPP_USER_PASSWORDin.envis only read when the database is first created, so a sync leaves it alone.
Shared helpers live in roles/cs_core, mirroring the parts of community-scripts/core the apps use:
gh_release.yml:fetch_and_deploy_gh_release(prebuild and tarball modes) pluscheck_for_gh_release. It keeps the installed version in/root/.<app>like upstream, finds the latest tag from GitHub's/releases/latestredirect instead of the rate-limited API, and builds the asset URL from a name template.gh_resolve_onlyonly works out whether a release is new, so a role can stop services or back up files before the deploy.apt_repo.yml:setup_deb822_repo(key in/etc/apt/keyrings/<name>.gpg, source insources.list.d/<name>.sources).php.yml:setup_php(Sury repository, version pin, upstream's module set, php.ini limits, optional FPM).composer.yml:setup_composer.nodejs.yml:setup_nodejs(NodeSource, npm updated).uv.yml:setup_uv(plusuv python install).mariadb.ymlandmariadb_db.yml:setup_mariadbandsetup_mariadb_db. The server comes from Debian's packages (MariaDB 11.8 LTS on Debian 13) rather than mariadb.org's repository; the database password is kept in/root/<app>.credslike upstream and reused on later runs.
tailscale-ssh.yml
Turns on Tailscale SSH on existing instances and generates the en_US.UTF-8 locale macOS clients ask for (new instances get both from onboard-instance.yml). Run it from the Tailscale SSH template on the Instances inventory with the limit set to a batch (at most 15). It refuses a device that isn't tag:tws-instance, because Semaphore's tailnet rule only covers tagged devices; after the switch it logs in again through Tailscale SSH, so a finished host proves Semaphore still gets in. -e ts_ssh=false turns it off again.
ssh-key-only.yml
Makes OpenSSH key-only on existing instances: PasswordAuthentication no, PermitRootLogin prohibit-password (Semaphore's key still works over the LAN). Writes /etc/ssh/sshd_config.d/00-tws-key-only.conf (from files/, read first so it wins) and the same lines in sshd_config for configs without the drop-in directory, checks with sshd -t, reads back sshd -T, and reloads ssh. Run it from the SSH Key Only template on the Instances inventory with a batch limit (at most 15). New instances get the drop-in from onboard-instance.yml. bootstrap.sh turns password and root password logins back on; it predates automated onboarding and shouldn't be run any more.
deploy-app.yml
Run from the Deploy App template with the limit set to one instance and the extra var app (e.g. victorialogs). Prints GODDARD_RESULT {...}.
Quiet during the deploy (TheWrightServer V641724890): before the role runs, the play silences that instance's availability alerts in Alertmanager (tasks/maintenance-silence.yml: NodeExporterDown, TargetDown, ServiceDown, ArrAppDown, N8nRestarting for instance=<instance>, GuestDown for its name, SiteDown for its public URLs in tws_public_sites_by_guest). A successful run ends them 35 minutes later (ms_tail_minutes), so rules that look back over a window settle first; a failed run ends them at once, so a broken deploy alerts as usual. If the run dies before either, they lapse after 2 hours (ms_cap_minutes). Alertmanager being unreachable never stops a deploy. prometheus is never silenced; -e tws_maintenance_silence=false skips it for one run. snapshot-instance.yml does the same for a stopped snapshot or a rollback of a running container. Tests: python3 -m unittest discover -s tests (test_maintenance_silence.py checks the site map and alert names against app_prometheus).
| App | Role | Notes |
|---|---|---|
| VictoriaLogs | app_victorialogs |
release tarballs to /opt/victorialogs and /opt/vlutils, data in /opt/victorialogs_data, HTTP on 9428, syslog on 514, retention victorialogs_retention (30d) |
| PriceBuddy | app_pricebuddy |
Laravel app in /opt/pricebuddy behind nginx + PHP 8.4 FPM on port 80, MariaDB, queue worker, scheduler in cron, SeleniumBase scraper (Google Chrome, Python 3.12) on 127.0.0.1:3000. Admin admin@example.com; the password is APP_USER_PASSWORD in /opt/pricebuddy/.env. amd64 only. |
| TicketingSystem | app_ticketing |
josh's own app (not a community-script), built from the commit in ticketing_version: Node 22 (NodeSource), PostgreSQL from Debian over the local socket (peer auth, no password), nginx on 80 in front of the server on 127.0.0.1:3000. Releases in /opt/ticketing/releases/<commit>, current links the live one; each update builds, migrates, switches and restarts. First deploy creates the accounts in ticketing_accounts with random passwords (and the Agent's API key) in /etc/ticketing/credentials/<user>.credentials, mode 0600, never printed. Nightly pg_dump to /var/lib/ticketing/backups (14 days), then a restore check: the dump is restored into a scratch database, migrated with the current release and its row counts compared with the live database at the moment of the dump; the result is recorded for /healthz/backup. Prometheus metrics on port 9464 (/metrics, not proxied by nginx). ticketing-import.timer mirrors Gitea issues every 5 minutes (shadow mode) once /etc/ticketing/gitea.env holds GITEA_TOKEN=<read token> |
| OpenCanary | app_opencanary |
Honeypot (josh/TheWrightServer #1450): OpenCanary from PyPI in /opt/opencanary, run by systemd as user opencanary with only CAP_NET_BIND_SERVICE; fake SSH (22), HTTP (80, Synology NAS login), FTP, Telnet, MySQL, Redis, RDP, VNC, MSSQL, Git and TFTP; every event to /var/log/opencanary/opencanary.log and, when opencanary_webhook_url is given as an extra var (never committed), to the n8n Canary Catcher. The real sshd moves to port opencanary_real_ssh_port (2222); Tailscale SSH still answers 22 on the tailnet. Not a community-script; opencanary_version pins the PyPI release |
| Podcast host | app_podcast |
Static host for a private podcast feed (josh's daily briefing, generated by n8n): nginx from Debian. Port 80 (behind Andromeda) serves only feed.xml, a cover image and episodes/*.mp3 from under one unguessable path, with byte ranges, no listings and X-Robots-Tag: noindex; /healthz for Deploy App. Port podcast_upload_port (8081) takes PUT and DELETE for the same files from the addresses in podcast_upload_allow only (n8n's tailnet address; no password), rooted inside the token directory so the uploader never needs the token. The token is generated on first run in /root/podcast.token (0600) and never printed; the feed is written with the placeholder __PODCAST_BASE__, which nginx replaces with the public address as it serves the file. Each run ends with an upload, read-back and delete of a test file. Not a community-script |
| Phoenix curator | app_phoenix_curator |
The part of Phoenix (josh/Phoenix) that runs at CMH: every night it asks the real Plex what people are watching, plans what the off-site media bucket should hold, and makes the bucket match, reading Atlas over SMB with rclone's own client (no mount, so an ordinary unprivileged container) and writing encrypted to Backblaze B2. The curator's code is the commit in phoenix_curator_version, fetched by the Semaphore host (josh/Phoenix is private: a read-only Gitea token in /etc/tws/credentials/phoenix-gitea-token, if present) and copied over as /opt/phoenix/releases/<commit>, current linking the live one; rclone is pinned by version and SHA-256. Secrets come from one root-only file josh writes on the Semaphore host, /etc/tws/credentials/phoenix-curator.env (PLEX_TOKEN, B2_BUCKET, B2_KEY_ID, B2_KEY, CRYPT_PASSWORD, optional CRYPT_SALT, ATLAS_USER, ATLAS_PASS); it is copied to the container as a file and a script there builds /etc/phoenix-curator/env and rclone.conf, so no secret is ever an Ansible variable or in a log. phoenix-curator-health.service answers /healthz and /healthz/sync on 8080. files/phoenix-curator-secrets.sh, run as root on the Semaphore host, writes both files: it asks for each value at a hidden prompt, checks it against Gitea, Plex and Backblaze, and can make the encryption password. The nightly timer is off by default (phoenix_curator_timer_enabled): the first sync uploads up to the whole budget, so josh reads a plan first. Each deploy ends with one plan, which reads Plex, Atlas and the bucket and changes nothing; only its totals are reported. Not a community-script. Update: raise phoenix_curator_version in a PR, then Deploy App |
| Bloom relay | app_bloom_relay |
Read-only relay to the Bloom game-server panel API (TheWrightServer V765445618): Bloom's Cloudflare layer denies the API to some cloud agents (Codex), so they call https://bloom-relay.tws.lol/api/client/... instead and the lab makes the request again with its own TLS connection, from its own address. nginx from Debian on port 80 (behind Andromeda). Passes only GET (and HEAD) on /api/client and /api/client/*, only to bloom_relay_upstream (mc.bloom.host, TLS verified), only with the header X-TWS-Relay-Key set to the relay key; everything else 403. The key is checked and removed, client-address headers are dropped, and the agent's own Authorization: Bearer Bloom key passes through untouched (the relay holds no Bloom key). One shared rate limit (bloom_relay_rate, 5 r/s, burst 20; 429 beyond) so a runaway agent can't get the lab's address blocked. The key is generated on first run in /root/bloom-relay.key (0600) and never printed. The access log (journal, tag bloom_relay) has the request line and status only. A localhost-only server on bloom_relay_check_port (8081) answers /healthz/upstream with 200 when Bloom gives the lab its own 401; each run ends with that check, the same through the relay, and the lab's public address (for the Bloom key's Allowed IPs). Not a community-script |
| Garage | app_garage |
S3-compatible object store (josh/TheWrightServer #1814): the pinned release with a pinned SHA-256, run by systemd as user garage; one node, SQLite metadata with fsync on, metadata and data on the mount point garage_mount (the role stops if it isn't one). The S3 API listens on 127.0.0.1:3900 behind nginx on 443 as https://s3.thewrightserver.net (path-style, region us-east-1; nginx only terminates TLS, at layer 4, because an HTTP proxy rewrote some small chunked uploads and broke their signatures), with a certificate from a private CA kept on the container and renewed by garage-cert.timer; RPC on localhost; admin and metrics on 3903, firewalled to garage_admin_allow_hosts. It also assigns the layout and creates the buckets in garage_buckets, one key each (read and write on its own bucket only), their quotas and the lifecycle rule. Secrets are generated on the container (/etc/garage/, and Garage's own metadata for the S3 keys) and are never logged; read a key there with garage key info --show-secret <name>. Updating Garage means changing garage_version and garage_sha256 in a pull request, then Deploy App. |
| Bigcapital | app_bigcapital |
Self-hosted accounting (josh/TheWrightServer #1912). Not a community-script: upstream ships a Docker Compose stack only, so the role runs it with Docker inside the container (cs_core docker). A checkout of the release in /opt/bigcapital (bigcapital_version, which also pins the server and web app images); .env with secrets generated once (0600); docker-compose.override.yml holds what TWS changes: only port 80 published (Envoy), no auto-updater, no ClickHouse, restart: unless-stopped, migrations run from the server image, and the role's own garage.tws.toml (IPv4 where the kernel has no IPv6). The stack's Garage is set up for attachments. The first account is the shared login, created through the sign-up API, and sign-up is closed to every other address. Update: raise bigcapital_version and run the role again |
| Gitea | app_gitea |
From community-scripts ct/gitea.sh and install/gitea-install.sh. Installs on a fresh container and adopts an existing one made the same way (binary in /usr/local/bin/gitea, /etc/gitea/app.ini, data in /var/lib/gitea, gitea.service), recognising it by the binary's version. Pinned (gitea_version); the download is checked against Gitea's .sha256; a downgrade is refused; before an upgrade the old binary is kept (gitea.<old>) and a SQLite database copied (gitea.db.pre-<old>). app.ini is never rewritten: files/set_ini.py sets only the keys in gitea_settings (OpenID sign-in and sign-up off). Rollback class external dependencies: snapshot the container (template 43) and freeze pushes before raising the pin (TheWrightServer V785203937) |
| Argus | app_argus |
Release watcher (TheWrightServer V500100535), from community-scripts' layout: the binary /opt/argus/Argus, config.yml and data/argus.db beside it, the version in /root/.argus, systemd unit argus. The pinned release with a pinned SHA-256 (argus_version, argus_sha256; Argus publishes no checksums). Port 80 (upstream 8080). An existing config.yml is never touched (Argus rewrites it itself); a fresh install gets upstream's. Before a version change the role stops Argus and keeps config.yml, data/ and the old binary in a root-only archive in /var/backups/argus (the newest 3; they hold service API keys). It stops without changing anything if /opt/argus isn't laid out as expected or the installed version can't be told, refuses a downgrade, and checks the running version afterwards (with the n8n token once logins are on). Update: raise argus_version and argus_sha256 in a PR, then Deploy App. config.yml is made root-only. Logins (argus_auth, on for CT argus in host_vars/argus.yml): sets settings.auth.enabled once; creates the first admin tws_admin_user with Argus's -auth.create-admin and moves it onto the shared login when the Semaphore host has it (else the generated password stays in /root/argus.admin); creates argus_n8n_user (n8n) in the built-in viewer group (reads services and config, secrets shown as <secret>, no user admin) and its API token (no expiry, one at a time; a broken one is revoked and replaced), kept in /root/argus.n8n-token and copied as api_key=… to /etc/tws/credentials/argus-n8n.token on the Semaphore host, where n8n-credential.yml -e source=argus imports it; and gives Argus's own service a deployed-version check against its /api/v1/version with that token. No password or token is printed |
| authentik | app_authentik |
Identity provider for single sign-on (TicketingSystem V976114726). Not a community-script build: upstream's Docker Compose stack (josh, 2026-11-14: Compose rather than ct/authentik.sh's build from source), run with Docker inside the container (cs_core docker). /opt/authentik holds the role's docker-compose.yml (upstream's lifecycle/container/compose.yml with the images pinned by authentik_version and authentik_postgres_image, only port 80 published, no Docker socket in the worker), .env with the secrets generated once (0600) plus the settings the role keeps current (listen addresses, IPv4 where the kernel has no IPv6; trusted proxies including the tailnet's 100.64.0.0/10 for Andromeda; update check, error reporting and startup analytics off), and tws/tws_account.py, run with ak shell in the worker to manage accounts with the password passed only through the environment. Health /-/health/ready/. Two admins in authentik Admins: akadmin, the break-glass login, with a generated password only in /root/authentik.admin and never the shared login; and the shared login (tws_admin_user), which tws_admin_password_sync moves onto the shared password. A downgrade is refused. Before a version change the database is dumped to /var/backups/authentik (root-only, newest 3). Update: raise authentik_version in a PR, snapshot (template 43), then Deploy App |
| Seerr | app_seerr |
Media requests (TheWrightServer V396763128), from community-scripts' layout: source and build in /opt/seerr (dist/index.js), Seerr's data in /opt/seerr/config (settings.json, SQLite db/db.sqlite3), the environment in /etc/seerr/seerr.conf, the version in /root/.seerr, systemd unit seerr, port 5055 (/api/v1/status, no key). Adopts an existing install, recognised by the version /api/v1/status reports (then /root/.seerr, then package.json). Pinned by release and commit (seerr_version, seerr_commit): the source is fetched with git at the tag and the run stops if the tag doesn't point at the commit. pnpm at the exact version in packageManager; Node.js installed only when missing, and upgraded within its major only when older than engines.node. An update builds in /opt/seerr.build with Seerr stopped (as upstream: the build needs about 3 GB), first keeping config/ and seerr.conf in a root-only archive in /var/backups/seerr (the newest 3; they hold API keys); only a finished build is swapped in, so a failed one leaves the old install in place and Seerr is started again; the replaced build stays as /opt/seerr.previous. Seerr runs its own database migrations on start. It stops without changing anything on an unmigrated Overseerr or Jellyseerr install, an unfamiliar /opt/seerr, DB_TYPE=postgres, too little disk or an unreadable version, refuses a downgrade, never touches an existing seerr.conf, and checks the running version afterwards. Rollback class stateful, local data: snapshot the container (template 43, mode=stopped) before raising the pin. Update: raise seerr_version and seerr_commit in a PR, then Deploy App |
| Tautulli | app_tautulli |
Plex monitoring (TheWrightServer V996698705), from community-scripts' layout: the release in /opt/Tautulli (Tautulli.py, version.txt, branch.txt) with a uv virtualenv (Python 3.13) in /opt/Tautulli/.venv, Tautulli's data beside the program (config.ini, tautulli.db, logs/, backups/, cache/ ...), the version in /root/.tautulli, systemd unit tautulli, port 8181 (/status, no login). Adopts both community-scripts layouts, recognised by plexpy/version.py: the current one and the older git clone run by /usr/bin/python3 (before ProxmoxVE 63e883f), which its first update moves to the current one. Pinned by release and commit (tautulli_version, tautulli_commit): git at the tag, and the run stops if the tag points anywhere else. An update prepares the new release and its virtualenv in /opt/Tautulli.build while Tautulli still runs, then stops it, keeps config.ini and tautulli.db (with its WAL files) in a root-only archive in /var/backups/tautulli (the newest 3; config.ini holds the Plex token and API key), copies every top-level entry that isn't part of the program into the new release, and swaps it in; a failure before the swap completes puts the old install back and starts it. The replaced install, data included, stays as /opt/Tautulli.previous. Tautulli upgrades its database and config.ini itself on start. It stops without changing anything on an unfamiliar /opt/Tautulli, a unit that starts Tautulli with --datadir or --config, too little disk (a copy of the install plus 1 GB), an unreadable version or a downgrade, and checks the running version through the API afterwards. Login: a fresh install gets the shared login (tws_admin_user and the Semaphore host's shared password) before its first start; without that file Tautulli makes up a temporary password and writes it to its log. An existing login is left alone unless tws_admin_password_sync=true, which checks first, stops Tautulli, sets it with Tautulli's own hashing, proves it and logs out other sessions. Rollback class stateful, local data: snapshot the container (template 43, mode=stopped) before raising the pin. Update: raise tautulli_version and tautulli_commit in a PR, then Deploy App |
| n8n | app_n8n |
Workflow automation (TheWrightServer V840315370), from community-scripts ct/n8n.sh and install/n8n-install.sh, for the existing install only (CT 142: npm -g on NodeSource Node.js 24, n8n.service, /opt/n8n.env, data in /.n8n). Pins n8n_version and its external task runner (CT 109 n8n-runner, n8nio/runners in /root/docker-compose.yml) to the same release by tag and digest, and updates both in one run, the runner by delegation (n8n_runner_host). Refuses a downgrade, Node.js below 24, less than n8n_min_free_mb (6144) free on /, or less than n8n_min_memory_mb (6144) of memory plus swap (from /proc/meminfo; give CT 142 swap: 4096 in Proxmox for the update). Order: pull the runner image and npm install -g --force --prefix /opt/n8n-stage while n8n runs (a failed install changes nothing); stop n8n, rename the old package directory to n8n.<old> and move the staged one into place, start, wait for /healthz/readiness (migrations, up to 20 min); then delete the old directory, the staging prefix and npm's cache, recreate the runner and wait for it to register. If n8n never gets ready, both directories stay and the snapshot is the way back (the database may be partly migrated). The unit, /opt/n8n.env and its drop-ins are never touched. Snapshot both containers first (template 43, mode=stopped). Run Deploy App on n8n with existing: true. |
| PatchMon | app_patchmon |
Patch monitoring (TheWrightServer V670700682), from community-scripts' 2.x layout: the server /opt/patchmon/patchmon-server, its settings in /opt/patchmon/.env, the agent binaries it hands to hosts in /opt/patchmon/agents, the compliance scanner's SCAP content in /opt/patchmon/ssg-content (or SSG_CONTENT_DIR), the version in /root/.patchmon, PostgreSQL 17 and Redis on the container, systemd unit patchmon-server, port 3000 (/api/v1/health, no login). Adopts an existing install, recognised by the version on the login page's settings (/api/v1/settings/login-settings, then /root/.patchmon). Pinned: patchmon_version with the SHA-256 of the server and all ten agents from PatchMon's SHA256SUMS, and the SCAP Security Guide by patchmon_ssg_version and its SHA-512 (upstream takes the latest of both). Before a version change it stops PatchMon and keeps .env, the old server and a pg_dump in a root-only archive in /var/backups/patchmon (the newest 3; .env holds the secrets and database password); a failed update starts the old server again. PatchMon migrates its database when the new server starts. New SCAP content is unpacked beside the old and swapped in. It stops without changing anything on a 1.x (backend/) install, a server without .env, a database that isn't local, too little disk (patchmon_min_free_mb, 1500), a JWT_EXPIRES_IN that 2.1.7+ would read as 1 hour, an unreadable version or a downgrade, never rewrites an existing .env or unit, and checks the running version afterwards. Rollback class stateful, local data: snapshot the container (template 43, mode=stopped) before raising the pin. Update: raise patchmon_version and the hashes in a PR, then Deploy App |
| RomM | app_romm |
ROM manager and in-browser player (TicketingSystem V634904782), from community-scripts ct/romm.sh and install/romm-install.sh: RomM's release in /opt/romm (FastAPI backend on 127.0.0.1:5000 under uv with Python 3.14, the Vue frontend built with Node 24), MariaDB (database and user romm, password in /root/romm.creds), Redis, and Angie (with the zip and njs modules) on port 80 (/api/heartbeat). Five units: romm-backend, romm-worker, romm-scan-worker, romm-scheduler, romm-watcher. Data under /var/lib/romm (library/roms, library/bios, assets, resources, config/config.yml); .env (0600, generated auth secret) and config.yml are written only when missing. Pinned: RomM romm_version, and EmulatorJS, Ruffle (a dated nightly) and RAHasher with a SHA-256 each. First admin from the shared login through POST /api/users (allowed without a token only while no admin exists); without the shared password a generated one is kept in /root/romm.admin. An update stops the services, keeps .env, clean-installs the release, re-runs uv sync --frozen, alembic upgrade head and the frontend build, and puts the players back. Update: raise romm_version in a PR, then Deploy App |
| SearXNG | app_searxng |
Metasearch engine (TicketingSystem V597526285), from community-scripts ct/searxng.sh and install/searxng-install.sh: the source checked out at a pinned commit in /usr/local/searxng/searxng-src (user searxng), installed editable into the venv /usr/local/searxng/searx-pyenv, Debian's valkey, and searxng.service (python -m searx.webapp) on port 8888 (/healthz). /etc/searxng/settings.yml (0640 searxng:searxng, upstream's settings with a secret_key generated once) is written only when missing, so a redeploy never rotates the key. No trixie-backports source and no uwsgi (upstream adds both; nothing uses them). SearXNG has no releases: pinned by searxng_commit, the installed commit kept in /usr/local/searxng/.commit. Update: raise searxng_commit in a PR, then Deploy App (stop, check out, re-install into the venv, start) |
tailscale-serve.yml
Publishes a local service on the tailnet with Tailscale Serve: HTTPS with a real <host>.<tailnet>.ts.net certificate, reachable only from the tailnet. First use: n8n's forms for josh's phone, at https://n8n.<tailnet>.ts.net:8443. n8n serves plain HTTP on 443, and Andromeda refuses /form from the internet.
Run it with the Instances inventory and a limit of one host:
| Var | Default | Notes |
|---|---|---|
serve_target |
(required for present) | local URL, e.g. http://127.0.0.1:443 |
serve_https_port |
8443 |
tailnet HTTPS port; not one the host already listens on |
serve_state |
present |
absent removes it |
serve_check_path |
/healthz |
fetched through the new URL to check it (expects 200) |
The tailnet must have HTTPS certificates switched on; if they're off, the run stops before changing anything. If the port already serves a different target, the run also stops. The config is kept by tailscaled, so it survives restarts. A re-run changes nothing. The last line is GODDARD_RESULT {...} with the URL, the check's status and the serve config.
garage-smoke.yml
Smoke test for Garage (roles/app_garage, josh/TheWrightServer #1814) over https://s3.thewrightserver.net, with a throwaway key and bucket: put, list, get and delete an object; a multipart upload of a file over 1 GiB, read back and compared; a presigned GET fetched from another container (ec-1) through pct exec on its node; every consumer key listing its own bucket and being refused on the others. The throwaway key, bucket and files are removed again, also when a step fails.
Run it from the Garage Smoke template (a node inventory) with the limit set to the node that holds the client container. The Garage side (files/garage-smoke.sh) runs on the instance, reached by its tailnet name. Extra vars, all optional: garage_host (garage), client_vmid (166), client_name (ec-1), big_mib (1100). No secret is printed or stored: keys are read from Garage on the instance, and the presigned URL (15 minutes, a throwaway object) passes under no_log. The last line is GODDARD_RESULT {...} with one true or false per check; the run fails if any is false.
guest-resolver.yml
Looks at, or fixes, the DNS resolver inside one container through pct exec on its node (josh/TheWrightServer #1814). The AT&T gateway's DNS drops answers that carry a private address, so a container that takes DHCP and isn't on the tailnet can't resolve an internal name such as s3.thewrightserver.net, even with nameserver set in its Proxmox config, when the DHCP client inside rewrites /etc/resolv.conf at every lease renewal.
Run it from the Guest Resolver template (a node inventory) with the limit set to the node that holds the container, and the extra vars vmid and expect_name (its hostname; the run stops if it differs). resolver_state is report by default: it prints what /etc/resolv.conf says, what writes it, what resolver Docker's containers have, and whether check_name resolves, and changes nothing. present adds a dhclient enter hook that stops the DHCP client rewriting the file and points it at resolvers (default 1.1.1.1, 1.0.0.1), keeping a copy of the old file; it only acts where dhclient writes the file and refuses anything else, changing nothing. absent removes the hook and puts the old file back. No network or service is restarted. Docker containers keep the resolver they started with until they next restart. files/guest-resolver.sh does the work inside the container; the last line is GODDARD_RESULT {...} with the lines it printed.
n8n-resolver.yml
Stops dhcpcd rewriting /etc/resolv.conf on the n8n host (josh/TheWrightServer #1247). tailscaled owns the file there (MagicDNS). dhcpcd's 20-resolv.conf hook rewrites it every few minutes and tailscaled puts its own back, except on 2026-11-15 at 00:22 UTC it didn't, and n8n couldn't resolve ticketing-prod until tailscaled was restarted.
Run it from the n8n Resolver template (the Instances inventory) with the limit n8n. apply is false by default: it reports the OS, dhcpcd's version and how it runs, both files, the first line of /etc/resolv.conf, and whether dhcpcd-run-hooks honours an enter hook, and changes nothing. apply=true adds nohook resolv.conf to /etc/dhcpcd.conf (read at dhcpcd's next start) and writes /etc/dhcpcd.enter-hook, which adds resolv.conf to skip_hooks and works from dhcpcd's next event, so no network or service is restarted. It refuses, changing nothing, when dhcpcd-run-hooks doesn't source the enter hook first or an enter hook exists that it didn't write. state=absent with apply=true removes both. The last line is GODDARD_RESULT {...}.
nic-watchdog.yml
Self-heal for a network card that stops transmitting while its link stays up (V284453273). On 2026-11-17 vulpecula's onboard Realtek (r8169) logged NETDEV WATCHDOG: transmit queue 0 timed out during the nightly backups and the host sat cut off, still running, for 13 hours until someone on site restarted it.
It installs files/tws-nic-watchdog.sh as /usr/local/sbin/tws-nic-watchdog, its settings in /etc/default/tws-nic-watchdog and a systemd timer that runs it once a minute. Each run pings the gateway and the peers; one answer means healthy. If nothing answers it opens a TCP connection to each peer and tries both once more, so a run fails only when ping and TCP both fail twice (the first check after the install got no ping answer for 14 seconds on a healthy host). After consecutive failed runs it escalates:
| Failed runs | Action |
|---|---|
| 3 | ip link down and up |
| 5 | unbind and rebind the card's PCI driver, then bring the interface up again |
| 10 | reboot, at most once every 6 hours |
It never acts while the link is down (a pulled cable or a dead switch) and never reboots in the first ten minutes after boot. Every step is logged under the tag tws-nic-watchdog, so it shows in VictoriaLogs once the host is back. Only the reboot is known to clear the hang; the two lighter steps are untried against a real one.
Run it with the limit set to the host (written for vulpecula; a host whose default route is a bridge is refused):
| Var | Default | Notes |
|---|---|---|
apply |
false |
report only: interface, driver, link, gateway, NETDEV WATCHDOG lines in the last 14 days, whether the watchdog is installed. true installs or removes it and runs one check |
state |
present |
absent stops the timer and removes every file |
dry_run |
false |
true installs it logging what it would do and doing nothing |
watchdog_peers |
the six nodes | pinged besides the gateway, so a gateway outage alone is not taken for a dead card |
watchdog_tcp_ports |
22 8006 |
ports tried on the peers when no ping is answered |
watchdog_bounce_after, watchdog_rebind_after, watchdog_reboot_after, watchdog_reboot_gap_h |
3, 5, 10, 6 |
the thresholds above |
The last line of the output is GODDARD_RESULT {...} with what was found and what changed.
update-nodes.yml
Rolling update of the Proxmox nodes and PBS, one host at a time, with health checks between hosts. Use it instead of update-hosts.yml on the cluster: that one dist-upgrades every host at once, restarting corosync and pve-cluster on all nodes in the same moment.
Run it from the Update Nodes template (49, All Stack Hosts) with a limit. Hosts go in inventory order and the run stops at the first failed check.
| Var | Default | Notes |
|---|---|---|
action |
plan |
plan reads and reports only. upgrade runs apt dist-upgrade in place with no reboot and no guest moves (security fixes take effect as services restart; the kernel waits). reboot empties the node with HA maintenance mode, reboots it and brings its guests back: one host per run |
skip_hosts |
comma-separated hosts to leave alone | |
expect_members |
votes the cluster must show before and after (e.g. 6) |
|
margin_mb |
1024 |
free memory each other node must keep, for the plan's fit check |
Every action refuses to start unless the cluster is quorate, no HA service is in error, fence, recovery or mid-move, and no backup is running on the host (no running PBS task on PBS). After an upgrade it waits for corosync, pve-cluster and the HA services and for every vote to be back. It ends with a Patchmon report so the Update Watchdog sees the new counts.
The plan (files/tws-node-update-plan.py) lists the host's started HA guests with their rule, the nodes the rule lets them go to, their replica targets and failback. full_copy marks a node a guest may go to that holds no replica of it; a move there copies the whole disk with the guest stopped. It also lists the paths each guest needs wherever it lands: passthrough devices that aren't optional, and hookscripts on local storage. It reports max_workers (how many moves HA runs at once per node), the non-HA guests, and whether the guests fit. They must fit in total on the other nodes, keeping margin_mb each, and also on any node that is a guest's only destination.
A reboot (josh, 2026-11-18):
- It refuses unless the guests fit and every allowed node has the paths its guests need.
- It syncs every replica of the node's HA guests while they still run (
pvesr run), so HA's moves only send the last minutes of changes (Plex's job isyearly). ha-manager crm-command node-maintenance enable <node>, then it waits until HA has moved every guest off and they are all started. HA picks the destination within each rule and runs up tomax_workersmoves at once per node.- It reboots, waits for quorum and HA, and starts the non-HA guests that were running (the Electric Cherry agents, the Kubernetes VMs). Drain the Electric Cherry agents in Electric Cherry first.
node-maintenance disable <node>, then it waits for the guests to come back and reports any that don't.
If anything fails between steps 3 and 5, the node is left in maintenance with its guests where HA put them, and the run says so.
The last lines are GODDARD_PLAN {...} and GODDARD_RESULT {...}.
apt download retries off (roles/tws_apt_no_retries)
CVE-2026-109518 (TicketingSystem V458319229): apt can install an unverified package as root when it retries a redirected download, given someone in the path (a mirror or proxy) who can tamper with plain HTTP package traffic. Debian 12+ and Ubuntu 22.04+ retry 3 times by default. Fixed in apt 3.0.4 (trixie), 2.6.2 (bookworm) and 2.8.4ubuntu0.1 (Ubuntu 24.04).
tasks_from: confwrites/etc/apt/apt.conf.d/99tws-no-retries(Acquire::Retries "0";), which covers every later apt run on the host, including unattended-upgrades and runs by hand.tasks_from: aptupgradesapton its own (only an upgrade, never an install) and prints the installed version.maindoes both.
Where it runs:
update-instances.ymlandupdate-hosts.yml:conffirst, then theirapt update, thenapt, then the full upgrade.update-nodes.yml:action=upgraderuns both before the dist-upgrade.planstill changes nothing.onboard-instance.ymlwrites the same file into a new container throughpct exec, before its first apt run.
With retries off, a mirror hiccup fails the run instead of being retried: re-run the batch.
site-shutdown.yml
The guest part of a planned shutdown of the whole site (TicketingSystem V552139437, the move from CMH to BTR). For one node it shuts each guest down, backs it up to PBS while it is stopped, and says whether the node is clear: nothing running on it, and every guest's backup from this run verified by PBS. It never powers a node off, never kills a guest and never arms or disarms HA; those are done by hand.
Run it from the Site Shutdown template (All Stack Hosts) with the limit set to one node.
| Var | Default | Notes |
|---|---|---|
action |
plan |
plan reads only and lists the guests of the phase in the order they would stop. run stops and backs up each, one at a time, and ends at the first that fails. check reads only and fails unless every guest on the node is stopped with its backup verified |
phase |
apps |
apps is everything except the held-back guests; tools is the held-back guests; all is both |
confirm |
run only: the node's name again |
|
only |
run only: one vmid from the phase's plan, and nothing else; for a first try on one guest |
|
hold |
grafana, prometheus, victorialogs, argus, patchmon, catalyst, gitea-runner, gitea, n8n-runner, n8n, k8s-w1, k8s-1 | held back for tools, stopped in this order |
never |
semaphore |
touched by no phase: Semaphore runs this play, so its container is stopped and backed up by hand |
storage |
pbs |
|
stop_timeout |
300 |
seconds to wait for a guest to stop; after that the step fails and the guest is left running |
What a run does for each guest, in files/tws-site-shutdown.py on the node:
- Refuses, before stopping anything, when the cluster is not quorate (no backup would be possible), the guest is locked, or a backup is already running on the node.
pct shutdownorqm shutdown, then waits forstopped. A guest HA manages only gets the request from that command; HA stops it and keeps it stopped.vzdump <vmid> --storage pbs --mode stop: the guest is already stopped, so nothing in it changes and it is not started again.- Counts the backup only when Proxmox lists one on the storage made since the step began, and the guest is still stopped. It records that backup in
/var/lib/tws-site-shutdown/<vmid>.jsonon the node.
check wants that recorded backup verified (verification.state ok); an older verified backup doesn't stand in for it. Verifying is PBS's job, so right after a run the report usually lists backups still waiting: run check again once PBS has verified them. A guest named in never keeps the node from being clear without being a problem.
Order for the whole site: orion with phase=all; phase=apps on each production node; then phase=tools on each, the node holding Gitea last, because Semaphore fetches this repository from Gitea when a task starts; then check on each. Once k8s-1 stops, TicketingSystem and the TWS MCP are gone. Each guest's result is a GODDARD_GUEST {...} line and the node's a GODDARD_RESULT {...} line.
Tests: python3 -m unittest discover -s tests (the script against a pretend Proxmox, 27 cases). Real runs so far: plan on all six nodes and a single-guest run on eridanus (2026-11-22).
gitea-agents.yml
Agent accounts on Gitea and TicketingSystem (phases 2 and 3 of the agent accounts project, josh 2026-11-23; the spec is in goddard-tws-manager, docs/agent-accounts.md). It runs on the Semaphore host against Gitea's API as the admin account tws-provisioner. Its token is in /etc/tws/credentials/gitea-admin-token, which josh wrote. No token or password is ever printed: every task that carries one is no_log.
Run it from the Gitea Agents template (any inventory: it runs on localhost).
| Var | Default | Notes |
|---|---|---|
action |
plan |
plan reads only. setup creates the agents organization and its teams. hire, offboard and proof are below |
agent |
hire and offboard: the registry name, which is also the Gitea username. josh, goddard and tws-provisioner are refused |
|
domain |
hire: platform, media, minecraft or zombies |
|
template |
hire: vp or builder (the <domain> team, write) or on-call or reviewer (the <domain>-read team, read) |
|
ticketing |
true |
hire, offboard and proof include TicketingSystem. false leaves it out |
ts_key_days |
90 |
How long a TicketingSystem key issued by hire lasts. A re-hire is the rotation |
repos |
[] |
hire: the existing repositories the bot works on, as a list of owner/name (for example ["josh/electric-cherry"]). It becomes a collaborator on each, with write for vp and builder and read for the other two. A re-hire with a different list takes it off the ones no longer named |
-
Teams and collaborators: there are two teams per VP domain,
<domain>(write) and<domain>-read(read). A team only grants access to repositories the organization owns, so the teams are for new products that start inagents.- Existing repositories stay where they are (josh, 2026-11-23). A bot reaches them as a collaborator, through
repos. - The reason is Electric Cherry: it refuses Gitea's redirect from a moved repository's old address.
- Existing repositories stay where they are (josh, 2026-11-23). A bot reaches them as a collaborator, through
-
hire:- Creates a restricted, private bot account (
<agent>@noreply.thewrightserver.net), or re-enables one it made before. - Puts it in exactly one team, and on each repository in
reposas a collaborator (and off any it was on before). - Revokes any old tokens, so a re-hire is a rotation.
- Issues a new token and writes it to
/etc/tws/credentials/agents/<agent>.gitea-token(0600), for josh to save to the agent's environment.
Gitea issues a token only to a user's own password, so the play sets a random one, uses it once, and replaces it with another random one that nobody keeps.
- Creates a restricted, private bot account (
-
offboard: deletes the bot's tokens, removes it from every team and every repository it collaborates on, prohibits its login and removes its token file. The account stays, so its commits and comments keep their author. -
proof: the phase 2 check. A throwaway botagents-proof, a builder inminecraft:- must be able to write to a repository of its own team, and to one outside every team where it is only a collaborator;
- must not see another team's repository;
- must be refused a write to
josh/TWS-Semaphore; - must have a dead token after it is offboarded, and no longer be a collaborator.
The repositories and the bot are deleted at the end, also when a check fails.
Tested against a local Gitea 28.3.0 (production runs 28.4.0), driven by the same Gitea commands as josh's one-liner for tws-provisioner:
setuptwice: the second run created nothing.hire,hireagain (the old token answered 401, the new one 200), andoffboard(the token answered 401 afterwards).- A template change moved the bot to the other team.
joshwas refused.proofpassed: 201 on its own team's repository, 404 on the other team's, 403 on TWS-Semaphore, 401 after offboarding.- At
-vvv, neither the admin token nor any password appeared in the output.
Collaborators (PR after 238), tested the same way:
- A
builderhired onto two repositories wrote to both and got 404 on TWS-Semaphore. - Re-hired as
revieweron one of them, it got 403 writing there, could still read it, and could no longer see the other. - An unknown repository was refused, with nothing changed.
offboardremoved the remaining collaboration.proofpassed: 201 on the team repository and on the collaborator one, 404 on the other two, and 401 after the offboard, with no collaboration left.
TicketingSystem (since TicketingSystem v1.11.0, #190 and #191) is reached with the PROVISION key that josh issued to its tws-provisioner Agent account, in /etc/tws/credentials/ticketing-provision-key.
- What that key can do: create Agent accounts, issue
READ,REPORT,COMMENTandWRITEkeys (always with an expiry), revoke keys, and disable or re-enable Agents. It can never touch an Admin, a User or itself, and it can't delete anything. - Before anything changes: a run checks the key belongs to
tws-provisioner, and that an existing account of the agent's name is an agent's (an Agent,<agent>@noreply.thewrightserver.net). Otherwise it stops with nothing changed on either system. hire:- Creates the Agent account, with a random password nobody keeps, or re-enables it.
- Revokes its old keys.
- Issues a key:
WRITEforvp,builderandon-call,COMMENTforreviewer, valid forts_key_days. - Writes the key to
/etc/tws/credentials/agents/<agent>.ticketing-key(0600).
offboard: revokes its keys, disables the account (kept, so its tickets and comments keep their author) and removes the key file.proof: the throwaway bot also gets aCOMMENTkey. It must read (200), be refused a ticket edit (403, from the scope check, so nothing is written), and answer 401 after the offboard. The proof account can't be deleted with this key, soagents-proofstays in TicketingSystem, disabled, and the next proof re-enables it.
TicketingSystem part tested against a local TicketingSystem v1.11.0 (eea1abc, PostgreSQL 16) set up as josh set up prod, alongside the local Gitea:
hirecreated the account with aWRITEkey.- A re-hire as
reviewerrotated it toCOMMENT(the old key 401, the new 200). - A re-hire of a disabled account re-enabled it.
offboarddisabled it and revoked its keys (401).proofpassed twice in a row.ticketing=falseleft TicketingSystem alone.- An existing TicketingSystem Admin with the agent's name was refused before anything changed, on Gitea too.
- At
-vvv, no key or token appeared.
Phase 5 (josh, 2026-11-24):
-
inventory(read-only) lists every account the provisioners can see:- every Gitea user (whether it is a bot, admin,
prohibit_login, restricted; never an email address); - the
agentsteams and each bot's collaborations; - every TicketingSystem account (role, bot, disabled) and each agent's keys (name, scope, expiry).
Goddard's weekly check compares it with the registry in goddard-tws-manager and files tickets for differences and for keys that expire soon.
- every Gitea user (whether it is a bot, admin,
-
suspend-allis josh's kill switch, andrestore-allundoes it.- Arming: they refuse unless
/etc/tws/kill-switch/armedexists and is under 15 minutes old. josh makes it from a root shell on this host:install -d -m 700 /etc/tws/kill-switch && touch /etc/tws/kill-switch/armed. Each run removes it. Extra vars can't arm it, because Semaphore records them where Goddard can read them. - What
suspend-allswitches off: login on every bot this playbook made, and every TicketingSystem Agent. Nothing is deleted or revoked. - What it never touches:
goddard(n8n files tickets with its key),tws-provisioner, josh, humans, and accounts already switched off. - Undoing it: it writes the list to
/etc/tws/kill-switch/suspended.jsonbefore changing anything.restore-allbrings back exactly that list and keeps it assuspended-<time>.json.
- Arming: they refuse unless
Phase 5 tested against the local Gitea and a local TicketingSystem v1.11.0, with stand-ins for goddard and clifford:
inventoryreported users, teams, collaborations, accounts and keys.- Unarmed and stale arming were refused, with nothing changed.
- Armed,
suspend-allswitched off two bots on Gitea and clifford plus both bots on TicketingSystem. It left goddard,tws-provisioner, josh and an already offboarded bot alone. The bot's token and key then answered 403 and 401. - A second
suspend-allwas refused. restore-allbrought back exactly that list (keys 200 again), and a secondrestore-allwas refused.- At
-vvv, no key or token appeared.