ai-chatbot/部署完成总结.md
Your Name 53ddb7e585
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
Initial commit - clean repository
2025-12-17 20:15:18 +08:00

146 lines
3.4 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.

# 部署完成总结
## ✅ 部署状态
### 应用部署
- **应用名称**: AI Chatbot
- **部署路径**: `/var/www/ai-chatbot`
- **运行端口**: `3001` (已修改,避免与3000端口冲突)
- **进程管理**: PM2
- **状态**: ✅ 运行中
### FRPC 穿透配置
- **配置名称**: `ai-chatbot`
- **本地地址**: `127.0.0.1:3001`
- **远程端口**: `5245`
- **穿透类型**: TCP
- **状态**: ✅ 已启动成功
## 🌐 访问地址
### 通过穿透访问(推荐)
- **穿透地址**: `http://156.225.27.52:5245`
- **管理员设置**: `http://156.225.27.52:5245/admin/settings`
### 直接访问(如果服务器开放80端口)
- **直接地址**: `http://156.225.27.52`
- **管理员设置**: `http://156.225.27.52/admin/settings`
## 📋 配置信息
### 数据库配置
- **数据库名**: `ai_chatbot`
- **用户名**: `chatbot_user`
- **密码**: `ChatBot@2024!Secure`
- **主机**: `localhost:5432`
### 环境变量
- **配置文件**: `/var/www/ai-chatbot/.env.local`
- **AUTH_URL**: `http://156.225.27.52`
## 🔧 管理命令
### PM2 管理
```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
# 查看配置
cat /etc/frp/frpc.ini
```
### 应用管理
```bash
# 进入项目目录
cd /var/www/ai-chatbot
# 查看日志
tail -f /var/log/pm2/ai-chatbot-out.log
tail -f /var/log/pm2/ai-chatbot-error.log
# 更新代码后重新部署
pnpm install
pnpm db:migrate
pnpm build
pm2 restart ai-chatbot
```
## 📝 配置文件位置
- **应用配置**: `/var/www/ai-chatbot/ecosystem.config.js`
- **环境变量**: `/var/www/ai-chatbot/.env.local`
- **FRPC配置**: `/etc/frp/frpc.ini`
- **FRPC备份**: `/etc/frp/frpc.ini.backup`
## ⚠️ 注意事项
1. **端口冲突**: 应用已从3000端口改为3001端口,因为3000端口被其他服务占用
2. **数据库密码**: 请尽快修改数据库密码以提高安全性
3. **服务器密码**: 建议修改SSH密码并配置密钥登录
4. **防火墙**: 确保FRP服务器端开放了5245端口
5. **SSL证书**: 建议配置HTTPS以提高安全性
## 🔍 故障排查
### 应用无法访问
1. 检查应用状态: `pm2 status ai-chatbot`
2. 检查端口监听: `ss -tlnp | grep 3001`
3. 查看应用日志: `pm2 logs ai-chatbot`
### 穿透不工作
1. 检查FRPC状态: `systemctl status frpc.service`
2. 查看FRPC日志: `journalctl -u frpc.service -n 50`
3. 检查配置: `cat /etc/frp/frpc.ini | grep ai-chatbot`
### 数据库连接失败
1. 检查PostgreSQL服务: `systemctl status postgresql`
2. 测试连接: `psql -U chatbot_user -d ai_chatbot`
3. 检查环境变量: `cat /var/www/ai-chatbot/.env.local`
## 📊 当前服务状态
### 运行中的服务
- ✅ ai-chatbot (端口: 3001)
- ✅ shebeiguanli-api (端口: 3000)
- ✅ shebeiguanli-frontend
- ✅ shebeiguanli-keycloak
### FRPC 穿透服务
- ✅ ai-chatbot (本地:3001 → 远程:5245)
- ✅ http044 (SSH)
- ✅ bt-panel (宝塔面板)
- ✅ ai-classification
- ✅ performance-api
- ✅ qwen-api
- ✅ weipinghui-parser
- ✅ shebeiguanli-frontend
- ✅ shebeiguanli-backend
## 🎉 部署完成
项目已成功部署并配置FRPC穿透!
**访问地址**: http://156.225.27.52:5245