Self-hosting
Self-hosting
The same api.route surface the managed Lambda serves ships in
gate/selfhost.py. Run it anywhere Python 3.12 runs, pointed at a
DynamoDB-compatible endpoint — real AWS inside your VPC, or DynamoDB-Local
for development. Tables are created on boot (idempotent, missing tables
only), and metered billing is off by design: on your infrastructure the
gate never talks to a Stripe price you don’t control.
Docker (fastest)
That boots writ-gate on http://localhost:8787 plus the
amazon/dynamodb-local container. Agents, the CLI, and the portal hit it
exactly like the managed gate:
Configuration
What is the same, what is different
- Same: every
/v1endpoint, receipts + audit hash chain, principals, policies and overrides, kill switch, GitHub App flow, and the infrastructure-failure envelopes. - Different: metered billing (off), the managed portal login (portal routes serve, but Stripe wiring is absent), and the async GitHub scan worker — scans on a self-hosted gate run in-process rather than through a Lambda self-invocation.
When to self-host rather than use the managed gate
- Compliance requires receipts and code never to transit Writ’s AWS account.
- The gate must live on caller-side networking (VPC peering, private links) so the check decision never leaves your network.
- You want the metering contract replaced: your tenant rows, your quotas.