Skip to content

Deployments

Pull requests run CI. A successful CI run on main deploys that exact commit to Preview. For Production, manually dispatch the deploy workflow with production. The workflow applies D1 migrations first, then deploys the Preview large-archive scanner, pipeline, API, web, admin, and docs. The large-archive consumer and regular scanner use the same source commit so their rules and scanner fingerprints stay aligned. The large-archive consumer is deployed only when the target is preview.

These commands mirror the Preview workflow. The web and admin builds select their target through CLOUDFLARE_ENV. Wrangler deploys those apps using the generated configuration.

终端窗口
pnpm install --frozen-lockfile
CLOUDFLARE_ENV=preview pnpm build
pnpm --filter @dshu/api exec wrangler d1 migrations apply DB --remote --env preview
pnpm --filter @dshu/api exec wrangler d1 execute DB --remote --env preview --command 'PRAGMA optimize'
pnpm --filter @dshu/pipeline exec wrangler deploy --config wrangler.large-preview.jsonc
pnpm --filter @dshu/pipeline exec wrangler deploy --env preview
pnpm --filter @dshu/api exec wrangler deploy --env preview
pnpm --filter @dshu/web exec wrangler deploy
pnpm --filter @dshu/admin exec wrangler deploy
pnpm --filter @dshu/docs exec wrangler deploy --env preview

A migration failure stops the release immediately. The subsequent PRAGMA optimize statistics maintenance runs separately. Only D1 overload error 7429 is retried, for at most four attempts with approximately 5, 10, and 20 seconds of exponential backoff plus jitter. Authentication, syntax, process errors, and exhausted retries still stop the release. Maintenance retries do not repeat migrations or bypass statistics maintenance.

Identify the affected Worker and a compatible earlier version in Cloudflare. For Preview web, run pnpm --filter @dshu/web exec wrangler rollback "$VERSION_ID" --name dshu-preview-web. Confirm the active version and repeat the release checks. Handle D1 migrations and KV data through their own recovery procedures. See Cloudflare versions and deployments.

  • Confirm the commit and deployed Worker versions.
  • Check API /healthz, both index schemas, and ETag revalidation.
  • Check the catalog home and a plugin page, robots.txt, sitemap, and llms.txt. Verify documentation pages and their Markdown in both languages.
  • Check noindex on Preview web and docs, Worker errors, and the scan queue. Check signed-in admin operations once Preview authentication is configured.

See database migrations and incident runbooks.