diff --git a/apps/docs/content/docs/compute/index.mdx b/apps/docs/content/docs/compute/index.mdx new file mode 100644 index 0000000000..5f659896ab --- /dev/null +++ b/apps/docs/content/docs/compute/index.mdx @@ -0,0 +1,246 @@ +--- +title: Prisma Compute +description: One-page internal reference for deploying apps to Prisma Compute during EA. +badge: early-access +url: /compute +metaTitle: Prisma Compute +metaDescription: Internal one-page reference for deploying Next.js and Bun apps to Prisma Compute, managing environment variables, and streaming logs. +--- + +App hosting for Next.js and Bun, driven from the CLI. Two CLIs are usable today, pick whichever you prefer: + +- [`@looma/prisma-cli`](https://www.npmjs.com/package/@looma/prisma-cli): new unified `prisma app` surface. +- [`@prisma/compute-cli`](https://www.npmjs.com/package/@prisma/compute-cli): original `compute` surface. + +## Quickstart + +Pick your starter and run the steps below. + + + + + +```bash +pnpm create next-app@latest my-app --yes +cd my-app +``` + +Enable standalone output in `next.config.ts`: + +```typescript +const nextConfig = { output: "standalone" }; +export default nextConfig; +``` + + + + + +```bash +mkdir my-app && cd my-app && bun init --yes +``` + +Replace `index.ts`: + +```typescript +Bun.serve({ + port: Number(process.env.PORT ?? 3000), + fetch() { + return new Response("Hello from Compute"); + }, +}); +``` + + + + + +Authenticate, then deploy: + + + + @looma/prisma-cli + @prisma/compute-cli + + + +```bash +npx @looma/prisma-cli auth login +npx @looma/prisma-cli app deploy --app my-app --http-port 3000 +``` + + + + +```bash +bunx @prisma/compute-cli login +bunx @prisma/compute-cli deploy --service-name my-app --http-port 3000 +``` + + + + +The first deploy bootstraps project context. Re-deploys reuse the saved selection, so `app deploy` (or `deploy`) is enough. + +In CI, set `PRISMA_API_TOKEN` instead of running `auth login`. + +## Inspect a deployment + + + + @looma/prisma-cli + @prisma/compute-cli + + + +```bash +npx @looma/prisma-cli app list-deploys +npx @looma/prisma-cli app show-deploy +``` + + + + +```bash +bunx @prisma/compute-cli versions list +bunx @prisma/compute-cli versions show +``` + + + + +## Environment variables + +Set them inline on a deploy, or update without rebuilding (cuts a new version). + +**During a deploy**, repeat `--env` per variable: + + + + @looma/prisma-cli + @prisma/compute-cli + + + +```bash +npx @looma/prisma-cli app deploy \ + --env DATABASE_URL=postgresql://example \ + --env NODE_ENV=production +``` + + + + +```bash +bunx @prisma/compute-cli deploy \ + --env DATABASE_URL=postgresql://example \ + --env NODE_ENV=production +``` + + + + +**Without rebuilding**: same flag shape, dedicated command. Old version stays live until the new one is healthy. + + + + @looma/prisma-cli + @prisma/compute-cli + + + +```bash +npx @looma/prisma-cli app update-env --env STRIPE_KEY=sk_live_xxx +npx @looma/prisma-cli app list-env +``` + + + + +```bash +bunx @prisma/compute-cli env update --env STRIPE_KEY=sk_live_xxx +bunx @prisma/compute-cli env update --unset-env LEGACY_FLAG +``` + + + + +## Logs + +Stream logs for a specific compute version (or deployment): + + + + @prisma/compute-cli + @looma/prisma-cli + + + +```bash +bunx @prisma/compute-cli logs +bunx @prisma/compute-cli logs --tail 200 +bunx @prisma/compute-cli logs --from-start +bunx @prisma/compute-cli logs --cursor +``` + + + + +```bash +npx @looma/prisma-cli app logs +npx @looma/prisma-cli app logs --deployment +npx @looma/prisma-cli app logs --tail 200 +``` + + + + +EA log limits: ~10-min stream cap (reconnect with `--cursor`), one concurrent stream per version. + +## Limitations + +- Next.js apps must use `output: "standalone"`. +- First-class support for **Next.js** and **Bun/Hono** only. +- `env update` / `app update-env` cuts a new compute version. The old version stays live until the new one is healthy. +- No bulk `.env` import yet, repeat `--env KEY=VALUE` for each variable. +- Logs: 10-min stream cap, one concurrent stream per version. + +## Useful CLI inventory + + + + @looma/prisma-cli + @prisma/compute-cli + + + +```bash +prisma auth login | logout | whoami +prisma project ... +prisma app build | run | deploy | update-env | list-env +prisma app show | open | logs +prisma app list-deploys | show-deploy | promote | rollback | remove +``` + + + + +```bash +compute login | logout +compute deploy [--project --service --service-name --region --path + --entrypoint --build-type auto|bun|nextjs --http-port + --env KEY=VALUE --unset-env KEY + --skip-build --skip-promote --destroy-old-version --json] +compute logs [--tail --from-start --cursor --json] +compute env update [--env --unset-env --http-port] +compute versions list | show | start | stop | promote | delete | destroy +compute services list +compute projects list +``` + + + + +Need a flag that isn't here? Run `--help` on the relevant command. Both CLIs have stable, browsable help output. + +Questions or breakage during EA: `#product-compute`. diff --git a/apps/docs/content/docs/compute/meta.json b/apps/docs/content/docs/compute/meta.json new file mode 100644 index 0000000000..4babcd75f0 --- /dev/null +++ b/apps/docs/content/docs/compute/meta.json @@ -0,0 +1,6 @@ +{ + "title": "Compute", + "root": true, + "icon": "Cpu", + "pages": ["index"] +} diff --git a/apps/docs/content/docs/meta.json b/apps/docs/content/docs/meta.json index 6b7db11405..746bdf60b1 100644 --- a/apps/docs/content/docs/meta.json +++ b/apps/docs/content/docs/meta.json @@ -5,6 +5,7 @@ "(index)", "orm", "postgres", + "compute", "cli", "guides", "studio", diff --git a/apps/docs/src/lib/layout.shared.tsx b/apps/docs/src/lib/layout.shared.tsx index ecad3a97cc..f0884dfadb 100644 --- a/apps/docs/src/lib/layout.shared.tsx +++ b/apps/docs/src/lib/layout.shared.tsx @@ -33,6 +33,11 @@ export const links: LinkItemTypeWithActivePaths[] = [ url: "/postgres", active: "nested-url", }, + { + text: "Compute", + url: "/compute", + active: "nested-url", + }, { text: "CLI", url: "/cli",