docs: serve the docs from Cloudflare instead of GitHub Pages - #799
Merged
Merged
Conversation
Deploy the Sphinx build as the static assets of the gpjax-docs Worker on gpjax.quantclimate.com, the same way as the quantclimate.com landing page. Cloudflare Web Analytics then covers the docs with no code in the repo. html_handling "none" serves each file at the URL Sphinx gives it; _redirects maps / and /dir/ to their index.html. Only the deploy job gets the Cloudflare token. GitHub Pages stays enabled for the github.io redirects and as a rollback target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015fagcMeo1LmLG2Dg3NybmQ
|
📖 Docs preview: https://pr-799--endearing-crepe-c2d5fe.netlify.app Smoke render — the expensive notebooks run with reduced budgets, so |
thomaspinder
marked this pull request as ready for review
September 30, 2026 21:43
thomaspinder
enabled auto-merge (squash)
September 30, 2026 21:43
thomaspinder
disabled auto-merge
September 30, 2026 22:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Draft until the Impulso staging deploy (QuantClimate/Impulso#373) checks out. Merging this PR moves
gpjax.quantclimate.comto Cloudflare on the first deploy.Motivation
GitHub Pages serves the docs, outside the Cloudflare zone that serves the rest of quantclimate.com. Because of that, Cloudflare Web Analytics cannot see the docs (see #796 and #798). The landing page is a Cloudflare Worker that serves static assets, and Cloudflare adds the analytics beacon to it at the edge with no code in the repo. This PR serves the docs the same way.
Solution
docs/wrangler.jsonc: a Worker namedgpjax-docsthat serves the Sphinx build as static assets on the custom domaingpjax.quantclimate.com. It has no Worker code and no workers.dev URL. On the first deploy, Wrangler replaces the DNS-only CNAME toquantclimate.github.iowith the Worker's custom domain.html_handling: "none"serves each file at exactly the URL Sphinx gives it, so/page.htmlstays/page.html. Cloudflare's default mode would redirect every.htmlURL to an extensionless one, away from the canonical links and the sitemap.docs/_redirects(copied to the site root byhtml_extra_path) serves/and/dir/from theirindex.html. This keeps the 87 sphinx-reredirects stubs working, and with them the old MkDocs URLs that the legacy host forwards.build_docs.yml: the build job uploads a plain artifact instead of a Pages artifact.deploy-docsrunswrangler deploy(Wrangler 4.145.0, Node 24) instead ofactions/deploy-pages. Onlydeploy-docsgets theCLOUDFLARE_API_TOKENorg secret and theCLOUDFLARE_ACCOUNT_IDorg variable. The notebook build never sees them.docs/CNAMEis removed, because nothing reads it now.legacy-docs-redirect/README.mdnow names Cloudflare as the host.GitHub Pages stays enabled in the repo settings. It gets no new deploys, but
quantclimate.github.io/GPJax/…links keep redirecting to the custom domain, and the last Pages deploy is available for a rollback.Verification
I ran these locally with Wrangler 4.145.0 against the current production build (the
github-pagesartifact from main):wrangler deploy --dry-run --config docs/wrangler.jsonc: the config is valid and Wrangler reads 1092 files.wrangler devwith this exact config:/,/index.html,/installation.html,/installation/(redirect stub),/_examples/classification/(MkDocs-era stub),/examples/classification.html,/api/distributions/,/search.html?q=kernel,/objects.inv,/sitemap.xml,/searchindex.js,/_static/basic.css,/_images/GP.svg,/benchmarks/and an asv JSON file whose path contains spaces./nope.htmlreturns 404.zizmor1.30.1 (the locked version, with online audits) reports no findings.actionlintpasses.Rollback
Revert this PR, delete the
gpjax.quantclimate.comcustom domain from thegpjax-docsWorker, and recreate the DNS-only CNAMEgpjax→quantclimate.github.io.🤖 Generated with Claude Code
https://claude.ai/code/session_015fagcMeo1LmLG2Dg3NybmQ