trunkjet

Run your own server

On this page

Install on Kubernetes

The Helm chart deploy/k8s/chart/trunkjet runs a whole trunkjet installation on Kubernetes: the server (tjetd, with the web app and these docs) and tjet-worker per cell, FoundationDB through Apple's fdb-kubernetes-operator, an S3 content store (Garage inside the cluster, or your own S3), ingress with certificates, monitoring, FoundationDB backups with a weekly restore drill, and optional pools of build and fixer runners. It is also what the hosted service uses. This page is the overview; the chart's README.md and the runbook kubernetes in docs/runbooks.md of the source repository have the full detail.

What you need first

  • A Kubernetes cluster you administer (k3s works; it is what the project tests on) with a default StorageClass, and kubectl and helm on your computer.
  • The cluster-wide operators, installed once: cert-manager, the fdb-kubernetes-operator and kube-prometheus-stack (plus Kata for microVM runners, if you run runners). The script deploy/k8s/cluster/install-prereqs.sh test installs pinned versions of them for a k3s test cluster. They are deliberately not subcharts, so their upgrades never ride on a trunkjet release.
  • DNS for your public host name pointing at the cluster's ingress, and an e-mail address for Let's Encrypt (or a private issuer).
  • An S3-compatible store, or let the chart run one node of Garage (a single disk's durability).
  • An SMTP relay if people sign in with an e-mailed code, and optionally an OpenID Connect identity provider.

Choose a values file

FileUse
values-selfhosted.yamlA starting point for your own cluster: one cell, Garage for content, FoundationDB with double redundancy on three storage processes
values-hetzner.yamlThe hosted layout (two cells, Hetzner Object Storage, local NVMe)

Copy values-selfhosted.yaml, then set at least:

  • web.publicOrigin to your address (for example https://scm.example.com);
  • tls.acme.email for certificates;
  • installation (a name chosen once; it names your data in FoundationDB and never changes);
  • the sizes under fdb.clusters and garage, or the s3 section for your own object store.

The chart never accepts a credential in a values file; it only names Kubernetes Secrets, and it refuses to render while a required one is missing.

Create the secrets

Create these in the namespace first, with values you generate (never commit them):

SecretHolds
trunkjet-cursor-keycursor.key: 32 random bytes, the same for every server of the installation
trunkjet-s3the S3 access key and secret
trunkjet-pii-keypii.key: 32 random bytes; keep an offline copy, losing it makes stored e-mail addresses unreadable
trunkjet-routing-keyrouting.key, from tjet-admin cell keygen, once per installation
trunkjet-fdb-blob-credentialsthe credentials FoundationDB's backup agents use for their S3 bucket

The trunkjet-ca-bundle ConfigMap holds the public root certificates: the server image has no CA store, so outbound HTTPS (S3, sign-in providers, mail) reads this bundle. The file deploy/k8s/owner-checklist.md lists every input, who generates what and why.

Install

helm upgrade --install trunkjet deploy/k8s/chart/trunkjet -n trunkjet --create-namespace \
  -f my-values.yaml
kubectl -n trunkjet get foundationdbcluster         # wait until AVAILABLE is true
kubectl -n trunkjet rollout status deploy/trunkjet-tjetd-c1

Create the first tenant, then sign in:

kubectl -n trunkjet exec deploy/trunkjet-tjetd-c1 -c tjetd -- \
  tjet-admin --issuer <issuer> bootstrap-tenant acme --principal <subject>:tenant_admin
tjet login scm.example.com

After the first tenant exists, set fdb.backup.operator.issuer and .subject to that administrator and run helm upgrade: a job then starts the continuous FoundationDB backup.

How it is wired

  • TLS everywhere off loopback. Traefik terminates the public certificate (cert-manager and Let's Encrypt) and connects to tjetd over TLS verified against the chart's internal CA. Probes use /healthz and /readyz on port 9640.
  • Stateless servers. tjetd and tjet-worker are Deployments with autoscalers; the data lives only in FoundationDB and the content store. Rolling updates keep every replica ready.
  • FoundationDB runs under the operator, which replaces lost nodes. The capacity limit of a cell is FoundationDB: add storage and log processes in fdb.clusters.<name>.processCounts.
  • Monitoring. The chart installs the alert rules and the Grafana dashboard of deploy/production/observability.
  • Runners. Optional pools run build and fixer jobs in microVMs (Kata, or gVisor without KVM), and tjet-exec workers for remote execution.

The canonical host and any alias hosts route to the same tjetd with the Host header unchanged. Alias hosts redirect web pages to the canonical origin. Do not add a middleware that changes cookies or the host.

Upgrade, scale and back up

  • Upgrade: read the release notes first. If they say the data format allows mixed versions, helm upgrade --reuse-values --set image.digest=<new> rolls one pod at a time. For a stop-all release set tjetd.strategy.type=Recreate for that upgrade.
  • Backups: backup agents and a weekly restore drill (<release>-dr-drill) come with the chart. A restore always goes into a new FoundationDB cluster, never the live one.
  • Certificates: public certificates renew by themselves; after cert-manager renews the internal one, restart the tjetd deployment within 30 days.

Hosted infrastructure

The hosted service runs the same chart on k3s on Hetzner, created with OpenTofu from deploy/hetzner. Nothing there is needed for your own cluster.

Not supported yet

Images are unsigned and not published to a registry (build them from source and set image.repository); FoundationDB TLS inside the cluster is untested; the identity directory still shares one FoundationDB cluster across cells. See Self-hosting overview for the one-host alternative.