Skip to content

feat(cd): one hostname for production and every other target, routed by an edge Worker and Flagship #195

Open

Description

@aRustyDev

What

Serve production and any number of other targets (vX.Y.Z release candidates, the alias staging, dev-* pull-request
builds) from one hostname, thrust.sow.foo. A small edge Worker, thrust-edge, decides per request which target answers:
production unless the request carries a valid opt-in and Cloudflare Flagship allows that target for that kind of principal.
thrust-staging.sow.foo goes away.

How (decided 2026-11-15, plan in .agents/plans/ once PR A lands)

  • Production stays the ordinary thrust Worker, reached from the edge by a service binding. It has no route of its own,
    and workers_dev and preview_urls are off.
  • Every other target is a Worker Preview of thrust (wrangler preview --name <target>), reached from the edge over its
    Preview URL with an Access service token. Access on the Previews admits only that token, so the edge cannot be bypassed.
    Version overrides are not used: a deployment holds at most two versions.
  • Opt-in is explicit: /_edge/opt-in?target=… is the only path behind Cloudflare Access (who may opt in is the Access
    policy, in the infrastructure repository), and the edge sets a signed pin cookie.
  • Flagship holds a global kill switch (routing), aliases (alias-staging, alias-prod) and one target-<name> flag
    per live target, whose rules come from .github/deploy/flagship/policy.json. The app is made by OpenTofu; every flag is
    made, changed and deleted by CI. No email address is ever written into this repository.
  • Data profiles per target: shared (production's data; release targets) or isolated (its own schema, role,
    Hyperdrive config and bucket on thrust-pg-dev; dev-* targets).
  • Migrations on shared data: a ledger (each file applied once); only the newest shared target migrates, behind a
    reviewer; NNNN_contract_*.sql files run only in the production deploy, and only when no older shared target is live.

Stages

  • Spike on the live account (Preview reachability from the edge, Access on Previews, RoomDo by script_name from a
    Preview, workers-rs and Flagship, wrangler preview in CI, WebSockets, thrust behind another Host)
  • PR A: the ADR and dated updates to ADR-0110, 0092, 0090, 0008, 0042, 0061
  • PR B: the migration ledger and the contract rule
  • PR C: crates/thrust-edge
  • PR D: Flagship as code
  • PR E: release targets on Previews; production deploy behind the edge
  • PR F: dev-* targets (chore(infra): per-PR schema sweep owner and CI wiring for preview environments #57)
  • Infrastructure issues (production prerequisites, edge domain, Access apps, Flagship app, retire staging)
  • Cut-over and drills

Refs: #57, #49

Activity

  1. added 20 commits that reference this issue on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions