Skip to content

fix(release): move the release mirror out of the website dist - #2150

Merged
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:bob/release-mirror-outside-dist
Aug 7, 2026
Merged

fix(release): move the release mirror out of the website dist#2150
bobleer merged 1 commit into
GCWing:mainfrom
bobleer:bob/release-mirror-outside-dist

Conversation

@bobleer

@bobleer bobleer commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

问题

发布镜像目录原本是 BitFun-Website/dist/releasenpm run build 会清空 dist/,所以每次网站部署都会删掉整个镜像——2.3 GB 的安装包和 latest.json / downloads.json / linux-binaries.json / relay-image.json 全部消失。

后果:

  • 官网下载按钮 404
  • Tauri updater 的 openbitfun.com 兜底端点 404(GitHub 不可达时客户端无法更新)
  • 直到下一次 cron 同步(最多 10 分钟)才恢复,且要从 GitHub 重新拉 2.3 GB

今天更新官网时踩到了,已在生产环境验证复现。

改动

WEBSITE_RELEASE_DIR 改为 /srv/bitfun-release(构建产物之外),并允许环境变量覆盖。nginx 通过 location ^~ /release/ alias 指向该目录,公开 URL 完全不变

^~ 前缀用于阻止下方 ~* \.(js|css|png|...)$ 那条 immutable 缓存 regex 抢匹配。

生产环境已完成的操作

  1. 暂停 release-sync cron
  2. mv/srv/bitfun-release(同文件系统,瞬时;迁移前后文件列表+大小逐项比对一致)
  3. nginx 加 location ^~ /release/nginx -t 通过后 reload
  4. 部署本 PR 的脚本(与仓库版本 md5 一致)
  5. 手动跑一次同步:exit 0,所有资产 Already exists(无丢失、无重新下载)
  6. 恢复 cron,与迁移前 diff 一致
  7. 重新构建网站验证:/srv/bitfun-release 完好,/release/* 全部 200/206

验证

  • node --test scripts/linux-binaries-manifest.test.mjs → 9/9 通过
  • 线上:首页 200,/release/latest.json /release/downloads.json /release/linux-binaries.json /release/relay-image.json.sig 均 200,/release/0.2.16/bitfun-installer.exe range 请求 206,目录遍历 403

遗留

nginx 站点配置 /etc/nginx/sites-available/openbit.fun 目前只存在于服务器上,未纳入任何仓库版本管理(本次改动只能靠这条 PR 描述留痕)。是否要像 deploy/miniapp-market/ 那样把它收进仓库,另议。

The release mirror lived in BitFun-Website/dist/release. `npm run build`
empties dist/, so every website deploy deleted the mirrored installers and
manifests — downloads and the updater fallback 404'd until the next cron
sync re-downloaded ~2.3 GB from GitHub.

Point WEBSITE_RELEASE_DIR at /srv/bitfun-release instead, outside any build
output, and let the environment override it. nginx serves that directory
through a `location ^~ /release/` alias, so the public URLs are unchanged.
@bobleer
bobleer merged commit 5733f25 into GCWing:main Aug 7, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant