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
5 changes: 3 additions & 2 deletions .github/workflows/baseline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ jobs:
set -euo pipefail
orun --version
# Inputs that are `required: true` must be supplied for the document
# to resolve; the values are arbitrary and nothing is written.
# to resolve; the values are arbitrary and nothing is written. No
# domain: the console asks for none, so the document must resolve
# without one.
orun new --blueprint repo-blueprint.yaml --status \
--out "$(mktemp -d)" \
--set reponame=acme-cloud \
--set "productname=Acme Cloud" \
--set productdomain=acme.dev \
--set githuborg=acme-inc
# Tier 1's leak gate. It derives what every phase WOULD place and gates
# that set — so it needs orun, which is why it rides this job rather than
Expand Down
33 changes: 26 additions & 7 deletions BOOTSTRAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ cd lumen
orun new --blueprint repo-blueprint.yaml \
--out ~/sourceplane/acme --run-hooks --resume \
--set reponame=acme --set productname="Acme Cloud" \
--set productdomain=acme.dev --set githuborg=sourceplane \
--set githuborg=sourceplane \
--set orunWorkspace=ws_XXXXXXXX \
--set subdomain=<workers-dev-subdomain>
```
Expand All @@ -99,6 +99,17 @@ 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.

**No domain is asked.** The blueprint's required inputs are `reponame`,
`productname` and `githuborg`; the domain is not one of them. The product
goes live on workers.dev, and `productdomain` defaults to empty, which brands
the reserved placeholder `<reponame>.example.com` wherever the domain goes
(intent's `BASE_DOMAIN` and `CONSOLE_CUSTOM_DOMAIN`, the edge and identity
console origins, the mail sender, the billing return URLs) for an owner to
replace later (§4). With no domain the CLI's default API is the product's own
prod edge, `https://<reponame>-api-edge-prod.<subdomain>.workers.dev`. Pass
`--set productdomain=` only for a product that already has its domain; the
CLI then defaults to `https://api.<productdomain>`.

**`--run-hooks` is the difference between placing files and bootstrapping a
product.** Without it `orun new` writes the tree and stops: no repo is
created, nothing is landed, no convergence is watched, and no phase probes
Expand Down Expand Up @@ -130,7 +141,7 @@ phase in that folder.
orun new --blueprint repo-blueprint.yaml --out ~/sourceplane/acme --run-hooks \
--phase 01-scaffold \
--set reponame=acme --set productname="Acme Cloud" \
--set productdomain=acme.dev --set githuborg=sourceplane \
--set githuborg=sourceplane \
--set orunWorkspace=ws_XXXXXXXX --set subdomain=<workers-dev-subdomain>

# 01 committed the answers as .rebrand/values.json, keyed by the blueprint's
Expand Down Expand Up @@ -263,9 +274,13 @@ 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` and `productdomain` are typed.
is bound to, so it names the account the deploy tokens mint from); only
`productname` is typed.
- No domain is asked. `productdomain` and `apibaseurl` (which the card
derived from it, and a card can only derive from inputs it declares) left
the card in baseline-v30: the product is born with the placeholder
`<reponame>.example.com` where the domain goes, and its CLI defaults to its
own prod edge on workers.dev. An owner sets the domain later (§4).
- `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.
- There is no `domain` input. The custom-domain component lands in
Expand All @@ -283,7 +298,11 @@ 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**: the `cloudflare-domain` component is already in the
- **Custom domain**: a product built without one carries the placeholder
`<reponame>.example.com` wherever the domain goes; replacing it
(`git grep -l <reponame>.example.com`) is the first step, and the
product's `ai/context/operations.md`, "Setting the domain later", lists
every place and step. 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
Expand Down Expand Up @@ -360,7 +379,7 @@ purpose, written down so they read as instructions rather than breakage.
| `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. |
| The product's `intent.yaml` says `workspace: ws_SET_ME`, or its secret refs name the repository (`secret://<repo>/…`) | `orunWorkspace` was empty: set it, or run the build in the workspace (ORUN_WORKSPACE) with a CLI ≥ v2.58.11, which fills it from there. |
| `✕ input "productdomain" is required` | Required inputs are validated before anything else, so this names the key nobody typed. All four — `reponame`, `productname`, `productdomain`, `githuborg` — must be set on every invocation, including single-phase ones. `--values <out>/.rebrand/values.json` carries them. |
| `✕ input "productname" is required` | Required inputs are validated before anything else, so this names the key nobody typed. All three — `reponame`, `productname`, `githuborg` — must be set on every invocation, including single-phase ones. `--values <out>/.rebrand/values.json` carries them. The domain is not required (a baseline before v30 asked for `productdomain` too). |
| Console/edge smoke fails right after the FIRST deploy of a worker | workers.dev route propagation race — the deploy lane's smoke retries with backoff (stack-tectonic ≥ 0.18.2); a convergence resume clears older pins. |
| Terraform lane: "state already locked" by ITS OWN plan | Backend lock-release race — a convergence resume clears it. |
| Lanes fail with NO logs at all | GitHub Actions billing or spending limit. The message lives only in the check-run annotations (`gh api repos/<o>/<r>/check-runs/<job-id>/annotations`). |
Expand Down
59 changes: 56 additions & 3 deletions ai/context/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ 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 | `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 |
| custom domain | see [Setting the domain later](#setting-the-domain-later): replace the domain string, create the zone, restore `infra/terraform/cloudflare-domain`'s commented-out `subscribe` block (it ships parked, `subscribe.environments: []`, mid-way to provider v5), merge, then run the `08-docs` phase |
| headless/CI credentials | `ORUN_TOKEN` (workspace-scoped) + `GITHUB_TOKEN` |

The ops phases (docs refresh and the original deployment sequence) all
Expand All @@ -129,12 +129,65 @@ orun new --blueprint repo-blueprint.yaml --out <product-checkout> \
```

`<values.yaml>` carries this product's identity — at minimum `reponame`,
`productname`, `productdomain`, `githuborg` and `orunWorkspace`, which the
blueprint validates before anything runs. `--run-hooks` is what makes a phase
`productname`, `githuborg` and `orunWorkspace`, which the blueprint validates
before anything runs (and `productdomain` once the product has a domain);
`.rebrand/values.json` in this repository is a complete one. `--run-hooks` is what makes a phase
land and verify rather than just place files; `--status` previews without
writing. Every phase is idempotent — re-running a completed one is a no-op
that re-verifies.

## Setting the domain later

This product answers on workers.dev from its first deploy, and it was built
without a domain. Every place the domain goes carries one string until an
owner sets it — in this repository, `lumen.app` (built without a domain, that
is the reserved placeholder `<reponame>.example.com`, which can never be
anyone's real domain). Nothing that uses the domain was removed; it waits:

| where | what it is |
|---|---|
| `intent.yaml` | `BASE_DOMAIN` (every environment) and `CONSOLE_CUSTOM_DOMAIN` (`stage.lumen.app`, `prod.lumen.app`) — the parameters of the parked `infra/terraform/cloudflare-domain` |
| `infra/terraform/cloudflare-domain` | `baseDomain` in its `component.yaml`, the Terraform variable's default, its README |
| `apps/api-edge/wrangler.template.jsonc` | `CONSOLE_CUSTOM_DOMAIN`, the console origin CORS allows besides the workers.dev one |
| `apps/identity-worker/wrangler.template.jsonc` | `OAUTH_ALLOWED_CONSOLE_ORIGINS`, which lists the workers.dev console too, so sign-in works without a domain |
| `apps/notifications-worker/wrangler.template.jsonc` | `EMAIL_FROM_ADDRESS`, `no-reply@mail.lumen.app` |
| `apps/billing-worker/wrangler.template.jsonc` | `POLAR_SUCCESS_URL`, the fallback return after checkout |
| `tests/api-edge` | the CORS fixtures, which follow the edge's config |

To set it, in one PR:

1. **Replace the string everywhere**, and record the domain as
`productdomain` in `.rebrand/values.json`, where the docs refresh reads
it:

```bash
git grep -lF 'lumen.app' # every file that names it
git grep -lzF 'lumen.app' | xargs -0 perl -pi -e 's/\Qlumen.app\E/acme.dev/g' # acme.dev: yours
```

2. **Create the zone** in the Cloudflare account the product deploys into
(dashboard; the platform does not create zones), then restore the
`subscribe` block `infra/terraform/cloudflare-domain/component.yaml`
carries commented out, and finish the provider-v5 custom-domain resource
its comments describe. Until then the console has no custom domain and
keeps its workers.dev URL.
3. **Verify the mail domain** — `mail.<your domain>` in Cloudflare Email
Service (DKIM/SPF). The notifications worker sends from
`no-reply@mail.<your domain>`; until it is verified, sends surface as
`notification.failed` events and nothing else breaks.
4. **Supabase auth URLs.** This product sets none: sign-in is the identity
worker's, and `infra/terraform/supabase` names no domain. If you have
since set Supabase Auth's site URL or redirect URLs in its dashboard,
point them at the domain too.
5. **The CLI default, if you want it on the domain.** Built without a
domain, `DEFAULT_API_URL` in `packages/cli/src/brand.ts` is the prod edge
on workers.dev, `https://lumen-api-edge-prod.<subdomain>.workers.dev`;
replacing the domain string does not move it. Re-point it once a host on
your domain routes to the edge.
6. **Merge, then run the docs flow** (the `08-docs` phase, above) once the
convergence is green and DNS resolves, so `deployment.md` records the
domain.

## Evolution

Structural changes (new workers, infra components, packages) follow the
Expand Down
25 changes: 12 additions & 13 deletions blueprint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ spec:
# The cost lands here. An `askedBy: agent` input was exempt from `pattern`,
# because prose asked for it and prose does not validate. Every input now
# carries the rule its value is checked against before Continue.
#
# THE DOMAIN IS NOT ASKED. The product goes live on workers.dev, and a
# domain is an owner's step after the bootstrap: `productdomain` defaults
# to empty in repo-blueprint.yaml, and the rebrand writes the reserved
# placeholder `<reponame>.example.com` wherever the domain goes (intent's
# BASE_DOMAIN and CONSOLE_CUSTOM_DOMAIN, the edge and identity origins, the
# mail sender, the billing return URLs) for the product's
# ai/context/operations.md, "Setting the domain later", to replace. Nothing
# that needs a domain is removed — it waits for one. `apibaseurl` went with
# it: it was derived from `{productdomain}`, and a card can only derive
# from inputs it declares. With no domain, the CLI's default API is the
# product's own prod edge on workers.dev (rebrand.mjs).
- key: reponame
label: Repo name
pattern: "^[a-z][a-z0-9-]{1,38}$"
Expand All @@ -75,19 +87,6 @@ spec:
pattern: "^[A-Za-z0-9][A-Za-z0-9 .,'&-]{1,48}$"
help: The name people will see — in the console header, the emails, the docs.
example: Acme Cloud
- key: productdomain
label: Product domain
pattern: "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$"
help: The apex domain the product answers on. It does not need to exist yet.
example: acme.dev
- key: apibaseurl
label: API base URL
pattern: "^https://[a-z0-9.-]+$"
help: Where the CLI and SDK point by default.
# Derived rather than asked: it is the product domain with a prefix, and
# a field for it is a field an operator can get subtly wrong (http, a
# trailing slash, api. on the wrong half) for no gain.
derive: "https://api.{productdomain}"
- key: githuborg
label: GitHub organisation
pattern: "^[A-Za-z0-9][A-Za-z0-9-]*$"
Expand Down
5 changes: 2 additions & 3 deletions docs/phases/01-scaffold.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ gates the set, so the promise is a test rather than a claim.
| `--out` | `$HOME/sourceplane/acme` | a flag, not an input; created if absent |
| `reponame` | `acme` | REQUIRED. Lowercase slug (`^[a-z][a-z0-9-]*$`); repo becomes `<githuborg>/<reponame>` |
| `productname` | `Acme Cloud` | REQUIRED. Display name |
| `productdomain` | `acme.dev` | REQUIRED. Product domain |
| `productdomain` | — (default empty) | NOT ASKED. Empty brands the placeholder `<reponame>.example.com` where the domain goes, for an owner to replace later; pass it only for a product that already has its 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` | 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` |
| `apibaseurl` | — (default empty) | CLI default API base; empty derives `https://api.<productdomain>`, or with no domain the prod edge, `https://<brandSlug>-api-edge-prod.<subdomain>.workers.dev` |
| `repoPrivate` | `true` (default) | visibility at creation only |
| `epicSlug` | `infra-baselining` (default) | the epic every phase files its task under |

Expand Down Expand Up @@ -149,7 +149,6 @@ orun new --blueprint repo-blueprint.yaml \
--out $HOME/sourceplane/acme --run-hooks --phase 01-scaffold \
--set reponame=acme \
--set productname="Acme Cloud" \
--set productdomain=acme.dev \
--set githuborg=sourceplane \
--set orunWorkspace=ws_ABCD1234 \
--set subdomain=rahulvarghesepullely
Expand Down
2 changes: 1 addition & 1 deletion docs/phases/02-foundation.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ applies them yet: the migration runner (`infra/db-migrate`) lands in
## Inputs

`--out` is the product repo. The blueprint's required inputs — `reponame`,
`productname`, `productdomain`, `githuborg` — are validated before any phase
`productname`, `githuborg` — are validated before any phase
runs, so pass them on every invocation; the product's own
`.rebrand/values.json` is a complete values file. See
[the phases README](README.md#inputs).
Expand Down
2 changes: 1 addition & 1 deletion docs/phases/04-workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ PRs and two task contracts, are two phases here.
## Inputs

`--out` is the product repo. The blueprint's required inputs — `reponame`,
`productname`, `productdomain`, `githuborg` — are validated before any phase
`productname`, `githuborg` — are validated before any phase
runs, so pass them on every invocation; the product's own
`.rebrand/values.json` is a complete values file. See
[the phases README](README.md#inputs).
Expand Down
2 changes: 1 addition & 1 deletion docs/phases/05-edge.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ own deploy lane in phase 04 is the evidence for it.
## Inputs

`--out` is the product repo. The blueprint's required inputs — `reponame`,
`productname`, `productdomain`, `githuborg` — are validated before any phase
`productname`, `githuborg` — are validated before any phase
runs, so pass them on every invocation; the product's own
`.rebrand/values.json` is a complete values file. See
[the phases README](README.md#inputs).
Expand Down
14 changes: 10 additions & 4 deletions docs/phases/06-console.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ moves with them.
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:
`dev` — and, since the console asks for no domain, `<productdomain>` is the
placeholder `<reponame>.example.com` until an owner sets one) — 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
Expand All @@ -42,7 +44,11 @@ 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:
Wiring it is a normal pull request in the product, once the zone exists.
The product's `ai/context/operations.md` ("Setting the domain later") carries
the whole list for its owner: replace the placeholder everywhere it stands
(`git grep -l <reponame>.example.com` — intent, the edge and identity console
origins, the mail sender, the billing return URLs), then:

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
Expand All @@ -62,7 +68,7 @@ Wiring it is a normal pull request in the product, once the zone exists:
## Inputs

`--out` is the product repo. The blueprint's required inputs — `reponame`,
`productname`, `productdomain`, `githuborg` — are validated before any phase
`productname`, `githuborg` — are validated before any phase
runs, so pass them on every invocation; the product's own
`.rebrand/values.json` is a complete values file. See
[the phases README](README.md#inputs).
Expand Down
Loading
Loading