Files
shanxia2.0/docs/superpowers/specs/2026-08-08-prod-deploy-release-design.md
T
2026-08-08 22:19:09 +08:00

26 lines
997 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 生产一键发版脚本设计
日期:2026-08-08
脚本:`生产环境部署/deploy-release.sh`
## 目标
在 macOS 本机一键完成生产环境前后端更新:先前端后后端,发版前备份,保留远程 `web/dist/src`。
## 流程
1. 解析仓库根目录 `生产机器账号密码`(IP + root 密码)
2. 本地 `web-admin` 执行 `pnpm build`(可用 `--skip-build` 跳过)
3. 备份远程 `/iflytek/shanxia2.0/web` → `bak/web-YYYYMMDD-HHMMSS`
4. `rsync --delete --exclude 'src/'` 同步到 `web/dist`
5. 备份远程 `backend` → `bak/backend-YYYYMMDD-HHMMSS`
6. 删除远程 `backend/app`,同步本地 `backend/app`
7. `PORT=9111 WORKERS=1 ENV_FILE=./.env.production ./start-prod.sh restart`
8. `curl http://127.0.0.1:9111/health`
## 约束
- 凭据不写进脚本;`生产机器账号密码` 已加入 `.gitignore`
- 仅替换 `app/`,不覆盖远程 `venv` / `.env.production` / `logs` / `uploads`
- 依赖本机:`ssh`、`rsync`、`sshpass`、`pnpm`