Skip to content

Latest commit

 

History

History
223 lines (180 loc) · 11.9 KB

operations.md

File metadata and controls

223 lines (180 loc) · 11.9 KB

Production availability checks

The Check production availability GitHub workflow checks the public site at minutes 7, 22, 37 and 52 of every hour. It uses Node 24 without installing dependencies, deploying anything, or accessing Cloudflare credentials.

The checks cover the Astro home and download pages, a classic URL redirect with its query string, the users archive, robots rules, the documentation sitemap, latest and versioned reference URLs, and PDF headers plus a 16-byte range. When the selected production DOC_REVISIONS entry is present, they also check the modeling manual and its search JavaScript. Version and revision come from workers/docs/wrangler.jsonc; update that configuration when promoting documentation. Each run makes ten requests, or twelve with the modeling manual, and caps each response read at 1 MB. It never downloads the complete PDF.

Transient failures get two retries, twenty seconds apart. Persistent failures fail the workflow and leave the failing path in its log. Check the failed path, the latest website and Worker deployments, and Cloudflare Workers logs. A version or revision mismatch can mean the checked-in promotion has not reached production yet. Use the deployment runbook for rollback; this workflow never changes traffic automatically.

Run manually

From the website checkout:

node scripts/check-availability.mjs
gh workflow run availability.yml --repo Gecode/gecode.github.io --ref main
gh run list --repo Gecode/gecode.github.io --workflow availability.yml --limit 5

Use scripts/docs/smoke-worker.mjs for the broader documentation checks after a deployment. The scheduled checks deliberately use a smaller request set.

Make failures reach a maintainer

The responsible maintainer must enable GitHub Actions email or web notifications and select failed workflows only. Scheduled-run notifications go to the user who created or last changed the schedule, or who re-enabled it. Repository workflow success alone does not establish that anyone receives failure alerts. Confirm that maintainer's settings before relying on this workflow. See GitHub workflow notifications.

On 5 September 2026, the authenticated zayenz account's settings were checked: Actions email notifications were enabled for failed workflows only. Keep that account as the schedule owner, or verify the replacement owner's settings.

GitHub schedules can be delayed or dropped under load. Public-repository schedules are automatically disabled after sixty days without repository activity. Check that this workflow remains enabled during routine maintenance; re-enable it when necessary. This is a periodic availability check, with no guaranteed detection time, and cannot detect every regional or intermittent failure. See GitHub schedule limitations.

Cloudflare's budget notification remains separate from availability monitoring. A passive origin alert can complement these checks, but it does not cover every failure generated by the documentation Worker or R2. A Workers Observability notification also needs an actual alert rule; the notification destination alone does not monitor errors.

Website hosting and TLS

Since November 2026 the website no longer uses GitHub Pages. Cloudflare serves everything under gecode.dev, and no origin certificate is involved:

  • www.gecode.dev is a Workers Custom Domain on gecode-website, a Worker with static assets only (no script) built from _site. Its configuration is workers/website/wrangler.jsonc.
  • More specific Worker routes on www take precedence over the Custom Domain: gecode-documentation owns /doc* and /robots.txt*, and gecode-classic-url-redirects owns the classic .html URLs and /e/*. When they pass a request on with fetch(), it reaches the website Worker.
  • _site/_redirects (generated by scripts/create-classic-redirects.mjs) sends /page and /page.html to /page/ with a 308. _headers marks the fingerprinted /_astro/* files as immutable.
  • The apex gecode.dev has a proxied placeholder record (AAAA 100::) and a Single Redirect rule. The rule sends HTTP and HTTPS requests to https://www.gecode.dev/<path> with a 301 and keeps the query string.
  • Cloudflare Universal SSL issues and renews the edge certificates. The zone should use Full (strict); it has no external origin.

Static asset requests are free and unlimited on Workers Free, so the website does not count against the daily Worker request limit unless a route Worker runs first. A version may hold at most 20,000 files; the build has about 12,200, mostly the users archive.

Deployment

A push to main runs .github/workflows/pages.yml ("Build and deploy website"). It builds and checks the site, uploads the _site artifact, then runs wrangler deploy --env production in the website-production environment and finishes with scripts/check-availability.mjs. The environment accepts only main and holds two secrets:

  • CLOUDFLARE_ACCOUNT_ID;
  • CLOUDFLARE_API_TOKEN: the account token gecode-website-deploy, created on 16 November 2026 without expiry. It has Workers Scripts Write and Account Settings Read on the Gecode account, and Zone Read and Workers Routes Write on gecode.dev. It cannot change DNS, SSL or rules.

The Custom Domain owns the www DNS record, so it does not appear as an ordinary record in the DNS list. Cloudflare refuses to attach a Custom Domain while another record exists for the hostname, and Wrangler does not replace it in CI. If the domain is ever detached and must be reattached, delete any www record and add the domain under Workers & Pages, gecode-website, Domains in the same minute: resolvers may cache the missing name for 30 minutes.

The same build can be deployed by hand from the Workers workflow (worker=website) to www-staging.gecode.dev or, with the cloudflare-production approval, to production.

Rollback

Every deploy creates a new Worker version. Roll back without rebuilding:

npx wrangler deployments list --name gecode-website
npx wrangler rollback --name gecode-website <version-id>

Alternatively, rerun an earlier successful "Build and deploy website" run, or in the dashboard choose Workers & Pages, gecode-website, Deployments. Wrangler needs a token for the Gecode account; local OAuth login may only cover a personal account.

Monitoring

The availability check fetches /news/ with a unique query string, so each run reaches the deployed assets. It checks the apex redirect, and fails when either edge certificate has fewer than 14 days left. Universal SSL normally renews 30 days before expiry, so a failure means renewal is stuck.

Incident, November 2026

GitHub Pages issued the original origin certificate in August 2026, before Cloudflare proxied the domain. Pages cannot renew a certificate for a proxied domain, because its eligibility check requires the records to resolve to GitHub. The renewal stalled at bad_authz, and the certificate expired on 7 November. Cloudflare in Full (strict) mode then returned HTTP 526 for every uncached page. Toggling the records to DNS only and re-adding the custom domain did not clear the order. On 12 November the SSL mode was lowered to Full as a stopgap. On 16 November the website moved to Workers Static Assets, the apex moved to a Cloudflare redirect rule, and the GitHub Pages A records were deleted.

CDN cache policy

The Cloudflare zone's Browser Cache TTL is set to Respect Existing Headers. Two active Cache Rules refine that default:

  • Cache immutable Astro assets matches www.gecode.dev/_astro/*, makes the response cache-eligible, and sets both edge and browser TTLs to one year.
  • Cache website HTML and redirects matches the apex host and non-documentation website HTML paths on www. It makes those responses cache-eligible, respects origin cache headers, and uses Cloudflare's status-code TTL when the origin sends no cache header.

Both rules were written for the GitHub Pages origin. Responses from the website Worker's static assets do not go through the zone cache, so the Cache Rules no longer affect them. Static assets have their own edge caching, and _headers sets the browser policy. The two rules can be removed once nothing depends on them.

Keep /doc* out of the website rule. The documentation Worker owns its cache policy. The prepared Workers Cache change gives selected routes and aliases thirty days of edge freshness plus seven days of stale-while-revalidate, while browsers retain one-day freshness. Sitemaps and robots.txt retain five-minute browser freshness. Explicit revisions retain a one-year policy. See the Worker runbook for the policy and staging checks. On 30 September 2026, the change was deployed to staging from PR #13. The updated staging deployment and smoke checks passed. A fresh URL returned MISS, HIT, HIT with Cache-Control: public, max-age=86400. An earlier probe confirmed one Worker execution for three requests. The smoke check accepts native Workers Cache's 206 response to HEAD with Range and checks plain HEAD separately. Production deployment remains subject to the protected environment's approval. Short-TTL SWR and live revision rollback have not yet been exercised against the native cache.

Ordinary zone caching runs after Worker routing. Workers Cache sits before execution, but its hits still count as Worker requests. Neither response headers nor a zone Cache Rule removes that request charge. Measure execution avoidance separately from billable requests and zone cache hits.

Option: a CDN ahead of the Worker

An external CDN can avoid Cloudflare requests on cache hits. A concrete option is Fastly Full Site Delivery at www.gecode.dev, with documentation misses sent to a dedicated Cloudflare Worker origin hostname and website misses sent to the website Worker. This is a researched option, not a provisioned or tested service.

Use Fastly's Surrogate-Control header for the long edge TTL and SWR policy; Cloudflare's edge-only header does not configure Fastly. Enable origin shielding to share cache fills across locations. Tag mutable documentation responses and soft-purge those tags after release promotion or rollback. Deploying the Worker alone cannot invalidate the external cache.

Before switching public DNS, verify backend Host/TLS settings, public canonical URLs and redirects, analytics injection and /e/ forwarding, query handling, PDF ranges, SWR, and release invalidation on a preview hostname. Keep private R2 access through the Worker. Do not point the CDN backend at its own public hostname or expose the existing bucket's staging and manifest keys. Select the provider and billing arrangement before provisioning this separate rollout.

Email forwarding

The email Worker waits for every configured forward to finish and reports any forwarding failure. Native Worker logging is enabled; the handler does not log message bodies. Deploy it separately from the website and documentation:

gh workflow run workers.yml --repo Gecode/gecode.github.io --ref main \
  -f operation=deploy -f environment=production -f worker=email

The routing tests cover address selection and partial forwarding failure. They do not establish inbox delivery. Use Cloudflare Email Routing delivery analytics for that check; its zone-level Analytics Read permission is separate from the website deployment token. A failed availability run does not diagnose mail delivery, because the public HTTP checks exercise only the website.