UniTutor Cloudflare 배포 (Pages + Workers + domain)

UniTutor 원격 배포는 k8s가 아니라 Cloudflare: FE=Pages(dist/), BE=Workers(wrangler).

순서

  1. (D1 있으면) d1 migrations apply → deploy. 일반 규칙: Cloudflare-D1-Migrations-Before-Worker-Deploy.md
  2. Worker backend — wrangler deploy --config ./wrangler.jsonc (monorepo find-up 회피)
  3. Pages frontend — wrangler pages deploy는 --config 커스텀 경로 거부. cwd의 wrangler.jsonc만 자동 탐색. Workers와 혼동 금지.
  4. Pages project가 없으면 deploy 전에 project create(CI).
  5. Custom domain attach (API) → (가능하면) zone CNAME → Smoke.

CI: .github/workflows/deploy.yml. Pages dry-run=tsc/build (테스트 exclude 필요).

Domain (운영 SoR, 2026-10-02)

역할호스트비고
Pages smokeunitutor.askwho.netDashboard DNS; 첫 green Deploy run 37014651191 / PR #22
Worker APIapi.tutor.askwho.nethealth 200 유지
Legacy intenttutor.askwho.netNXDOMAIN이면 smoke에 쓰지 말 것 (#21 정렬)

Attach ≠ public DNS

  • Pages Domains API attach success alone ≠ public resolve. dig empty + edge 530(1016) 가능.
  • Same-account attach가 zone DNS를 항상 만들지 않음. Ensure는 idempotent proxied CNAME host → *.pages.dev (deploy/pages_domain_dns.py)까지.
  • Compact JSON grep("name":"host")는 pretty-print miss → 재POST·400. pages_domain_attached.py로 list+already-exists=success.
  • Token에 Zone DNS Read/Edit 없으면 dns_records 403 → soft-skip Ensure, Smoke/Dashboard 신뢰. Hard-fail로 Smoke를 막지 말 것.

D1 for LTI (2026-10-04)

  • LTI Option B needs a real D1 binding. Placeholder 00000000-…0001 fails Worker deploy (CF 10181).
  • wrangler d1 create unitutor → commit uuid into backend/wrangler.jsonc (example uuid 7bc6be4d-4809-4faa-9f38-4a9d7973b6be).
  • npm run deploy = d1 migrations apply DB --remote then wrangler deploy.
  • FRONTEND_ORIGIN prod: https://unitutor.askwho.net.
  • LTI/JWKS smoke uses temporary lti_deployments row then deletes it — see UniTutor-LTI-13-B2B.md.

Single-env prod gate (k8s tenant_cd 아님)

  • UniTutor는 .factory/cd.yaml / ta.tenant_cd[] 미등록 → Cloudflare Pages+Workers 단일 환경; merge 후 deploy.yml이 곧 prod.
  • prod gate = main SHA 일치 + Deploy success + public smoke (api.tutor / unitutor.askwho.net).
  • PathChrome UI 롤아웃 예: merge 73178e8 / Actions 38196130315 — UniTutor-PathChrome-Gating-Strip.md.

게이트

  • Secrets: CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID.
  • prod: 증거 = public DNS + HTTP 200 (530/NXDOMAIN 아님).
  • 첫 원격 closeout: merge bd40a573 / Actions 37014651191.