Repository navigation
Conversation
Signed-off-by: Søren Bramer Schmidt <[email protected]>
|
⏸️ Gizmo skipped the automatic review of 3d6b71b because this pull request is a draft. It will review automatically once the PR is marked ready for review.
|
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
commit: |
Signed-off-by: Søren Bramer Schmidt <[email protected]>
wmadden-electric
left a comment
There was a problem hiding this comment.
Thanks for this, Søren. The goal is right: say in code which hostname serves which part of the app on each environment, and never fail a deploy because DNS isn't set up yet. Working through it, though, we found it touches several design problems at once. We'd like to solve those first, so we're requesting changes here and proposing a replacement design.
What we're proposing instead
// prisma.config.ts
composer({ extensions: [prismaCloud(), nodeBuild()], state: prismaState(), config: [dotenv()] })
// module.ts
export default module('shop', { input: type({ 'SITE_HOSTNAME?': 'string' }) },
({ input, provision }) => {
const web = provision(webService, { deps: { auth: auth.rpc } });
provision(ingress({ name: 'site', hostname: input.SITE_HOSTNAME, target: web.http }));
});# .env.production
SITE_HOSTNAME=www.myapp.com
- A hostname is declared next to the service it routes to, as an
ingress()node in the graph. The ingress points at the service's exposed HTTP port, and the service knows nothing about its domains. - Per-stage values come from configuration providers named in
prisma.config.ts(dotenv()first). The root module'sinputschema validates them. A stage that sets no hostname, such as a PR preview, gets a generated hostname. - On the platform, an ingress becomes a record of its own on the Branch. It exists before DNS is set up, survives promotes, and is found again by its
logicalId. Your Console setup link (prisma/pdp-control-plane#5792) and TXT ownership proof (prisma/pdp-control-plane#5785) fit straight into this.
Why not this PR's approach
- The
domainsmap in the Prisma Cloud options puts application settings in the config file, and it names services by strings that nothing keeps in sync with the graph. The config file is meant to say which extensions and state store a deploy uses, and nothing about the app itself. - Renaming
--stageto--branch. "Stage" is Composer's target-neutral word for an environment. It also covers local dev, which never has a Branch. We've recorded this in ADR-0059 (#385). - The destructive-plan check is a real need, but it isn't specific to domains. Losing a domain is like losing a database or any other part of the topology. We'd like it designed as general "ask before losing data" consent, separately, rather than through a plan-hash token on this path.
Where to look and comment
- Composer design, ADRs 0060–0062 plus a Prisma Cloud ingress doc: #386
- The platform's ingress record, ADR 015: prisma/pdp-control-plane#5795
- Stage terminology, ADR-0059: #385
Your feedback on those would be really valuable, especially on the platform proposal, since you know the domain flow best.
Signed-off-by: Søren Bramer Schmidt <[email protected]>
Signed-off-by: Søren Bramer Schmidt <[email protected]>
Signed-off-by: Søren Bramer Schmidt <[email protected]>
Signed-off-by: Søren Bramer Schmidt <[email protected]>
Purpose of change
Declare Composer custom domains by actual branch name, finish DNS setup in Console, and require explicit approval before destructive deployment changes.
The broader declaration, branch flag and consent design remains under review in Will’s review. This PR stays draft pending that decision.
What's changed and why
In the
composersection ofprisma.config.ts:shop.web, including the deployed app name (also when overridden with--name). Domain resources use that same full address. Branch keys are exact platform names. A default deploy reads the current default branch name; neithermainnorproductionis an alias. Modules stay independent of their environment, unlisted branches inherit no domains, and changing the default never moves hostnames.prisma deploy module.ts --branch staging. Keep--stageas a deprecated alias, reject both together, and preserve branch IDs and existing deploy state. Programmatic deploys acceptbranchwith the same compatibility alias.--confirm <plan-token>after reviewing the refusal in CI.--yescannot approve it. Programmatic deploy/destroy returnDEPLOY.DESTRUCTIVE_APPROVAL_REQUIREDwithfailure.meta.plan, acceptdestructiveApproval, and support an explicitapproveDestructivePlancallback. A retry replans and rejects stale approval before any planned changes run.Rollout and limits
Deploy platform branch protection #5796, TXT verification #5785, and Console setup #5792 before releasing these Composer packages. Expected setup outcomes are HTTP 422
domain-ownership-required, HTTP 400domain-dns-requiredand HTTP 400domain-cloudflare-proxy; unrelated errors still fail deployment. The companion rollout plan is in #5792. No schema, secrets, infrastructure, or workflow YAML changes are needed. Apps without domain declarations make no domain requests.The guard checks resource lifecycle actions, not SQL migrations. Container setup, missing environment-variable seeding and deploy-attempt recording happen before the resource plan. Default-deployment teardown attempts to remove the empty project; the platform keeps it if another branch still has resources. Parent cascades are warned about rather than enumerating externally managed children.
Testing notes / Before-after
Before: Composer had no domain declaration, guided setup, canonical branch flag or destructive-change guard. After: branch-specific hostnames finish setup in Console, and omission cannot silently remove a serving binding or durable resource.
shop.web), promotion ordering, repeated pending setup, Console-completed bindings, invalid/duplicate declarations and unexpected HTTP errors. Console browser verification and embedded screenshots remain in the companion PR.