infra_wiki

kthx

The lab's hosting product on the offsite cluster, which the owner and agents use to serve a directory at <name>.kthx.dev or to build a repository and deploy it to a cluster or a cloud.

live

kthx is the lab's hosting product. The owner and agents use it to put apps on the internet or on the lab network. Its quick-site server and built-app engine run on the offsite Kubernetes cluster, and each built app runs on its Target. It has two kinds of app.

KindYou give itYou get
Quick siteA directory, or a page the builder writeshttps://<name>.kthx.dev, with a database, a websocket, a visitor ID and a file store
Built appA GitHub repository or an uploaded archiveA signed build, deployed to a cluster, Cloud Run, Firebase Hosting, Vercel or Cloudflare Pages

Ownership and security says which system owns each part and what it can reach.

Use it#

SurfaceAddressWho can reach it
Quick siteshttps://<name>.kthx.devAnyone
Landing page, site directory, SDK, agent reference and CLIhttps://kthx.devAnyone
Consolehttps://kthx.lolwtf.caThe lab, the offsite LAN and the tailnet owner. The console needs a passkey.
Quick-site builderhttps://kthx.<tailnet>Every tailnet member
MCP endpoint for built appshttps://kthx-engine.lolwtf.dev/mcpThe internet, with an agent token

How it works#

nginx in the kthx-sites namespace serves quick sites' files from the bluenose-kthx-sites bucket, and one Bun process in the kthx namespace serves their API. The kthx engine in the spindrift namespace builds and deploys built apps. The engine is a web process for the console, API and MCP, a reconciler that builds and deploys, and their CloudNativePG database.

Quick sites and the engine share the Cloudflare tunnel named kthx-engine, called the kthx Apps tunnel, and the kthx-apps Gateway on offsite. They also share the archive reader in packages/archive/ and the bluenose GCP project, and each has its own database and bucket.

Flux deploys quick sites from packages/charts/kthx/ in git. It deploys the engine, and the engine its Apps, from the OCI charts that .github/workflows/spindrift-charts.yml publishes. Build and release has the rule for a chart change.

Operate#

AlertMeaningRunbook
KthxEngineDeployFailedA deploy ended FAILED. The console's Deploys page shows the reason.
KthxEngineDeployLostA reconciler stopped during a deploy. Read its pod's logs.

Quick sites lists its alerts. Install kthx installs the engine, and Connect an agent to kthx gives an agent the MCP endpoint. Operate Postgres covers both databases.

Reference#

  • Quick sites: apps/kthx/, packages/kthx/, packages/charts/kthx/ and clusters/offsite/apps/kthx/. Image ghcr.io/jonpulsifer/kthx.
  • Built apps: apps/kthx-engine/, packages/charts/kthx-engine/, packages/charts/kthx-app/, clusters/offsite/apps/kthx-engine/ and clusters/base/platform/kthx-engine-target/. Image ghcr.io/jonpulsifer/kthx-engine.
  • Cloud: terraform/network/cloudflare/kthx.dev.tf, terraform/network/cloudflare/kthx-engine.tf and terraform/gcp/projects/bluenose/

Edit on GitHub

↑↓ move ↵ open esc close