final version

This commit is contained in:
2026-02-18 23:39:39 +08:00
parent 72ab0c0b56
commit 32d0bca5f9
3975 changed files with 781 additions and 1106509 deletions

View File

@@ -2,53 +2,25 @@
## 系统要求
- Docker 和 Docker Compose
- 或者 Python 3.8+ 和 Node.js 18+
- Python 3.8+ 和 Node.js 18+
- 或者 Docker 和 Docker Compose
## 部署选项
## 本地开发模式
### 选项1Docker Compose 部署(推荐)
#### 完整部署(适用于网络良好环境)
```bash
# 进入部署目录
cd deploy
# 运行部署脚本
./deploy.sh
```
#### 网络受限环境部署
```bash
# 手动拉取镜像
docker pull postgres:14-alpine
docker pull redis:7-alpine
docker pull minio/minio:latest
docker pull python:3.9-slim
docker pull node:18-alpine
# 使用预拉取镜像的Compose文件
docker-compose -f compose-without-build.yml up -d
```
### 选项2本地开发模式
#### 后端服务
### 后端服务
```bash
# 进入后端目录
cd backend
# 安装依赖
pip install -r requirements.txt
# 激活虚拟环境
source venv/bin/activate
# 启动服务
uvicorn app.main:app --reload
python -m uvicorn app.main:app --host 0.0.0.0 --port 8001 --reload
```
#### 前端服务
### 前端服务
```bash
# 进入前端目录
@@ -61,30 +33,7 @@ npm install
npm run dev
```
## 服务地址
部署完成后,可通过以下地址访问服务:
- **前端应用**: http://localhost:3000
- **后端API**: http://localhost:8000
- **API文档**: http://localhost:8000/docs
- **MinIO控制台**: http://localhost:9001 (admin/minioadmin)
- **PostgreSQL**: localhost:5432
- **Redis**: localhost:6379
## 环境配置
### Docker环境变量
创建 `.env` 文件:
```bash
# 在 deploy 目录下创建 .env 文件
OPENAI_API_KEY=your_openai_api_key_here
SECRET_KEY=your_secret_key_here
```
### 本地开发环境变量
### 环境配置
在本地开发时,可以创建 `.env` 文件:
@@ -105,13 +54,83 @@ ACCESS_TOKEN_EXPIRE_MINUTES=30
```bash
# frontend/.env
VITE_API_BASE_URL=http://localhost:8000/api
VITE_API_BASE_URL=http://localhost:8001/api
```
## 服务地址
部署完成后,可通过以下地址访问服务:
- **前端应用**: http://localhost:3000
- **后端API**: http://localhost:8001
- **API文档**: http://localhost:8001/docs
- **MinIO控制台**: http://localhost:9001 (admin/minioadmin)
- **PostgreSQL**: localhost:5432
- **Redis**: localhost:6379
## 验证部署
### 检查服务状态
```bash
# 检查后端服务
curl http://localhost:8001/health
# 检查前端服务
curl http://localhost:3000
```
### API测试
```bash
# 测试健康检查
curl http://localhost:8001/health
# 测试算法API
curl http://localhost:8001/api/v1/algorithms
# 测试API文档
open http://localhost:8001/docs
```
## Docker Compose 部署
### 完整部署(适用于网络良好环境)
```bash
# 进入部署目录
cd deploy
# 运行部署脚本
./deploy.sh
```
### 网络受限环境部署
```bash
# 手动拉取镜像
docker pull postgres:14-alpine
docker pull redis:7-alpine
docker pull minio/minio:latest
docker pull python:3.9-slim
docker pull node:18-alpine
# 使用预拉取镜像的Compose文件
docker-compose -f compose-without-build.yml up -d
```
### Docker环境变量
创建 `.env` 文件:
```bash
# 在 deploy 目录下创建 .env 文件
OPENAI_API_KEY=your_openai_api_key_here
SECRET_KEY=your_secret_key_here
```
### Docker服务状态检查
```bash
# Docker Compose 环境
docker-compose -f docker-compose-full.yml ps
@@ -121,22 +140,7 @@ docker-compose -f docker-compose-full.yml logs backend
docker-compose -f docker-compose-full.yml logs frontend
```
### API测试
```bash
# 测试健康检查
curl http://localhost:8000/health
# 测试算法API
curl http://localhost:8000/api/v1/algorithms
# 测试API文档
open http://localhost:8000/docs
```
## 常用命令
### Docker Compose 管理
## Docker常用命令
```bash
# 启动所有服务
@@ -155,18 +159,6 @@ docker-compose -f docker-compose-full.yml logs -f
docker-compose -f docker-compose-full.yml restart backend
```
### 本地开发
```bash
# 后端开发
cd backend
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
# 前端开发
cd frontend
npm run dev -- --host 0.0.0.0 --port 3000
```
## 故障排除
如果遇到问题,请参考 [TROUBLESHOOTING.md](TROUBLESHOOTING.md) 文档。
@@ -210,4 +202,4 @@ services:
- **开发环境**: 使用较低的资源限制,启用热重载
- **测试环境**: 适度的资源配置,禁用不必要的日志
- **生产环境**: 充足的资源,启用监控和日志聚合
- **生产环境**: 充足的资源,启用监控和日志聚合