Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 32 additions & 19 deletions BOOTSTRAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,16 @@ orun new --blueprint repo-blueprint.yaml \
--set subdomain=<workers-dev-subdomain>
```

`subdomain` is the Cloudflare **account's** workers.dev subdomain, not the
product name. Every generated URL and the api-edge CORS allowlist derive from
it, so a wrong value ships a product that deploys cleanly and is unreachable
at every address it advertises. Find it under Workers & Pages in the
dashboard.
`subdomain` is the workers.dev subdomain of the Cloudflare account you deploy
into, not the product name. Every generated URL and the api-edge CORS
allowlist derive from it, so a wrong value ships a product that deploys
cleanly and is unreachable at every address it advertises. Find it under
Workers & Pages in the dashboard.

A build started from the console, or with `orun baseline new --from bst_…`,
never asks for it: the platform reads it from the workspace's Cloudflare
connection, the same one the deploy tokens mint from. Only a hand-run build
like this one passes it.

**`--run-hooks` is the difference between placing files and bootstrapping a
product.** Without it `orun new` writes the tree and stops: no repo is
Expand All @@ -111,8 +116,10 @@ every phase after `01-scaffold` brands the tree — derives as `drifted`, and

The phases are `01-scaffold`, `02-foundation`, `03-infrastructure`,
`03-infrastructure-database`, `04-workers`, `04-workers-restore`, `05-edge`,
`06-console`, `07-domain` (only when `domain=true`), `08-docs` — ten phases
filed under eight milestones. Each is idempotent, each follows one contract —
`06-console`, `08-docs` — nine phases filed under seven milestones. The gap
at 07 is the optional `07-domain` phase, whose parked custom-domain component
lands in `06-console` since baseline-v30 (the `domain` input that switched it
on is gone). Each is idempotent, each follows one contract —
**place its modules → land them as a PR that must go green → watch the
convergence → verify the outcome** — and each carries its own narration.
Full guide: [docs/phases/README.md](docs/phases/README.md), with a page per
Expand All @@ -132,8 +139,7 @@ orun new --blueprint repo-blueprint.yaml --out ~/sourceplane/acme --run-hooks \
orun new --blueprint repo-blueprint.yaml --out ~/sourceplane/acme --run-hooks \
--phase 02-foundation --values ~/sourceplane/acme/.rebrand/values.json
# … 03-infrastructure, 03-infrastructure-database, 04-workers,
# 04-workers-restore, 05-edge, 06-console, 08-docs;
# 07-domain only with --set domain=true.
# 04-workers-restore, 05-edge, 06-console, 08-docs.
```

The flags that shape a run:
Expand Down Expand Up @@ -247,20 +253,24 @@ The console renders **`blueprint.yaml`**, the card, and never this file or
the blueprint directly. The card owns the build contract: the overview, the
three integrations and the admin key role it requires, the inputs the form
collects, a read-only preview of the five brokered secrets and of the
programme (the epic and its eight milestones), and `bootstrap.blueprint:
programme (the epic and its seven milestones), and `bootstrap.blueprint:
repo-blueprint.yaml` — the document a runner places. The registry row in
orun-cloud owns identity and the pinned tag; the card is fetched *at* that
tag, which is why it carries none.

What that means for a console build:

- `reponame` and `githuborg` come from the repository the operator picked;
`subdomain` from the workspace's Cloudflare connection
(`from: connection.cloudflare.workersSubdomain` — the connection the build
is bound to, so it names the account the deploy tokens mint from);
`apibaseurl` is derived (`https://api.{productdomain}`); only
`productname`, `productdomain` and `subdomain` are typed.
`productname` and `productdomain` are typed.
- `orunWorkspace` is not on the form — it cannot be. The build runs inside
the workspace, and `from: workspace` (orun ≥ v2.58.11) fills it from there.
- The card collects no `domain`, so a console build skips `07-domain`. Run
it later from the CLI (and read its page first).
- There is no `domain` input. The custom-domain component lands in
`06-console`, parked, on every build, and an owner wires it later in an
ordinary PR (§4).
- The runner hands its refreshed token over through `ORUN_TOKEN_FILE`
(`bootstrap.tokenChannel`), so a session that rotates mid-build does not
end it.
Expand All @@ -273,11 +283,14 @@ that mint them, and its programme and inputs to the blueprint's.

- **Deployment record**: `08-docs` is the close-out, and safe to re-run any
time as a live-state refresh.
- **Custom domain**: `07-domain` needs the product zone to exist in
Cloudflare, and in this baseline the `cloudflare-domain` component ships
parked and mid-migration to provider v5, so the phase lands it without
deploying anything. See [docs/phases/07-domain.md](docs/phases/07-domain.md)
before running it.
- **Custom domain**: the `cloudflare-domain` component is already in the
product, landed by `06-console`: parked (it subscribes to no environment)
and mid-migration to provider v5. Create the product zone in
Cloudflare, finish the v5 resource and restore the component's
commented-out `subscribe` block in an ordinary PR (see
[docs/phases/06-console.md](docs/phases/06-console.md#the-custom-domain--parked)),
and re-run `--phase 08-docs` once it converges so the docs pick up the
domain URLs.
- **Runtime secrets** (OAuth client secrets, billing keys, …): seed with
`orun secrets set <KEY> --org <org> --env <env>`; the next deploy pushes
them to the workers (`wire-now-seed-later` — nothing blocks on them).
Expand Down Expand Up @@ -342,7 +355,7 @@ purpose, written down so they read as instructions rather than breakage.
| api-edge deploy: `Service binding '<NAME>_WORKER' … not found` | A fleet worker never deployed in phase 04. Resume that convergence, then re-run `05-edge`. |
| Convergence run fails, lanes look transient | `orun.run/watch@v1` already resumes it up to 3× (`gh run rerun --failed` is a true resume: exec-id + `--retry`). |
| Convergence still red after the resume budget | Re-running the phase lands nothing new, and CI plans `--changed`, so nothing redeploys what the failed run left undeployed. Resume the run itself — `gh run rerun --failed <run-id>` — then re-run the phase so its `await` hooks verify. |
| `/health` probes fail against a green deploy | Check `subdomain` first: it must be the Cloudflare account's workers.dev subdomain, and the default is a placeholder. |
| `/health` probes fail against a green deploy | Check `subdomain` first: it must be the Cloudflare account's workers.dev subdomain, and the default is a placeholder. A console build reads it from the Cloudflare connection; a hand-run build passes it with `--set`. |
| CLI login dies with 429 `rate_limited` | Fixed ≥ v2.48.1 (redeem honours Retry-After). Upgrade the CLI. |
| `unknown flag: --phase`, `cannot unmarshal !!map into []scaffold.Hook`, or an action `has no parameter "githubOwner"` / `"sha"` | The CLI is below the v2.58.11 floor. This blueprint is not readable by an older one. |
| A fresh build stops before 01-scaffold: `✕ phase "04-workers" precondition "wiring" is not met: … project "<repo>" not found` | The CLI is below v2.58.10, which asks the preflight about the product's project before phase 01 has created it and calls the answer a failure. Upgrade; the probe is then deferred to phase 04. |
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ _Not yet recorded — run [`08-docs`](docs/phases/08-docs.md) after

This baseline births new products from one artifact — `repo-blueprint.yaml`,
run by `orun new` (**[BOOTSTRAP.md](BOOTSTRAP.md)** →
[docs/phases/](docs/phases/README.md)). It declares ten idempotent phases —
[docs/phases/](docs/phases/README.md)). It declares nine idempotent phases —
scaffold, foundation, infrastructure, database, workers, workers-restore,
edge, console, optional domain, docs — each landing a verified slice, each
selectable with `--phase <name>`.
edge, console (with the custom-domain component, parked), docs — each landing
a verified slice, each selectable with `--phase <name>`.
Products receive **product-only content** (source, infra, CI, their own
docs); none of this baseline's machinery ships, and a product's docs speak
only about the product.
Expand Down
10 changes: 3 additions & 7 deletions ai/context/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ orun integrations list --org <ws> --json && orun cloud check --org <ws>
| add a runtime secret | `orun secrets set <KEY> --org <ws> --env <env>` |
| resolve workspace identity | `orun workspace <ws-id-or-slug>` |
| check integrations | `orun integrations list --org <ws> --json` |
| custom domain | run the `07-domain` phase once the zone exists, then `08-docs` |
| custom domain | `infra/terraform/cloudflare-domain` ships parked (`subscribe.environments: []`). Once the zone exists in the Cloudflare account, finish the provider-v5 resource and restore the `subscribe` block its `component.yaml` carries commented out, merge, then run the `08-docs` phase |
| headless/CI credentials | `ORUN_TOKEN` (workspace-scoped) + `GITHUB_TOKEN` |

The ops phases (docs refresh, custom domain, and the original deployment
sequence) all live in ONE versioned artifact: `repo-blueprint.yaml` in the
The ops phases (docs refresh and the original deployment sequence) all
live in ONE versioned artifact: `repo-blueprint.yaml` in the
baseline this product was born from. Clone it at a tag and select the phase
— from anywhere, with the two tokens above exported:

Expand All @@ -126,10 +126,6 @@ git clone --depth 1 https://github.com/OPSFLOWS baseline && cd baseline

orun new --blueprint repo-blueprint.yaml --out <product-checkout> \
--run-hooks --phase 08-docs --values <values.yaml> # docs refresh

orun new --blueprint repo-blueprint.yaml --out <product-checkout> \
--run-hooks --phase 07-domain --set domain=true \
--values <values.yaml> # custom domain
```

`<values.yaml>` carries this product's identity — at minimum `reponame`,
Expand Down
25 changes: 18 additions & 7 deletions blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ spec:
pattern: "^[a-z0-9][a-z0-9-]{0,62}$"
help: The workers.dev subdomain on the Cloudflare account this builds into.
example: acme
# READ FROM THE CLOUDFLARE CONNECTION, not asked. The subdomain belongs
# to the account the same way its id does, and there is exactly one
# right answer — a typed one could only be wrong, and wrong showed up
# after deploy, in CORS, OAuth origins, smoke checks and the verify URLs
# below. The integration reads it from Cloudflare at connect and on its
# hourly health check; the bootstrap door fills this input from the
# connection the build is BOUND to, the same one CLOUDFLARE_ACCOUNT_ID
# and the deploy tokens mint from, so all three name one account.
#
# No orun action and no `probe:` is needed, because the platform already
# holds the fact. An account with no workers.dev subdomain refuses the
# build at the door, naming the fix, before anything is created.
from: connection.cloudflare.workersSubdomain

# ── PREVIEW ONLY. `repo-blueprint.yaml`'s `integrations/reconcile` hooks
# mint these, brokered, during phase 03. ────────────────────────────────
Expand Down Expand Up @@ -141,7 +154,7 @@ spec:
# these. Idempotent by identity — epic by slug, milestone by name-within-epic
# — so a re-run finds what it made before. The console renders the programme
# so an operator can see the shape of the work before pressing Build.
# Ten phases, eight milestones: `03-infrastructure-database` and
# Nine phases, seven milestones: `03-infrastructure-database` and
# `04-workers-restore` are second landings of 03 and 04, and file under them.
programme:
epicSlug: infra-baselining # = repo-blueprint.yaml's `epicSlug` default
Expand All @@ -152,13 +165,11 @@ spec:
- name: 03-infrastructure
- name: 04-workers
- name: 05-edge
# The custom-domain component lands in 06-console, parked (it
# subscribes to no environment until an owner wires a zone), so the
# optional 07-domain milestone and the `domain` input that switched it
# on are gone. The numbering keeps its gaps so 08 keeps its name.
- name: 06-console
# 07-domain carries `when: inputs.domain` in repo-blueprint.yaml (it
# needs the Cloudflare zone to already exist), so its milestone is
# ensured only on a run that asks for it. Declared with its condition
# rather than silently listed, so the console can say so.
- name: 07-domain
when: domain
- name: 08-docs

bootstrap:
Expand Down
3 changes: 1 addition & 2 deletions docs/phases/01-scaffold.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ gates the set, so the promise is a test rather than a claim.
| `productdomain` | `acme.dev` | REQUIRED. Product domain |
| `githuborg` | `sourceplane` | REQUIRED. The org or user the repo is created under |
| `orunWorkspace` | `ws_ABCD1234` | workspace id. Unset, the workspace the build runs in (ORUN_WORKSPACE); with none anywhere, the placeholder `ws_SET_ME` |
| `subdomain` | `rahulvarghesepullely` | the Cloudflare account's workers.dev subdomain — every URL derives from it (worker names are brand-prefixed, so keeping the baseline's account is supported) |
| `subdomain` | `rahulvarghesepullely` | workers.dev subdomain of the Cloudflare account you deploy into — every URL derives from it (worker names are brand-prefixed, so keeping the baseline's account is supported). A console or `--from bst_…` build reads it from the Cloudflare connection; pass it only for a hand-run build |
| `apibaseurl` | `https://api.acme.dev` | CLI default API base; empty derives from `productdomain` |
| `repoPrivate` | `true` (default) | visibility at creation only |
| `epicSlug` | `infra-baselining` (default) | the epic every phase files its task under |
| `domain` | `false` (default) | `true` also runs `07-domain` |

The full set, rebrand overrides included, is in the
[phases README](README.md#inputs) and `repo-blueprint.yaml`'s `inputs:`
Expand Down
54 changes: 50 additions & 4 deletions docs/phases/06-console.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

Lands the **web console** (`repo-blueprint.yaml`, phase `06-console`) — the
product UI served from Workers static assets — and proves both it and the
edge it talks to live.
edge it talks to live. The custom-domain component lands with it, parked
([below](#the-custom-domain--parked)).

## What it lands

Expand All @@ -12,6 +13,52 @@ phase 05 edge. Console builds are the heaviest lane in the product, which is
why this phase's landing waits up to 45 minutes for its PR and its
convergence watch up to 45 minutes too.

`infra/terraform/cloudflare-domain` lands in the same pull request, parked.
`testing/phases.test.sh` holds the set: modules move whole, and nothing else
moves with them.

## The custom domain — parked

`infra/terraform/cloudflare-domain` — the zone lookup and, once wired, a
custom domain per environment for the console worker
(`CONSOLE_CUSTOM_DOMAIN` in the product's `intent.yaml`:
`stage.<productdomain>` and `prod.<productdomain>` after rebrand, empty for
`dev`) — lands with the console and **deploys nothing**, for two reasons
that live in the component rather than in the phase:

1. **It ships parked.** Its `component.yaml` declares
`subscribe.environments: []`, so CI plans no lanes for it. The product
runs on workers.dev URLs until an owner wires it.
2. **The attachment is fenced off.** The component is midway through a
two-step migration to Cloudflare provider v5: the v4
`cloudflare_workers_domain` resource was dropped from state and its block
is commented out until the v5 `cloudflare_workers_custom_domain` replaces
it. Un-parked as it stands, the root would look up the zone and attach
nothing.

It used to land on its own as the optional `07-domain` phase, behind a
`domain` input. That landing deployed nothing either — its convergence was a
green run with nothing in it — so the phase and the switch are gone, and
this phase's task contract leaves the component out of `affects`: there is
nothing in it to re-plan.

Wiring it is a normal pull request in the product, once the zone exists:

1. **The zone first.** The product zone (e.g. `acme.dev`) must already exist
in the Cloudflare account the product deploys into, created in the
dashboard; zone creation is an account-plan operation the platform does
not broker. The component runs with `zoneMode: existing`: it looks the
zone up by `baseDomain` and manages records and custom domains IN it, not
the zone itself. Without the zone a plan fails with `no zone found` (or
the brokered token's account is not the zone's).
2. **Finish the v5 resource and restore the `subscribe` block** the
component carries commented out — both are described in its own comments,
and its `README.md` says where the migration stands.
3. **Land it.** The convergence on `main` applies it; check the product
resolves on its own domain (DNS propagation applies), then re-run
[`08-docs`](08-docs.md) so the deployment manifest records the
custom-domain URLs.

## Inputs

`--out` is the product repo. The blueprint's required inputs — `reponame`,
Expand Down Expand Up @@ -79,9 +126,8 @@ nothing new, and the `await` hooks re-probe.

## Next

[Phase 08 — docs](08-docs.md) records what was built. Optional
[phase 07 — domain](07-domain.md) comes first only if you set
`domain=true` — read that page before you do.
[Phase 08 — docs](08-docs.md) records what was built. The custom domain is
wired later, in an ordinary PR ([above](#the-custom-domain--parked)).

Post-baseline: seed runtime worker secrets (`orun secrets set <KEY> --org
<ws> --env <env>`; wire-now-seed-later, nothing blocks on them) and ship
Expand Down
Loading
Loading