lovart3/最终部署报告.md
2025-12-17 20:15:18 +08:00

147 lines
3.1 KiB
Markdown
Raw Permalink 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.

# 最终部署报告
## ✅ 部署完成状态
### 应用部署
- ✅ **应用已部署**: `/var/www/ai-chatbot`
- ✅ **应用运行中**: PM2 管理,状态 online
- ✅ **端口监听**: 3001 端口正常监听
- ✅ **本地访问**: `http://localhost:3001` 正常响应
### FRPC 穿透配置
- ✅ **配置已添加**: `/etc/frp/frpc.ini`
- ✅ **穿透服务启动**: `[ai-chatbot] start proxy success`
- ✅ **本地端口**: 127.0.0.1:3001
- ✅ **远程端口**: 5245
## 🌐 访问信息
### 本地访问(服务器内部)
```
http://localhost:3001
```
**状态**: ✅ 正常
### 穿透访问(外部)
```
http://156.225.27.52:5245
```
**状态**: ⚠️ 需要测试(FRPC已启动,但外部访问可能受防火墙限制)
### 直接访问(如果80端口开放)
```
http://156.225.27.52
```
**状态**: 需要配置 Nginx
## 📋 当前配置
### 应用配置
- **运行模式**: 开发模式 (`next dev`)
- **端口**: 3001
- **PM2配置**: `/var/www/ai-chatbot/ecosystem.config.js`
### FRPC 配置
```ini
[ai-chatbot]
name = ai-chatbot
type = tcp
local_ip = 127.0.0.1
local_port = 3001
remote_port = 5245
```
### 数据库配置
- **数据库**: ai_chatbot
- **用户**: chatbot_user
- **连接**: localhost:5432
## ⚠️ 已知问题
1. **构建问题**: 生产构建因 settings 页面预渲染错误失败
- **当前方案**: 使用开发模式运行
- **影响**: 性能较低,但功能正常
2. **外部访问**: 如果 `http://156.225.27.52:5245` 无法访问
- **可能原因**: FRP 服务器端未开放 5245 端口
- **解决方案**: 检查 FRP 服务器配置或使用 Nginx 反向代理
## 🔧 故障排查
### 如果外部无法访问
1. **检查 FRP 服务器端配置**:
- 确保 FRP 服务器(156.225.27.52)开放了 5245 端口
- 检查 FRP 服务器防火墙规则
2. **使用 Nginx 反向代理**(推荐):
```bash
# 配置 Nginx 直接代理到 3001 端口
# 然后通过 http://156.225.27.52 访问
```
3. **检查应用状态**:
```bash
pm2 status ai-chatbot
pm2 logs ai-chatbot
```
4. **检查 FRPC 状态**:
```bash
systemctl status frpc.service
journalctl -u frpc.service -f
```
## 📝 管理命令
### 应用管理
```bash
# 查看状态
pm2 status ai-chatbot
# 查看日志
pm2 logs ai-chatbot
# 重启
pm2 restart ai-chatbot
# 停止
pm2 stop ai-chatbot
```
### FRPC 管理
```bash
# 查看状态
systemctl status frpc.service
# 重启
systemctl restart frpc.service
# 查看日志
journalctl -u frpc.service -f
```
### 更新部署
```bash
cd /var/www/ai-chatbot
# 上传新代码后
pnpm install
pnpm db:migrate
pm2 restart ai-chatbot
```
## 🎯 下一步建议
1. **修复构建问题**: 解决 settings 页面预渲染错误,使用生产模式
2. **配置 Nginx**: 设置反向代理,提供更稳定的访问
3. **配置 SSL**: 使用 Let's Encrypt 配置 HTTPS
4. **监控设置**: 配置应用监控和日志收集
## 📞 支持信息
- **服务器**: 156.225.27.52:5204
- **应用目录**: /var/www/ai-chatbot
- **日志位置**: /var/log/pm2/
- **配置文件**: /var/www/ai-chatbot/.env.local