Skip to content

Host apso.ai on Cloudflare Workers via Pulumi (#28) - #34

Merged
cultron merged 9 commits into
mainfrom
feat/cloudflare-pulumi
Oct 26, 2026
Merged

cultron merged 9 commits into
mainfrom
feat/cloudflare-pulumi

Conversation

@cultron

@cultron cultron commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Closes #28. Stacked on #33 (the redesign); merge #33 first, then retarget this to main.

apso.ai has run from this branch since 2026-10-25 21:36 UTC. The Worker was deployed with npm run cf:deploy from this branch, and Pulumi state (S3 + KMS, pinned in infra/Pulumi.yaml) matches infra/.

What it does

  • OpenNext (@opennextjs/cloudflare) build: wrangler.jsonc, open-next.config.ts, cf:build / cf:preview / cf:deploy scripts.
  • Pulumi program in infra/ creates:
    • the zone and every non-site record, exported read-only from Route 53 (infra/dns-records.ts)
    • the Worker and its secrets (via wrangler secret bulk, values from 1Password)
    • the bot settings (AI-crawler blocking and managed robots.txt off)
    • the site records, the apso.ai/* Worker route, and the www → apex and http → https redirects
  • The cutover was split into two reversible steps, documented in infra/README.md:
    1. Name servers moved with Cloudflare answering exactly as Route 53 did (11/11 records matched).
    2. serveApex=true flips both site records to proxied and adds the route. Nothing is deleted. Rollback is serveApex=false + pulumi up.

Verified live

  • https://apso.ai/* returns 200 from the Worker (x-opennext: 1).
  • www and http return 301 to https://apso.ai, keeping the path and query.
  • The Universal certificate is active for apso.ai and *.apso.ai.
  • MX, DMARC, Resend DKIM and docs.apso.ai are unchanged.

After merge

  • Connect Workers Builds to this repo, with main as the production branch. Until then, deploys are cf:deploy only. Do not connect it before this lands on main, or the next push to main deploys the old site.
  • Decommission Route 53 and Amplify after the rollback window (tracked separately).

Cloudflare API token permissions used: Workers Scripts Edit, Zone Read, DNS Edit, Workers Routes Edit, Bot Management Edit, Single Redirect Edit, SSL and Certificates Read.

…m for zone, DNS, Worker, Access (#28)

- @opennextjs/cloudflare 1.20.13 (newest; accepts Next 16.4.3) and wrangler 4.152, wrangler.jsonc,
  open-next.config.ts with the static-assets cache (every page is prerendered), cf:build/cf:preview/cf:deploy.
- public/_headers: immutable cache for /_next/static.
- infra/: Pulumi TypeScript program. Zone, the 9 non-site Route 53 records (generated by
  infra/scripts/export-route53.sh, read-only), the Worker, Worker secrets via wrangler secret bulk,
  apex custom domain and www redirect behind serveApex, Access on preview URLs for Google sign-ins.
- deploy/infra-secrets.env and SECRETS_ENV in scripts/with-secrets.sh, so missing Cloudflare items
  do not break `with-secrets.sh npm run dev`.
- Root tsconfig and ESLint ignore infra/ and the Cloudflare build output.
…previews (no Access), S3 state with KMS secrets

- Pulumi.yaml pins the S3 backend; prod stack created with the awskms secrets provider; accountId and
  workersDevSubdomain set as plain config.
- Remove the Access identity provider, policy and app, and the Google and passphrase 1Password refs.
- deploy/infra-secrets.env now holds only CLOUDFLARE_API_TOKEN.
…a Worker route

Moving the name servers with serveApex=false left apso.ai without a record. The site records now
mirror Route 53, and the cutover flips them to proxied and adds an apso.ai/* route, all in-place
updates, so the name server move and the switch to the Worker are separate, reversible steps.
@cultron
cultron force-pushed the feat/cloudflare-pulumi branch from e9ea981 to afa7ed9 Compare October 26, 2026 18:39
@cultron
cultron changed the base branch from feat/site-redesign to main October 26, 2026 18:39
@cultron
cultron merged commit 1133710 into main Oct 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Host apso.ai on Cloudflare Workers, defined in Pulumi (PR previews, DNS move from Route 53)

1 participant