---
title: "自托管"
description: "在你的 Cloudflare account 中将 Vonvon 部署为 3 个隔离的 Workers，并配置完整的 data、queue、consistency、email、routing 和 production-control inventory。"
locale: "zh-Hans"
---

> Documentation Index
> Fetch the relevant documentation index at: https://vonvon.id/zh-hans/llms.txt
> Use this file to discover all available pages before exploring further.

# 自托管

## 必需绑定

| 绑定 | 用途 |
| --- | --- |
| `vonvon-site, vonvon-console, vonvon` | 部署 3 个 Workers：Nimbus Site 负责 apex 文档站和 www redirect，Console 负责 /dash，Core 负责 Hosted Auth、protocols、APIs、jobs 和 identity state。Site 与 Console 仅绑定 ASSETS。 |
| `DB, CACHE, STORAGE` | Core 使用 D1 存储 tenant-scoped relational data，KV 仅用于 read-heavy caches，R2 用于 private objects。strongly consistent state 绝不属于 KV。 |
| `EMAIL, ANALYTICS, SITE_WORKER, CONSOLE_WORKER, ASSETS` | Core 绑定 Email Service 和 Analytics Engine，并通过指向 Site 和 Console 的单向 Service Bindings 处理 exact-route query fallback。Frontend Workers 绝不反向绑定 Core。 |
| `SESSION_REVOCATION, WEBAUTHN_CHALLENGE, OAUTH_STATE, PAR_STORE, DEVICE_FLOW, RATE_LIMITER, AUDIT_SEQ, METERING, GUEST_STORE, CIBA_STATE, IMPERSONATION_GRANTS` | 11 个基于 SQLite 的 Durable Objects 对 sessions、challenges、OAuth、PAR、device 和 CIBA state、rate limits、audit order、metering、guests 及 impersonation grants 进行串行化。 |
| `vonvon-email, vonvon-whatsapp, vonvon-sms, vonvon-audit, vonvon-webhook, vonvon-metering, vonvon-scim-sync, vonvon-privacy` | 8 个 source Queues 将 email、WhatsApp、SMS、audit、webhook、metering、outbound SCIM 和 privacy 工作移出 authentication paths。 |
| `8 source DLQs + 8 persistence-failure Queues` | 每个 source Queue 都需要自己的 dead-letter Queue 和 persistence-failure quarantine，共计 24 个 Queues。共享的 vonvon-dlq 已废弃，不得使用。 |

## Production 配置

| 密钥 | 用途 |
| --- | --- |
| `KEK, PEPPER, BOOTSTRAP_TOKEN` | Production 和 staging 环境要求将 KEK、PEPPER 和 BOOTSTRAP\_TOKEN 配置为 Workers Secrets。绝不要将它们放入 variables、D1、source files 或 build logs。 |
| `EMAIL_FROM_ADDRESS, EMAIL_FROM_NAME` | 明确设置非 secret 发件人身份。Vonvon 会验证地址并 fail closed。向任意收件人发送 Email 需要 Workers Paid；D1、基于 SQLite 的 Durable Objects 和 Queues 在各自限制内可用于 Workers Free。 |
| `TURNSTILE_SITE_KEY + TURNSTILE_SECRET; CLOUDFLARE_FOR_SAAS_*` | 将 Turnstile 配置为完整的 site-key 和 secret 配对。可选的 Cloudflare for SaaS hostnames 需要 zone、API token、可用的 fallback origin、DNS 和 routes。Zone WAF 与 edge rate limiting 仍是独立控制；应用限流在 RATE\_LIMITER 中 fail closed。 |

## 部署检查

在宣告 production ready 之前，请核对全部 24 个 Queues，应用 D1 migrations，构建全部 3 个 Workers，并验证 apex、www、wildcard DNS、health、discovery、JWKS 和 Hosted Auth。然后记录 Email、DLQ replay、privacy export 和 30-day erasure、每小时和每日 Cron、Analytics、Turnstile 及 custom hostnames 的在线证据。本地 L0-L3 证据不等于 L4；所有未执行的在线检查均为 UNKNOWN。完整的运维 runbook 位于 https://github.com/StringKe/vonvon/blob/main/docs/deployment.md。

```shell
pnpm install
pnpm run cloudflare:queues:plan
pnpm run cloudflare:queues:create
pnpm run cloudflare:queues:check
pnpm check
pnpm test
pnpm build
pnpm smoke:l2-l3
pnpm smoke:three-workers

# Merge a reviewed, signed commit to main so Cloudflare Workers Builds deploys all three Workers.
curl https://<your-domain>/v1/health
curl https://<your-domain>/.well-known/openid-configuration
curl https://<your-domain>/jwks
curl https://<your-domain>/auth/config
curl -I https://www.<your-domain>/
```

Source: https://vonvon.id/zh-hans/self-hosting/index.mdx
