Files
llm-intelligence/DEPLOYMENT.md
phamnazage-jpg 77e6610fd2
Some checks failed
CI / test (push) Has been cancelled
chore: prepare repository for publishing
2026-05-13 14:42:45 +08:00

123 lines
2.0 KiB
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.
# LLM Intelligence Hub - 部署指南
> 版本: v1.0
> 日期: 2026-05-10
> 适用版本: Phase 1
---
## 环境要求
### 硬件
- CPU: 1核+
- 内存: 512MB+
- 磁盘: 5GB+
### 软件
- Go 1.22+
- Node.js 20+
- PostgreSQL 16+
- Docker 或 Podman (可选)
---
## 快速开始
### 1. 克隆仓库
```bash
git clone <repo-url> llm-intelligence
cd llm-intelligence
```
### 2. 配置数据库
```bash
# 创建数据库
createdb llm_intelligence
# 运行迁移
psql llm_intelligence < db/migrations/001_phase1_core_tables.sql
```
### 3. 配置环境变量
```bash
export DATABASE_URL="host=/var/run/postgresql dbname=llm_intelligence sslmode=disable"
export OPENROUTER_API_KEY="your-api-key"
export FEISHU_WEBHOOK="your-webhook-url" # 可选
```
### 4. 启动后端
```bash
go run cmd/server/main.go
```
### 5. 启动前端 (开发)
```bash
cd frontend
npm install
npm run dev
```
### 6. 配置定时任务
```bash
crontab -e
# 添加: 0 8 * * * cd /path/to/llm-intelligence && bash scripts/run_daily.sh
```
---
## Docker 部署
```bash
# 构建
docker build -t llm-hub .
# 或 docker-compose
docker-compose up -d
```
---
## 配置说明
| 变量 | 必填 | 说明 |
|------|------|------|
| DATABASE_URL | ✅ | PostgreSQL 连接串 |
| OPENROUTER_API_KEY | ✅ | OpenRouter API Key |
| FEISHU_WEBHOOK | ❌ | 飞书告警 Webhook |
| API_PORT | ❌ | 默认 8080 |
---
## 验证安装
```bash
# 数据库连接
curl http://localhost:8080/health
# 采集器测试
go run scripts/fetch_openrouter.go
# 日报生成
go run scripts/generate_daily_report.go
```
---
## 常见问题
### Q: 数据库迁移失败?
确保 PostgreSQL 已启动,且用户有创建表的权限。
### Q: 前端构建失败?
检查 Node.js 版本 >= 20npm 版本 >= 10。
### Q: 采集器返回模拟数据?
未提供 OPENROUTER_API_KEY 时使用模拟数据,提供 Key 后获取真实数据。
---
## 升级路径
- Phase 2: 告警订阅 / 用户系统 / 付费分析
- Phase 3: 多数据源 / 自动发现 / ELO评分