infra/ is an AWS CDK app (Python). It deploys three stacks per stage:
Images are built from the repository root:
infra/docker/hub-api.Dockerfile (Lambda) and infra/docker/worker.Dockerfile (engine + Lean 4 + a prebuilt Mathlib cache).
Deploy
Context keys
Custom domain with DNS outside Route 53
CloudFront only accepts ACM certificates fromus-east-1.
- Request a certificate for
hub.<domain>inus-east-1:aws acm request-certificate --region us-east-1 --validation-method DNS …. - Add its validation CNAME at your DNS provider (DNS only, not proxied; keep it for renewals).
- When it is
ISSUED, settheformalera:certificateArnand deploy. - Point a CNAME
hubat theCdnDomainstack output.
Fargate quotas
The default worker size (3 × 4 vCPU / 16 GiB) fits a new account’s Fargate quotas of 12 Spot and 12 On-Demand vCPUs; the admission task takes 4 On-Demand vCPUs. Larger workers (for example 16 vCPU / 64 GiB × 32) need theFargate Spot vCPU resource count (L-36FBB829) and Fargate On-Demand vCPU resource count (L-3032A538) quotas raised first. A task larger than the quota is never placed.
After the first deploy
- during
cdk deploy, whenever the Hub image changed (a failed render fails the deploy); - after each publish, advisory or Lemma Hub admission (the store bucket sends its writes to EventBridge).
aws lambda invoke --function-name <SiteRendererName> /dev/stdout.
Issue API tokens by putting items into the Tokens table: {token_hash: sha256(token), tenant, plan, quota}.