A server made by Terraform
A server that carries production, from nothing: Terraform makes the machine, its firewall, its names and its backups, and a second machine for the hosted apps.
The cluster is the shape for more calls than a machine holds. The other shape is a server: the
runtime whole in Docker on one machine (pinecall-runtime setup --domain,
The runtime CLI, "A server that carries production"), and a
second, smaller machine that runs the hosted apps and nothing else, so an org's code never runs
where the database and the vault's key are. It is the same package and the same image; nothing in
the runtime knows which shape it runs in. What a server gives up is what a cluster is for: its seats
are fixed (a caller past the last one hears the overflow's sentence, no node is added), one machine
is one place to fail (its two gateways are started again one after the other, so an update leaves
the name answering, a worker drains for ten minutes and the simulated callers for twelve; a machine
that stops takes everything with it until it is back). The callers of spoken simulations are a
service of their own beside the gateways (callers: PINECALL_CALLER_PROCESSES processes, half the
machine's cores unless said, two callers each), so a test run of many calls at once costs the
gateways nothing and a gateway started again ends none of them; on a cluster the same service is the
Deployment pinecall-callers (callers.replicas, callers.processes in the chart's values). The apps are fenced as a cluster fences them: each is a gVisor container of
the apps' machine, with no root and no capability, on a network that reaches the internet and
nothing else (not that machine, not the server's private address, not the cloud's metadata, not
another app), and the machine's own identity reads no secret. What a cluster gives that a server
does not is a ceiling on each app's disk.
| cluster | server | |
|---|---|---|
| Terraform's root | terraform/<provider>/cluster |
terraform/<provider>/server (ROOT = server in the operator's <cluster>.mk) |
| what it makes | the cluster, its pools, the load balancer's names, the secret store | a network, the two machines and their identities, the firewall (5060 from sip_sources alone), one address every name points at, the backups' bucket |
| the runtime put on it | make deploy, make hosting |
make server, make runners: infra/server/install and infra/server/runners run on the machine at a commit's image |
| the front door | the Gateway and its certificates | Caddy on the machine, a certificate a name from Let's Encrypt; services of your own are files of sites/ |
| Postgres's backups | CloudNativePG's Barman Cloud plugin | the same tool beside Postgres (PINECALL_BACKUP_URL), as the machine's own identity |
| a shell | kubectl |
Systems Manager (AWS) or Identity-Aware Proxy (Google): no port 22 to the world, no key |
$ make tf-init tf-plan tf-apply CLUSTER=<name> # ROOT = server: the machines, unpointed
$ make image TAG=<commit>
$ make server CLUSTER=<name> TAG=<commit> SETUP="--domain voice.example.com --phone --unpointed --yes --email you@example.com"
$ make runners CLUSTER=<name> TAG=<commit> GATEWAY=https://voice.example.com APPS=<the tag of images/app>
$ make server CLUSTER=<name> TAG=<another commit> # an update: the commit and nothing else
The server holds to what the chart holds a pod to. Every process is a user of its own that is not
root (the runtime's 10001, Postgres's and Redis's images' own), with no capability (Caddy keeps one,
to take ports 80 and 443), no privilege to gain and a root filesystem it cannot write. Each is handed
what its verb reads, by name in server.yaml: the gateways the env file whole but the database as
pinecall_app, which reads and writes every table's rows and changes none; the simulated callers the
same role, Redis, the vault's key and what signs a caller into its room; a worker and an overflow
their LiveKit, their fleet's key and the recordings store, never the database, Redis, the vault, the
operator's or the signing key (tests/cli/setup/test_server_compose.py holds the file to it, and
the chart's pinecall.workerEnv too); the retention the database as its owner and the vault. Redis
asks a password, the owner's password is no longer the image's, and LiveKit's and SIP's configs are
said from the env file's values, so the env file is the one file that holds a secret. make server
then runs infra/server/fence as root: the metadata address, and with it the machine's identity
(the secret store, the backups' bucket), answers root, the operator and Postgres's network, and
refuses the user 10001 and every other network of Docker.
Terraform's env output is what the server's env file is told of what was made
(PINECALL_BACKUP_URL, PINECALL_SIP_RTP_PORTS, PINECALL_PAGES_DOMAIN); each environment's seats
are the operator's own lines (PINECALL_PRODUCTION_MAX_JOBS, PINECALL_SANDBOX_MAX_JOBS). A runner's
key is a file of the apps' machine, /etc/pinecall/runner-<env>.key, put there before make runners.
Proven. On 2026-11-23, on both clouds, by this road and nothing typed on a machine: a server
of two machines made by Terraform (Google, 16 resources; AWS, 96, most of them the carriers'
networks), set up unpointed at a commit's image and its names pointed after, Caddy's certificate
issued by itself; WAL and a base backup in the bucket as the machine's own identity; a runner on the
second machine; a project deployed from a laptop and run there, a written call and a spoken call to
its agent (1.4 s and 1.7 s from the caller's last word to the agent's first sound), and its page
with a certificate asked for at its first visit (5 to 8 s, then 0.3 s; a name that is no page gets
none). An update that names the commit alone, then both gateways started again twice while the
name was asked every second: 64 of 64 answered, each time. On a machine by hand, the same week: a
restore of the bucket to a moment (what was written after it gone, archiving again on the new
timeline) and local restore of a dump. The rehearsal of a move: a cluster's database of 255 214
log entries restored on the AWS server in 55 s with its runtime stopped, every row there and its
schema at this release. Not proven on a server: a carrier's call, the overflow answering a caller
past the last seat, and any number of calls at once; what a machine holds is docs/scaling.md's
arithmetic, measured on a cluster's node.
Services of your own beside a server. What "Services of your own" is on a cluster: each runs
from a compose file of its own on the server, listens on loopback alone, and is reached at a name
by a file of the runtime's sites/. One that calls the gateways calls Caddy's port of loopback,
http://127.0.0.1:8079, which answers by whatever name the caller says (one named 127.0.0.1
answered a caller that asks as the public name nothing). The MCP server's file is here,
server/mcp.yaml. A service that signs to another cloud as itself does so as the machine: on AWS
the instance's role, read from its metadata by a container on the host's network, as a user that is
not the runtime's 10001 (the fence refuses that one, and a container on a network of its own). Proven on the AWS
server on 2026-11-23: the MCP server, and Pinecall's own two (its notifier, signing Android's
pushes as the instance's role with no key, and its billing), each answering at its name with a
certificate of its own.
From a cluster to a server, or back. A runtime moves as a dump of its database and the settings
that seal and sign what the dump holds. The server is made and set up with its names still pointing
at the cluster (--unpointed); PINECALL_VAULT_KEY, PINECALL_TOKEN_KEY, PINECALL_OPS_KEY and each
environment's fleet key are written into its env file from the cluster's secret store, by the
server itself (reads_secrets lets it read them, and nothing else there); the cluster's gateways
and workers are stopped, pg_dump -Fc taken and pinecall-runtime local restore given it; then
point_names and point_sip move the names, each taken over in one change, and the cluster's
Terraform is told to forget the records. An address carriers already know moves with it
(kept_address). The way back is the same dump in the other direction.
A server's secrets. A server is one disk, and the keys its database is sealed and signed with
must outlive it: keeps_secrets names them in the cloud's secret store, where Terraform makes each
name and the operator puts each value, piped, so no state holds one. Nothing reads them while the
server runs (its env file holds what it runs on); a server made again begins its env file from
them. The server alone may read them. The apps' machine runs other people's code, and whatever its
identity may read that code may read, so it reads no secret unless apps_reads_secrets names it.
After a move from a cluster the secrets change owner before the cluster is destroyed, each
imported into the server's state and then forgotten by the cluster's:
$ terraform import 'aws_secretsmanager_secret.kept["pinecall-<name>-vault-key"]' <its ARN> # in the server's root
$ terraform state rm 'module.secrets.aws_secretsmanager_secret.this["vault-key"]' # in the cluster's