Install on Kubernetes
Follow these steps to run Typefold on a Kubernetes cluster with Helm. Every Typefold pod is stateless, so replicas can run on any node: the data lives in PostgreSQL, Redis and object storage that you provide. For a single server, Docker Compose is simpler.
Before you start
Section titled “Before you start”- Kubernetes 1.27 or newer, with
amd64nodes. The images are built forlinux/amd64only. - Helm 3.8 or newer and
kubectl. - An ingress controller (or a load balancer) that terminates HTTPS for your address and passes WebSocket connections on.
- PostgreSQL 16 or newer, with an empty database and a user that owns it.
- Redis 7 or newer, with
maxmemory-policy noeviction. It holds the renders waiting to run, so give it persistence (AOF) if a restart should not delay them. - Object storage: an S3 bucket (Amazon S3 or a compatible service) or an Azure Blob Storage container. Every API and worker pod reads the same files.
- A license key. See get a key.
- Resources. By default the chart runs two of each component and requests about 3 CPUs and 4 GiB of memory in all. Each extra worker requests 1 CPU and 1 GiB.
1. Sign in to the registry
Section titled “1. Sign in to the registry”The chart and the images are in Typefold’s registry, which you sign in to with your license key. Paste the key when asked for the password:
helm registry login registry.typefold.dev -u license2. Prepare the services
Section titled “2. Prepare the services”Create the database, the Redis instance and the bucket. In the bucket’s CORS rules, allow GET
and PUT requests from your address (GET only for Azure); see
bucket CORS and Studio.
3. Create the secret
Section titled “3. Create the secret”Generate the two secrets and the sandbox token:
openssl rand -hex 32 # for better-auth-secretopenssl rand -base64 32 # for data-encryption-keyopenssl rand -hex 32 # for sandbox-tokenThen create one Secret with your connection details, in the namespace you install into:
kubectl create namespace typefoldkubectl --namespace typefold create secret generic typefold \ --from-literal=database-url='postgresql://typefold:<password>@<host>:5432/typefold' \ --from-literal=redis-url='redis://:<password>@<host>:6379' \ --from-literal=better-auth-secret='<first value>' \ --from-literal=data-encryption-key='<second value>' \ --from-literal=sandbox-token='<third value>' \ --from-literal=license-key='<your license key>' \ --from-literal=object-storage-access-key-id='<access key id>' \ --from-literal=object-storage-secret-access-key='<secret access key>'The pods also pull the images with your license key:
kubectl --namespace typefold create secret docker-registry typefold-registry \ --docker-server=registry.typefold.dev --docker-username=license \ --docker-password='<your license key>'| Key | Required | Holds |
|---|---|---|
database-url |
Yes | The PostgreSQL connection URL. Add ?sslmode=require if your server needs TLS. |
redis-url |
Yes | The Redis URL; rediss:// for TLS. |
better-auth-secret |
Yes | Signs sign-in sessions and file links. At least 32 characters. |
data-encryption-key |
Yes | Encrypts secrets stored in the database. Exactly 32 random bytes in base64. |
sandbox-token |
Yes | Lets the API and the workers run template scripts in the sandbox. |
license-key |
Yes | Your license key. |
object-storage-access-key-id |
With S3 | The access key, which can read, write, list and delete objects in the bucket. |
object-storage-secret-access-key |
With S3 | Its secret. |
azure-storage-connection-string |
With Azure | The storage account’s connection string, including the account key. |
data-encryption-key-previous |
No | The previous key while you rotate it. |
resend-api-key |
No | Email sign-in through Resend. |
entra-client-secret |
No | Sign in with Microsoft. |
anthropic-api-key |
No | Lets Studio create templates from PDFs; see AI features. |
deploy-api-key |
No | The deploy key of set up from configuration. |
4. Write your values
Section titled “4. Write your values”Create values.yaml with your address, the secrets’ names and your storage:
publicUrl: https://pdf.example.comexistingSecret: typefoldimagePullSecrets: [typefold-registry]
storage: driver: s3 s3: endpoint: https://s3.eu-central-1.amazonaws.com region: eu-central-1 bucket: my-typefold-bucket forcePathStyle: false # true for most S3-compatible services
ingress: enabled: true className: nginx tlsSecretName: typefold-tls annotations: nginx.ingress.kubernetes.io/proxy-read-timeout: "3600" nginx.ingress.kubernetes.io/proxy-send-timeout: "3600" nginx.ingress.kubernetes.io/proxy-body-size: 64mFor Azure, set driver: azure and azure.container instead of the s3 block. To see every
value with its default:
helm show values oci://registry.typefold.dev/typefold-helm5. Install
Section titled “5. Install”helm install typefold oci://registry.typefold.dev/typefold-helm \ --namespace typefold --values values.yaml --wait --timeout 10mkubectl --namespace typefold get podscurl https://pdf.example.com/healthHelm first runs the database migrations as a Job, then starts the rest. curl prints
{ "status": "ok" } once the API is ready.
Without --version, Helm installs the newest release. To pin one, add its version without the
v, such as --version 1.4.0.
6. Become the first platform administrator
Section titled “6. Become the first platform administrator”-
Create a password account for yourself. The command prints a generated password.
Terminal window kubectl --namespace typefold exec deploy/typefold-api -c api -- \ -
Read the setup token. Every API pod prints the same one:
Terminal window kubectl --namespace typefold logs deploy/typefold-api -c api | grep setupToken -
Open your address, sign in, and finish setup as in install.
What gets installed
Section titled “What gets installed”| Deployment | What it does | Replicas |
|---|---|---|
proxy |
Caddy, behind your ingress. Routes Studio and the API on one address and adds the security headers. | 2 |
api |
The API, sign-in and file downloads. It also sends webhooks. | 2 |
worker |
Renders documents, one at a time per worker. | 2 |
sandbox |
Runs template scripts and helpers. It holds no secrets, and a network policy denies it any egress. | 2 |
studio |
The web app. | 2 |
The migrations Job runs before every install and upgrade. The pods need no volumes and no service account token, run as a non-root user on a read-only file system, and spread across nodes where they can.
The network policies need a network plugin that enforces them, such as Calico or Cilium. Without one, the sandbox still holds no secrets and takes runs only from callers that send the sandbox token.
Each worker renders one document at a time, so the number of workers is the number of documents
rendered in parallel. Set the counts in values.yaml and run helm upgrade (see
upgrade):
worker: replicas: 6api: replicas: 3Or let Kubernetes scale them on CPU, which needs the metrics server:
worker: autoscaling: enabled: true minReplicas: 2 maxReplicas: 10Every API pod can serve every request. People editing the same template in Studio’s visual editor share one live session, and the proxy sends all of them to the same API pod.
Workspaces share the workers fairly; see how workspaces share workers. All the pods of one release use one database, so they count as one installation.
Settings
Section titled “Settings”The configuration reference describes every setting. In the chart, they go in these places:
| Setting | In values.yaml |
|---|---|
PUBLIC_URL |
publicUrl |
STORAGE_DRIVER, OBJECT_STORAGE_*, STUDIO_FILE_ORIGINS |
storage |
AUTH_EMAIL_FROM, ENTRA_TENANT_ID, ENTRA_CLIENT_ID |
signIn |
RENDER_RETENTION_DAYS, RENDER_TIMEOUT_MS, SCRIPT_ENV, and the others |
settings |
WORKER_CLOSE_GRACE_MS, WORKER_STOP_GRACE_PERIOD |
worker.closeGraceMs, worker.terminationGracePeriodSeconds |
TRUSTED_PROXY_RANGES |
proxy.trustedProxyRanges |
| Memory limits | each component’s resources |
| Advanced settings | api.extraEnv, worker.extraEnv |
settings: RENDER_RETENTION_DAYS: "90"worker: extraEnv: - name: RENDER_MAX_PAGES value: "100"A variable in extraEnv replaces the chart’s own setting of the same name.
The settings that pick the certificate and the host ports do not apply: your ingress handles both.
Pods read the Secret as they start. After you change it, restart them:
kubectl --namespace typefold rollout restart deployment.
Client addresses
Section titled “Client addresses”The API limits requests, including sign-in attempts, per client address. The proxy takes the
client’s address from X-Forwarded-For only for requests from proxy.trustedProxyRanges,
which by default are the private address ranges where in-cluster ingress controllers run. Make
sure your ingress controller sets X-Forwarded-For to the real client, and if a CDN or a load
balancer sits in front of it, configure the controller to trust only that one.
Upgrade
Section titled “Upgrade”-
Back up the database and the bucket.
-
Upgrade to the newest release, keeping your values:
Terminal window helm upgrade typefold oci://registry.typefold.dev/typefold-helm \--namespace typefold --values values.yaml --wait --timeout 15m -
Check the release notes for one-off steps. Where they show a
docker compose runcommand, run it in an API pod instead:kubectl --namespace typefold exec deploy/typefold-api -c api -- node dist/merge-reports.js.
The upgrade runs the migrations first. The API may write renders in a format only its own release’s worker understands, so the old workers stop before the new ones start, and new API pods start only once a new worker is ready. Renders wait in the queue meanwhile and none is lost. The API, Studio and the proxy are replaced one pod at a time, with no downtime.
To go back, run helm rollback typefold only to a release whose migrations the database
already has; restore the database from before the upgrade otherwise.
Long renders
Section titled “Long renders”On an upgrade, a worker finishes its current render first, for up to worker.closeGraceMs
(75 seconds), and Kubernetes stops it after worker.terminationGracePeriodSeconds (90). If you
raise RENDER_TIMEOUT_MS, raise both, each at least 15 seconds above the one before:
settings: RENDER_TIMEOUT_MS: "120000"worker: closeGraceMs: 135000 terminationGracePeriodSeconds: 150Monitoring
Section titled “Monitoring”The API serves Prometheus metrics on port metrics and every worker on port http, both at
/metrics. With the Prometheus Operator, set metrics.serviceMonitor.enabled: true to scrape
them. See monitoring for the metrics and the alert rules.
Where your data lives
Section titled “Where your data lives”Back up the PostgreSQL database and the bucket, and keep your Secret (or its values) apart from the backups. Nothing in the cluster itself needs a backup. Restore the database and the files from the same moment, as in where your data lives.
If it does not start
Section titled “If it does not start”helm installstops with... is required. A required value is missing; the message names it.- The migrations Job fails. Read its log:
kubectl --namespace typefold logs -l app.kubernetes.io/component=migrations. Usually the database address or password is wrong, or the user cannot create tables. - Pods stay in
ImagePullBackOff. The pull secret is missing or holds another license key. Check it withhelm registry login registry.typefold.dev -u license. - API pods stay in
Init. They wait for a worker of the same release. Read the worker’s log:kubectl --namespace typefold logs deploy/typefold-worker. /healthanswers503. Itsunavailablelist names what the API cannot reach,databaseorredis.- The visual editor keeps reconnecting. The ingress closes idle WebSocket connections: raise its timeouts to at least a minute, as in step 4.