Harden local-build deploy: never pnpm install while Next is running.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Eric 2026-11-02 00:09:12 +08:00
parent 8edd9a0733
commit 065dd7dc68
2 changed files with 11 additions and 2 deletions

View File

@ -34,6 +34,8 @@ pnpm dev
- `deploy/social/deploy_82.py` 默认堆 **1536MB** + `nice`/`ionice` + 确保 **2G swap**
- 构建失败会回滚上一份 `.next`;构建期间只停 `nomadro.service`
- **禁止**并行多次 SSH / 并发跑 deploy;一次发版一条会话
- **禁止**在 `nomadro.service` 运行中跑 `pnpm install`(会拆坏 `next/.../cookie` → 500)
- 推荐:`pnpm build`(本地)→ `python deploy/social/deploy_local_build_82.py`
生产铁律:[`https://nomadro.cn`](https://nomadro.cn/) / MiroTalk / API / Centrifugo **全部在 `82.157.112.245`**,进房用 `mirotalk.nomadro.cn`。

View File

@ -109,16 +109,23 @@ fi
tar -xzf /tmp/portal_local.tgz --no-same-owner
test -f .next/BUILD_ID
echo BUILD_ID=$(cat .next/BUILD_ID)
# ensure runtime deps present (centrifuge etc) — no next build
# MUST install while nomadro is stopped — live next + pnpm rewrite = ENOENT / 500
export CI=true
export NODE_OPTIONS='--max-old-space-size=1024'
/usr/local/bin/pnpm install --prefer-offline
# sanity: next runtime files must exist
node -e "require('next/package.json')"
test -e node_modules/next/dist/compiled/cookie/index.js \\
|| test -e node_modules/.pnpm/next@*/node_modules/next/dist/compiled/cookie/index.js \\
|| {{ echo 'next cookie missing after install'; exit 4; }}
sudo systemctl reset-failed nomadro.service || true
sudo systemctl start nomadro.service
sleep 5
sleep 6
systemctl is-active nomadro.service
curl -sS -m 12 -o /dev/null -w 'local=%{{http_code}}\\n' http://127.0.0.1:4003/ || true
curl -sS -m 12 -o /dev/null -w 'home=%{{http_code}}\\n' https://nomadro.cn/ || true
curl -sS -m 12 -o /dev/null -w 'social=%{{http_code}}\\n' https://nomadro.cn/social || true
curl -sS -m 12 -o /dev/null -w 'date=%{{http_code}}\\n' https://nomadro.cn/social/date || true
free -h | head -2
echo DONE_LOCAL_DEPLOY
"""