Files
llm-intelligence/DEPLOYMENT.md
phamnazage-jpg dd58c18fe3 docs(project): add production-ready documentation
Add a top-level README plus production configuration, API, and rollout documentation. Also align deployment and runbook docs with the current runtime semantics, ports, and daily pipeline entrypoints.
2026-05-14 19:55:12 +08:00

2.8 KiB
Raw Blame History

LLM Intelligence Hub - 部署指南

版本: v1.1
日期: 2026-05-14
适用版本: Phase 3 / Phase 5

相关文档:

  • README.md:项目入口与常用命令
  • docs/CONFIGURATION.md:环境变量与运行语义
  • docs/PRODUCTION_CHECKLIST.md:上线前检查、发布与回滚

环境要求

硬件

  • CPU: 1核+
  • 内存: 512MB+
  • 磁盘: 5GB+

软件

  • Go 1.22+
  • Node.js 20+
  • PostgreSQL 16+
  • Docker 或 Podman (可选)

快速开始

1. 克隆仓库

git clone <repo-url> llm-intelligence
cd llm-intelligence

2. 配置数据库

# 创建数据库
createdb llm_intelligence

# 运行迁移
psql llm_intelligence < db/migrations/001_phase1_core_tables.sql

3. 配置环境变量

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. 启动后端

go run cmd/server/main.go

5. 启动前端 (开发)

cd frontend
npm install
npm run dev

6. 配置定时任务

crontab -e
# 正式日报调度
0 8 * * * cd /path/to/llm-intelligence && bash scripts/run_daily.sh >> /tmp/llm_hub_cron.log 2>&1

# 真实采集 + 写库 + 报告生成的手动复跑入口
cd /path/to/llm-intelligence && bash scripts/run_real_pipeline.sh

Docker 部署

# 构建
docker build -t llm-hub .

# 或 docker-compose
docker-compose up -d

配置说明

变量 必填 说明
DATABASE_URL PostgreSQL 连接串
OPENROUTER_API_KEY OpenRouter API Key
FEISHU_WEBHOOK 飞书告警 Webhook
PORT API Server 监听端口,默认 8080

验证安装

# 数据库连接
curl http://localhost:8080/health

# 采集器测试
go run scripts/fetch_openrouter.go -strict-real

# 日报生成
go run scripts/generate_daily_report.go

# 运行门禁
bash scripts/verify_phase3.sh
bash scripts/verify_phase5.sh

常见问题

Q: 数据库迁移失败?

确保 PostgreSQL 已启动,且用户有创建表的权限。

Q: 前端构建失败?

检查 Node.js 版本 >= 20npm 版本 >= 10。

Q: 采集器返回模拟数据?

fetch_openrouter.go 在非严格模式下会降级到模拟数据;正式调度和真实流水线默认要求 OPENROUTER_API_KEY、真实写库成功,并会把 run_kind / trigger_source / is_official_daily 写入运行审计。

Q: 历史重建如何执行?

bash scripts/rebuild_historical_report.sh 2025-08-07

历史重建只会回填审计语义,不会冒充当天正式定时产出。


升级路径

  • Phase 2: 告警订阅 / 用户系统 / 付费分析
  • Phase 3: 多数据源 / 自动发现 / ELO评分