后端管理模块部署

This commit is contained in:
2025-10-30 16:55:22 +08:00
parent 093d07ab76
commit 8f2133f3af
16 changed files with 649 additions and 52 deletions
+44 -6
View File
@@ -17,13 +17,14 @@
### 基本用法
```bash
# 部署所有服务(后端 + 前端)
# 部署所有服务(后端 + 前端 + 管理后台
bash deploy-all.sh
# 或指定部署类型
bash deploy-all.sh all # 部署所有服务
bash deploy-all.sh backend # 仅部署后端
bash deploy-all.sh frontend # 仅部署前端
bash deploy-all.sh admin # 仅部署管理后台
```
### 完整部署流程
@@ -39,6 +40,7 @@ bash deploy-all.sh
# 4. 访问应用
# 前端: http://101.200.208.45/emotion-museum/
# 管理后台: http://101.200.208.45/emotion-museum-admin/
# 后端: http://101.200.208.45:19089/api
```
@@ -64,6 +66,12 @@ bash deploy-all.sh frontend
```
仅更新前端应用,适用于前端代码更新。
### 仅部署管理后台
```bash
bash deploy-all.sh admin
```
仅更新管理后台,适用于管理后台代码更新。
## 📊 部署流程详解
### 后端部署流程
@@ -78,11 +86,21 @@ bash deploy-all.sh frontend
### 前端部署流程
1. 检查 `web/deploy.sh` 是否存在
2. 执行前端部署脚本
- 检查 `dist` 目录是否存在
- 构建前端项目 (`npm run build`)
- 上传 `index.html` 到服务器
- 上传 `assets` 目录到服务器
- 验证文件是否上传成功
### 管理后台部署流程
1. 检查 `web-admin/deploy.sh` 是否存在
2. 执行管理后台部署脚本
- 构建管理后台项目 (`npm run build`)
- 创建远程目录
- 上传 `index.html` 到服务器
- 上传 `assets` 目录到服务器
- 设置文件权限
- 验证文件是否上传成功
## ✅ 验证部署
### 部署完成后的验证
@@ -94,8 +112,12 @@ curl http://101.200.208.45:19089/api/health
# 2. 检查前端是否可访问
curl http://101.200.208.45/emotion-museum/
# 3. 在浏览器中访问
# 3. 检查管理后台是否可访问
curl http://101.200.208.45/emotion-museum-admin/
# 4. 在浏览器中访问
# 前端: http://101.200.208.45/emotion-museum/
# 管理后台: http://101.200.208.45/emotion-museum-admin/
# 登录页面应该正常显示
```
@@ -110,6 +132,9 @@ tail -f /data/logs/emotion-museum/emotion-single.log
# 查看前端文件是否存在
ls -lh /data/www/emotion-museum/
# 查看管理后台文件是否存在
ls -lh /data/www/emotion-museum-admin/
```
## 🔧 故障排查
@@ -174,7 +199,7 @@ bash deploy-all.sh frontend
**解决方案**:
```bash
# 1. 检查 Nginx 配置
# 1. 检查 Nginx 配置 (www/server/panel/vhost/nginx/emotion-museum.conf )
ssh root@101.200.208.45 "nginx -t"
# 2. 重新加载 Nginx
@@ -248,10 +273,21 @@ bash deploy-all.sh frontend
# http://101.200.208.45/emotion-museum/
```
### 场景 3: 同时更新前后端
### 场景 3: 仅更新管理后台代码
```bash
# 1. 修改前后端代码
# 1. 修改管理后台代码
# 2. 执行部署
bash deploy-all.sh admin
# 3. 在浏览器中刷新页面
# http://101.200.208.45/emotion-museum-admin/
```
### 场景 4: 同时更新所有服务
```bash
# 1. 修改前后端和管理后台代码
# 2. 执行部署
bash deploy-all.sh all
@@ -264,8 +300,10 @@ bash deploy-all.sh all
如有问题,请参考以下文件:
- `backend-single/部署说明.md` - 后端部署详情
- `web/部署说明.md` - 前端部署详情
- `web-admin/部署说明.md` - 管理后台部署详情
- `backend-single/deploy.sh` - 后端部署脚本
- `web/deploy.sh` - 前端部署脚本
- `web-admin/deploy.sh` - 管理后台部署脚本
---