chore: v2.1.2 部署到 Cloudflare Workers(wmailhub.adx9.com)
- console/wrangler.jsonc 填入真实 D1 id + 自定义域名 routes.custom_domain + PUBLIC_BASE_URL - README 生产部署章节补线上实例与自检命令(含 database_id 占位会导致 Invalid uuid 的坑) - 版本号 2.1.1 -> 2.1.2
This commit is contained in:
@@ -105,12 +105,17 @@ WmailHub/
|
||||
|
||||
## 生产部署(Cloudflare Workers)
|
||||
|
||||
1. `bunx wrangler d1 create wmailhub` → 将 `database_id` 填入 `console/wrangler.jsonc`
|
||||
线上实例:**https://wmailhub.adx9.com**(Worker `wmailhub-console`,自定义域名由 wrangler `routes.custom_domain` 自动建 DNS + 签证书)。
|
||||
|
||||
1. `bunx wrangler d1 create wmailhub` → 将 `database_id` 填入 `console/wrangler.jsonc`(线上:`cfc47e65-c71e-470f-96db-5bc23e3e31a4`)
|
||||
2. `bunx wrangler r2 bucket create wmailhub`
|
||||
3. 依次执行 `bunx wrangler d1 execute wmailhub --remote --file=./migrations/0001_init.sql`、`0002_accounts_webhooks.sql`、`0003_mail_link_v2.sql`
|
||||
3. 依次执行 `bunx wrangler d1 execute wmailhub --remote --file=./migrations/0001_init.sql` … `0004_single_key_markdown.sql`(0001~0004 按序号全部执行,0004 依赖 0001 的 api_credentials)
|
||||
4. `cd console && bunx wrangler deploy`(前端先 `bun run build`);`PUBLIC_BASE_URL` 即 Email Worker 注入的 CONSOLE_URL
|
||||
5. `bunx wrangler secret put SESSION_SECRET --config console/wrangler.jsonc`(≥32 位随机串)
|
||||
6. Cloudflare Dashboard 创建 OAuth App(client id/secret),配置 `CF_OAUTH_CLIENT_ID/SECRET` vars 与回调 `<PUBLIC_BASE_URL>/api/oauth/cloudflare/callback`;未配置时自动进入 sim 模式(仅供本地)
|
||||
6. Cloudflare Dashboard 创建 OAuth App(client id/secret),配置 `CF_OAUTH_CLIENT_ID/SECRET` vars 与回调 `https://wmailhub.adx9.com/api/oauth/cloudflare/callback`;未配置时自动进入 sim 模式(仅供本地)
|
||||
|
||||
> 提示:`wrangler.jsonc` 里的 `database_id` 必须先填真实值,否则 `d1 execute` / `deploy` 都会报 `Invalid uuid`。
|
||||
> 部署后自检:`curl https://wmailhub.adx9.com/api/health` → `{"ok":true,"name":"WmailHub","version":"<package.json 版本>"}`。
|
||||
|
||||
Cron(`*/1 * * * *`)驱动 TTL 清理与 Webhook 重试;Email Worker 由 Console provisioning 自动上传(无需手工部署),catch-all 规则在「域名 → 设置 Email Workers」时自动配置。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user