Skip to content

Deploy Vercel

Aafff623 edited this page Aug 21, 2026 · 2 revisions

Deploy-and-CDN

生产入口不是三份重复站点,而是一条分层链路:

访客 → www.threetwoa.live → EdgeOne CDN → Vercel origin
文章 / 评论大图 → img.threetwoa.live → Cloudflare R2

主入口:https://www.threetwoa.live

Vercel 备用:https://fork-firefly.vercel.app

平台职责

平台 当前职责 不负责什么
Vercel master 自动构建、SSR/API 源站、海外备用与回滚 不承担主域前置 CDN
EdgeOne www.threetwoa.live CDN、缓存与基础防护,回源 Vercel 当前不是 EdgeOne Pages 主托管
Cloudflare threetwoa.live 权威 DNS、img.threetwoa.live R2 图床 不在主站代理链;不承诺国内加速

当前未备案。EdgeOne 使用全球不含中国大陆的链路,不能写成“中国大陆节点加速完成”。

Vercel 构建事实

Git Aafff623/fork-Firefly · Production branch master
Install pnpm install
Build pnpm build
输出 dist/,含 SSR function 与 Pagefind
Adapter 默认 @astrojs/vercel
配置 vercel.json

vercel.json 还定义分层缓存:HTML 重新验证,/_astro/* 一年 immutable,Pagefind 与普通 assets 分开缓存,/api/* 强制 private / no-store。

EdgeOne

当前生产用的是 CDN 回源:www.threetwoa.live CNAME 到 *.eo.dnse2.com,源站为 Vercel。验收时看:

  1. 主域 HTTPS 200;
  2. 静态 /_astro/* 响应含 eo-cache-status: HIT
  3. HTML / API 不被错误长缓存;
  4. 首页、文章、Pagefind、RSS、Sitemap 可用。

仓库里的 edgeone.jsonEDGEONE=1 pnpm run build:edgeone 是 EdgeOne Pages 历史适配与回归入口,不代表当前云端用 Pages 托管。

Cloudflare 与 R2

  • threetwoa.live 的 NS 在 Cloudflare;主站 www 保持灰云,交给 EdgeOne。
  • img.threetwoa.live 走 Cloudflare R2,自托管文章图与评论大图。
  • R2 桶与服务端凭据只放平台环境变量;Wiki 只记录变量名,不记录值。
  • img.threetwoa.live/ 根路径 404 是空目录的正常表现;应抽查具体对象返回 200、正确 Content-Typecf-cache-status

CF_WORKERS=1 会切 @astrojs/cloudflare adapter,但当前生产主链路不启用。wrangler.jsonc 是兼容配置,不是“Cloudflare 正在托管主站”的证据。

交付闭环

本地预览
→ pnpm check / pnpm type-check / pnpm build
→ push master
→ Vercel Production Ready 且 commit 对齐
→ www.threetwoa.live 首页 / 文章 / Pagefind / API
→ EdgeOne 缓存头
→ R2 具体对象

不要把“本地 build 通过”“Vercel Ready”“主域可访问”混成同一个结论。

环境变量与密钥

  • Ask:MAXKB_ACCESS_TOKEN、可选 MAXKB_API_BASE;当前生产问答关闭。
  • R2:以 .env.exampleR2_* 为准。
  • COS:兼容链仍在,以 .env.exampleCOS_* 为准。
  • Waline 服务在仓外;客户端只放非密钥的 serverURL

相关

Clone this wiki locally