Docs pages

0013 — Public website: Astro static site on Cloudflare Pages, deployed from Actions

Status: accepted · Date: 2026-11-29 · AI-written; the maintainer has not confirmed this text. Plan: 0014 (on GitHub).

Context. ServerDock needs a public site that tells the truth about a pre-release product: a home page, the feature list, the benchmark evidence and the docs, rendered from the same Markdown that lives in this repo. The site must follow the product's own promises: small, fast, no tracking, no client JavaScript, and usable with a keyboard and a screen reader. It must not become a second thing to keep in sync by hand, and it must not hold secrets or weaken the repository's security.

Decision.

  1. Astro, static output, no client JavaScript. site/ is a separate npm project, not embedded in the binary and not benched. The docs pages are built from an explicit allowlist of repo Markdown files (site/src/docs.config.ts); anything not listed is not published. Links, anchors and images are checked at build time; a broken one fails the build.
  2. Cloudflare Pages, Direct Upload. The project serverdock has the production branch main; the custom domain is serverdock.oday-bakkour.com. A static _headers file sets a strict CSP (default-src 'none', no script) and the other security headers, and marks *.pages.dev hostnames noindex so only the custom domain is indexed. The site uses no Pages Functions and no _worker.js.
  3. Deploy from GitHub Actions, from main only. The deploy job in .github/workflows/site.yml needs both build and every e2e shard, so a failing test, an accessibility violation or a WebKit failure stops it. The build job has no secrets. The deploy job runs the build's own artifact (not a rebuild), re-checks it with gates.mjs --dist-only, and then runs wrangler pages deploy. It is not a required check, because a path-filtered required check that is skipped would block merges; a broken site only stops the deploy, and the last good version stays live.
  4. Token controls.
    • The Cloudflare API token is an account token with only the permission Account → Cloudflare Pages → Edit (the dashboard summary shows it as "Pages Write"), expires after 90 days, and is stored as a secret of the GitHub environment production, which only main may deploy to (a branch policy, no tag rules). Decision: no required reviewer on the environment (maintainer, 2026-11-29). The environment has can_admins_bypass: true.
    • It reaches exactly one step, the wrangler step, as step-level env. The job has permissions: {} and a sparse checkout of only site/deploy/ and site/scripts/gates.mjs, with persist-credentials: false.
    • Wrangler is the only dependency of the job. It is pinned to an exact version in its own lockfile (site/deploy/), installed with npm ci --ignore-scripts before the token exists, and was at least two weeks old when pinned. WRANGLER_SEND_METRICS is false. site/deploy/, gates.mjs, _headers and the docs allowlist are in CODEOWNERS; Dependabot updates the lockfile weekly.
    • Deploys share one concurrency group, site-deploy-main, with no cancelling. GitHub keeps one run going and at most one pending, and a newer pending run replaces an older pending one, so the newest commit is always the last to deploy.
    • Wrangler runs from a new empty folder, by the full path of the lockfile-pinned binary, because it reads functions/, wrangler.toml and .npmrc from its working folder. The deploy job's site/deploy folder holds only package.json and the lockfile (a unit test).
    • The job summary says "deployed" only after wrangler exits 0.
  5. Same Cloudflare account as the zone (accepted risk). The oday-bakkour.com zone is in the account that also serves the maintainer's other Pages sites, so a Pages-write token could deploy to, or change, those projects. The maintainer chose this knowingly (plan 0014, Q3) rather than a dedicated account. The controls above (a narrow token, one step, the isolated lockfile, an environment limited to main, a 90-day expiry) are what limit it. Moving the project to a dedicated account later means a new token and a DNS-only CNAME in the zone; nothing else changes.
  6. JavaScript detections stays on for the zone (Q5). Cloudflare injects a script that the site's CSP blocks. That one console message is recorded as a known, harmless exception in the launch checklist; every other CSP violation fails it. Email Obfuscation is turned off for this hostname only, by a Configuration Rule.
  7. What actually holds, and what does not. The controls that hold today: the narrow token, its use in a single step, the isolated lockfile (installed without scripts and before the token exists), the main-only branch policy of the environment, the 90-day expiry, and the gates that run on the artifact before the token step. Not counted as controls: CODEOWNERS and the main ruleset. Docker-Hunterpedia is the only collaborator and is an admin, and one account cannot approve its own pull request, so every merge to main uses the admin bypass; neither blocks anything today. Known gap: whoever controls that account (or a token with its rights) can change site.yml or site/deploy/ on main and so reach the Cloudflare token. The recommended fix is an agent-only fine-grained token without admin or Workflows permission, so that agents cannot push workflow changes or bypass the ruleset. Pending: a maintainer decision.
  8. CI scope. site/ is excluded from the bench and integration trigger (bench-needed.sh, ci-scope.sh), but a .go file anywhere still counts, and .github/workflows/site.yml is not excluded, so changing the workflow still runs the bench.

Consequences.

  • The site costs the product nothing at run time: no server, no embedded files, no change to the idle numbers. It costs CI minutes on site/ and docs/ changes.
  • Publishing is automatic on merge to main, so the build gates and the end-to-end tests are the only review of a site change after merge. The token-holding path is small enough to review in one file.
  • Every 90 days the token must be rotated by hand; an expired token makes the deploy fail visibly (the job reads "failed"), and the old site stays up. A workflow_dispatch on main redeploys after a rotation.
  • Re-running an old main run of this workflow within the 7-day artifact retention redeploys that old build and rolls the site back. Rule: redeploy only by workflow_dispatch on main, never by re-running an old run.
  • The accepted same-account risk stays until the maintainer moves the project; it is recorded here so it is a decision, not an oversight.
  • Docs pages are published twice in one case (/roadmap/ and /docs/roadmap/, the second canonical to the first). The phase chart in the roadmap is a drawn image and can go stale; the page says so.
  • If Cloudflare Pages stops fitting (limits, pricing, a policy change), the output is plain static files and moves to any static host; only the deploy job and _headers handling change.

Addendum (2026-12-02): ws override in the deploy lockfile. Advisory GHSA-37g9-w4hg-h9qr (high, a memory-exhaustion DoS in ws 8.0.0 to 8.22.2) made the npm audit (deploy lockfile) step fail. wrangler 4.162.0 brings ws 8.21.0 through miniflare, and the newest miniflare still pins 8.21.0, so upgrading wrangler does not help. site/deploy/package.json now overrides ws to 8.23.1 (main pinned 8.23.1 in #37 on the same day; 8.23.0 is the first patched release), in the same major version. This adds no package and changes only that one lockfile entry. wrangler --version still runs. The advisory is about a ws client that a server can flood with Pings; the deploy job runs only wrangler pages deploy over HTTPS and opens no WebSocket connection, client or server, so the advisory does not reach it; the override is there to keep the audit gate green without an exception. Remove the override once a wrangler release brings a patched ws by itself.