You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a2f60ee
Browse filesBrowse the repository at this point in the historyBrowse files
feat(deploy): deploy a repository that has no Composer config
`prisma deploy` now has two paths.
A repository whose prisma.config.ts declares a `composer` section takes
Composer's deploy, unchanged. Composer's own section validator decides
whether the section is missing.
Every other repository takes a single-app deploy. It deploys the one app
in the current folder from the repository's own install, build and start
commands. The rules and the deploy come from `@prisma/compute-sdk/app`
(prisma/project-compute#202). The CLI adds no framework rules.
- The App config is the `app` section of prisma.config.ts: install,
build, start, static and port. `prisma/config` types it.
- The project is the linked project or `--project`. `--environment`
names the Branch. `--name` names the service; the default is the
`name` in package.json, else the folder name.
- The version is promoted only when the app listens. A failed install or
build, a missing start, and an app that exits or opens no port each
fail the deploy with a `DEPLOY.APP_*` error.
- The end-to-end suite now covers `deploy` through the single-app path.
`@prisma/compute-sdk/app` is not published yet, so the pinned version in
package.json does not have it. `pnpm typecheck`, the builds and the tests
fail on the pinned version until project-compute#202 is released and the
pin is raised. They pass against the build of that pull request.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/product/command-principles.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,6 +93,26 @@ No current branch command uses `use`; branch targeting follows explicit flags or
93
93
94
94
Build and release an app into a target branch.
95
95
96
+
`deploy` has two paths, and the repository decides which one runs:
97
+
98
+
-**Composer deploy.** A loaded `prisma.config.ts` declares a `composer` section. Composer's own `deploy` command runs, unchanged. The test is Composer's own: its section validator decides whether the section is missing.
99
+
-**Single-app deploy.** No loaded `prisma.config.ts` declares a `composer` section. The CLI deploys the one app in the current folder from the repository's own install, build and start commands. It holds no framework rules.
100
+
101
+
A repository that shows another sign of a Composer app still takes the Composer path, and fails with Composer's `CONFIG.SECTION_MISSING` error: `--entry` names a file that exists, or a `prisma-composer.config.*` file is present. A single-app deploy ignores an `--entry` that names no file, because prisma/cloud-deploy-action always passes `--entry module.ts`.
102
+
103
+
A single-app deploy works like this:
104
+
105
+
-**Build settings.** Install, Build, Start or Static folder, and Port. Each has a Source: `prisma.config.ts`, `package.json`, the lockfile, the build output, an entry file, or a default. The rules live in `@prisma/compute-sdk/app`; the CLI calls `resolveBuildSettings`, `buildApp` and `deployApp` and adds none of its own.
106
+
-**App config.** The `app` section of `prisma.config.ts`: `install`, `build`, `start`, `static`, `port`. Every field is optional and replaces the rule for that setting. An unknown field is an error.
107
+
-**Project.** The project the directory is linked to, or `--project`. It is resolved the way the `service` commands resolve it. A single-app deploy never creates a project.
108
+
-**Branch.**`--environment production` (the default) is the project's default Branch. Any other name is the Branch with that git name, created when it does not exist.
109
+
-**Service.** Named by `--name`, else the `name` in `package.json` without its scope, else the folder name. The service on the Branch with that name is reused; otherwise one is created.
110
+
-**Start check.** The app is started on Prisma Cloud before it gets traffic. The version is promoted only when the app listens on the routed port. When the app listens on another port and no port was stated, the deploy runs once more with that port. An app that exits, or opens no port within 60 seconds, fails the deploy and leaves the live version unchanged.
111
+
-**Environment variables.** The platform gives a new version the project's variables for the Branch's scope. `deploy` sends none of its own.
112
+
-**Exit code.** Every failure is a structured error and exits non-zero: a failed install or build, no start command, a failed start, a failed API call.
113
+
114
+
Human output is a card with the target and the Build settings, one line per finished step, then the URL. On stdout, a single-app deploy writes the same data line as a Composer deploy: the service name, `compute-service`, the service id and the URL, separated by tabs.
115
+
96
116
### `init`
97
117
98
118
Prepare the current repository for Prisma development, entirely locally: add the `postinstall` script that keeps the Prisma agent skills in sync (`prisma skills sync || exit 0`), add `prisma` to `devDependencies` at the CLI's exact version when no dependency field declares it, scaffold a `prisma.config.ts` recording which agents get skills, then sync the skills once now.
|`CONFIG`| The `composer` section of `prisma.config.ts` and its `config` and `secrets` adapters (`prisma dev`, `prisma deploy`) |
23
-
|`DEPLOY`| Deploying, listing and destroying a Composer app (`prisma deploy`, `prisma deploy list`, and the `deploy` and `destroy` operations of `@prisma/composer/control`) |
23
+
|`DEPLOY`| Deploying, listing and destroying a Composer app (`prisma deploy`, `prisma deploy list`, and the `deploy` and `destroy` operations of `@prisma/composer/control`), and a single-app deploy (`prisma deploy` in a repository with no Composer config), whose codes start with `DEPLOY.APP_`|
24
24
|`DEV`| Running an app on this machine with Composer (`prisma dev`, `prisma dev url`, `prisma dev stop`, `prisma emulator list`) |
@@ -320,6 +320,34 @@ These codes come from Composer, the command family behind `prisma deploy`, `pris
320
320
321
321
Composer starts the deploy engine from the `alchemy` package installed beside `@prisma/composer`, and either `@prisma/composer` itself could not be resolved from the app, or no runnable engine entry could be resolved beside it. Layouts without a `node_modules` directory, such as Yarn Plug'n'Play, are not supported. The fix is to check that the app depends on `@prisma/composer` and to reinstall dependencies so `@prisma/composer` and its `alchemy` dependency sit in a `node_modules` directory. Meta: none.
322
322
323
+
### DEPLOY.APP_BUILD_FAILED
324
+
325
+
A single-app deploy ran the app's build command and it exited with an error. Nothing was uploaded. The end of the command's output is printed before the error (in `--json` mode, as `output` events with `source: "build"`). The fix is to run the build command in the app folder and fix what it reports, or to set `build` in the `app` section of `prisma.config.ts`. Meta: `command`, `seconds`.
326
+
327
+
### DEPLOY.APP_EXITED
328
+
329
+
A single-app deploy uploaded a version and started it, and the app exited. The version was not promoted, so the version that serves traffic did not change. The app's own output is printed before the error (in `--json` mode, as `output` events with `source: "app"`), and `meta.start.output` carries it. A common cause is an environment variable the app needs: set it with `prisma project env add`, then deploy again. Meta: `serviceId`, `versionId`, `url` (the version's own URL), `port`, `start` (`state`, `code`, `output`).
330
+
331
+
### DEPLOY.APP_INSTALL_FAILED
332
+
333
+
A single-app deploy ran the app's install command and it exited with an error. Nothing was built or uploaded. The end of the command's output is printed before the error (in `--json` mode, as `output` events with `source: "install"`). The fix is to run the install command in the app folder and fix what it reports, or to set `install` in the `app` section of `prisma.config.ts`. Meta: `command`, `seconds`.
334
+
335
+
### DEPLOY.APP_NO_START
336
+
337
+
A single-app deploy found no way to start the app, so nothing was uploaded. No rule matched: the `start` script is missing or runs a development server, the build wrote no server file and no static site, and the folder holds no entry file such as `index.ts`. The fix is to add a `start` script to `package.json`, or to set `start` (a command) or `static` (a folder of static files) in the `app` section of `prisma.config.ts`. Meta: none.
338
+
339
+
### DEPLOY.APP_PORT_MISMATCH
340
+
341
+
A single-app deploy started the app, and the app listens on another port than the one requests are sent to. The version was not promoted. This happens when `port` in the `app` section names a port the app does not use, or when the app picks a different port on each start. The fix is to set `port` to the port the app listens on, or to make the app listen on the port in the `PORT` environment variable. Meta: `serviceId`, `versionId`, `url`, `port` (the routed port), `start` (`state`, `port`).
342
+
343
+
### DEPLOY.APP_SILENT
344
+
345
+
A single-app deploy started the app, and the app neither opened a port nor exited within 60 seconds. The version was not promoted. The app's output so far is printed before the error. The fix is to make the app listen on the port in the `PORT` environment variable. Meta: `serviceId`, `versionId`, `url`, `port`, `start` (`state`, `output`).
346
+
347
+
### DEPLOY.APP_USAGE_ERROR
348
+
349
+
`--project` was passed to a deploy of a Prisma Composer app. The flag names the Project of a single-app deploy only; a Composer app is deployed into the project named after the app, so the flag is refused instead of ignored. The fix is to remove `--project`, or to pass `--name` to deploy the app under another name. Meta: none.
350
+
323
351
### DEPLOY.BUILD_REQUIRED
324
352
325
353
Assembling a service failed during a destroy. Destroy evaluates the same stack program as deploy, which packages the built artifacts, so an app must be built before it can be torn down. The fix is to run the build, then retry the destroy. The underlying assemble error rides as the cause.
|`dev`, `deploy`| Run a Composer app locally; deploy it to the platform. `dev url` prints a running node's local URL and `dev stop` stops the app. |
80
+
|`dev`, `deploy`| Run a Composer app locally; deploy it to the platform. `dev url` prints a running node's local URL and `dev stop` stops the app. In a repository with no Composer config, `deploy` deploys the one app in the folder from its own install, build and start commands. |
81
81
|`emulator`| List the local emulators `prisma dev` runs services, databases and buckets on. |
0 commit comments