Deploy and operate
This page is the production checklist for a Mantle Worker on Cloudflare: what to pin and configure, which checks to run before wrangler deploy, how to verify a deployment, how content is operated afterwards, and how to upgrade.
Before the first deploy
- Pin every
@aotter/mantle*package to one exact version and commit the lockfile. Install withpnpm install --frozen-lockfile(ornpm ci) from then on. See Project and CLI. - Set
PUBLIC_ORIGINto the real HTTPS origin, without a trailing slash. It drives canonical URLs,.mdmirrors,llms.txt, the MCP resource and the OAuth callback. If a static documentation build also emits absolute URLs, give it the same value. - Set the production D1
database_id(andaccount_idif your deployment needs it) inwrangler.jsonc. A localdatabase_nameis not a production identifier, and local data is not migrated. - Choose
MANTLE_AUTH_MODEand store the secrets withwrangler secret put. See Authentication. - Keep
compatibility_flags: ["nodejs_compat", "global_fetch_strictly_public"]. - Enable observability:
"observability": { "enabled": true, "logs": { "head_sampling_rate": 1 } },
"upload_source_maps": trueThe check loop
Run the project's check script before every deploy. The minimal reference chains:
mantle generate && mantle generate --check && mantle validate \
&& mantle skills && mantle skills --check && tsc --noEmit && node smoke.mjsAdd tests and the frontend build where the project has them, then confirm index coverage for every public View:
pnpm exec mantle-harness indexes --require-public --format textA required path fails on an entries table scan, a temporary sort or an unindexed data-field predicate. Then dry-run and deploy:
wrangler deploy --dry-run
wrangler deployPost-deploy verification
Probe the deployed origin, not wrangler dev:
| Probe | Expect |
|---|---|
GET /api/views/<public-view> | 200, { "ok": true, "data": { "rows": [...] } } |
GET /<locale>/<segment>/<slug> and GET /<locale>/<segment>/<slug>.md | 200 HTML and Markdown for a published entry |
GET /llms.txt, GET /sitemap.xml, GET /robots.txt | 200 |
GET /<locale>/<segment>/does-not-exist | 404 from your notFoundRenderer |
GET /mcp without credentials | 401 with WWW-Authenticate |
GET /admin | Sign-in page; sign in with the ADMIN_GITHUB_LOGIN account |
Then check the cache: a second anonymous GET of a public page should show cf-cache-status: HIT; publish a change in Admin and the next request should be a MISS. Sample latency with:
pnpm exec mantle-harness http --base-url https://example.com \
--route recent=/api/views/recent-posts --route page=/en/posts/hello --rounds 20 --warmup 2Operating content
Sign in to Admin with a staff account. Publishing collections (lifecycle: publishing) follow draft, publish, verify:
- Create a draft with its title, slug, locale and body.
- Publish (
editoror above). The write purges the deployment-scoped public cache tag. - Open the public URL and its
.mdmirror. Drafts never appear on pages, mirrors,llms.txtor the sitemap; use?preview=1with a staff session to see one. - Unpublish removes the entry from every public surface; the Admin delete action and the Staff MCP
archive_entrytool retire it.
Operational collections (lifecycle: operational) have no publish step; records are edited in place and do not purge the public cache. The same operations are available to agents through Staff MCP; see MCP and agents.
Site settings split by owner. Brand, title and description seed once from siteDefaults and are then edited in Admin (owner); each edit purges the public cache. Origin, icons, locales and media purposes are code-owned and re-sync from siteDefaults on every boot, so change them in the Worker and redeploy. See Site config.
Upgrading
Read the migration notes shipped with the target release before changing versions; docs on the development branch do not describe your installed version. The 0.1.2 line removes mantle create, the bundle mantle update and @aotter/mantle/provision; generate, validate, emit-openapi and skills remain. To upgrade:
- Pin the new exact release for every selected package and update the lockfile through the package manager; review peer upgrades.
- Remove scripts that call retired commands. Keep application source, Worker/D1/KV identity, origins, auth mode and secrets.
- Run
mantle generate,generate --check,skills,skills --check,validate, typecheck and tests. - Test local routes and authorization, then deploy.
Source
packages/mantle/README.mdpackages/adapters/cloudflare/README.mddocs/direct-authoring.mddocs/migration-0.1.2.mddocs/performance-harness.mddocs/examples/minimal-worker/README.mddocs/examples/minimal-worker/package.jsondocs/examples/minimal-worker/wrangler.jsoncdocs/examples/minimal-worker/smoke.mjspackages/mantle-spec/src/domain/model/SiteConfig.tspackages/mantle-admin/src/mountMantleAdmin.tspackages/adapters/cloudflare/src/oauth/cachePolicy.ts