提交
This commit is contained in:
1 parent
683f14828f
commit
fdf7d391a6
40 files changed
+6242
-19470
No files matched your search
+22
-7
@@ -250,20 +250,34 @@ shanxia2.0 的 Nginx 写法**参照 CRM 的代理头、超时、Gzip、SPA fallb
|
||||
|
||||
## 6. 日常运维
|
||||
|
||||
### 6.1 更新后端
|
||||
### 6.0 一键发版(推荐)
|
||||
|
||||
macOS 本机从仓库根目录执行(凭据读自根目录 `生产机器账号密码`,密码不写进脚本):
|
||||
|
||||
```bash
|
||||
./生产环境部署/deploy-release.sh
|
||||
# 已有 dist 时可跳过构建:
|
||||
./生产环境部署/deploy-release.sh --skip-build
|
||||
```
|
||||
|
||||
顺序:本地 `pnpm build` → 备份远程 `web` → 同步 `dist`(**保留**远程 `dist/src`)→ 备份远程 `backend` → 替换 `backend/app` → `PORT=9111 WORKERS=1 ENV_FILE=./.env.production ./start-prod.sh restart` → 健康检查。
|
||||
|
||||
备份落在 `/iflytek/shanxia2.0/bak/web-*` 与 `backend-*`。依赖:`ssh`、`rsync`、`sshpass`(`brew install hudochenkov/sshpass/sshpass`)、`pnpm`。
|
||||
|
||||
### 6.1 更新后端(手工)
|
||||
|
||||
```bash
|
||||
cd /iflytek/shanxia2.0/backend
|
||||
# 上传新代码后
|
||||
./venv/bin/pip install -r requirements.txt
|
||||
PORT=9111 ENV_FILE=./.env.production ./start-prod.sh restart
|
||||
PORT=9111 WORKERS=1 ENV_FILE=./.env.production ./start-prod.sh restart
|
||||
```
|
||||
|
||||
### 6.2 更新前端
|
||||
### 6.2 更新前端(手工)
|
||||
|
||||
```bash
|
||||
# 本地 build 后上传 dist 覆盖
|
||||
rsync -avz --delete web-admin/dist/ root@121.43.228.102:/iflytek/shanxia2.0/web/dist/
|
||||
# 本地 build 后上传 dist;务必保留远程 dist/src
|
||||
rsync -avz --delete --exclude 'src/' web-admin/dist/ root@121.43.228.102:/iflytek/shanxia2.0/web/dist/
|
||||
# 无需重启后端;浏览器强刷或清缓存
|
||||
```
|
||||
|
||||
@@ -314,8 +328,8 @@ systemctl start shanxia2.0-backend
|
||||
|
||||
## 7. 回滚策略
|
||||
|
||||
1. **前端**:保留上一版 `dist` 备份目录,出问题直接 `rsync` 回滚
|
||||
2. **后端**:保留上一版代码目录或 tar 包,`start-prod.sh restart`
|
||||
1. **前端**:`/iflytek/shanxia2.0/bak/web-*` 中对应备份覆盖回 `web`(注意勿误删业务依赖的 `dist/src`)
|
||||
2. **后端**:从 `bak/backend-*` 还原后,在 `backend` 目录执行 `PORT=9111 WORKERS=1 ENV_FILE=./.env.production ./start-prod.sh restart`
|
||||
3. **数据库**:增量 SQL 应可逆或先备份;重大变更前 `mysqldump`
|
||||
|
||||
---
|
||||
@@ -334,6 +348,7 @@ systemctl start shanxia2.0-backend
|
||||
| 文件 | 用途 |
|
||||
|---|---|
|
||||
| `README.md` | 本文档 |
|
||||
| `deploy-release.sh` | macOS 一键发版(前端→后端,含备份与健康检查) |
|
||||
| `nginx-shanxia2.0.conf` | Nginx 站点模板 |
|
||||
| `backend.env.production.example` | 后端生产环境变量模板 |
|
||||
| `web-admin.env.production.example` | 前端构建环境变量模板 |
|
||||
|
||||
Reference in new issue
Block a user