Skip to content

Commit abb6154

Browse files
blankzshclaude
andcommitted
feat: 统一修改应用端口为8081
🔧 端口配置统一 - 将所有应用端口从8000修改为8081 - 更新Docker配置文件端口映射 - 修改部署脚本中的端口引用 - 统一文档中的端口说明 📦 修改文件 - docker-compose.yml: 服务端口映射 - Dockerfile: 容器暴露端口 - docker.env: 环境变量配置 - deploy.sh/deploy.bat: 部署脚本端口 - README.md: 文档中的端口引用 - DOCKER.md: Docker部署文档 🎯 影响范围 - API服务: http://localhost:8081 - API文档: http://localhost:8081/docs - 健康检查: http://localhost:8081/health 🔄 确保配置一致性 所有相关文件已同步更新,避免端口冲突问题。 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent cae1207 commit abb6154

File tree

7 files changed

+39
-39
lines changed

7 files changed

+39
-39
lines changed

DOCKER.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ deploy.bat --mode prod --build
5959

6060
部署完成后,可通过以下地址访问:
6161

62-
- **API服务**: http://localhost:8000
63-
- **API文档**: http://localhost:8000/docs
64-
- **健康检查**: http://localhost:8000/health
62+
- **API服务**: http://localhost:8081
63+
- **API文档**: http://localhost:8081/docs
64+
- **健康检查**: http://localhost:8081/health
6565

6666
## 🏗️ 部署模式
6767

@@ -123,7 +123,7 @@ deploy.bat --mode prod --build
123123
# 应用基础配置
124124
APP_NAME=AI智能题库查询系统
125125
SERVER_HOST=0.0.0.0
126-
SERVER_PORT=8000
126+
SERVER_PORT=8081
127127
128128
# 数据库配置
129129
DATABASE_URL=sqlite:///./data/app.db
@@ -156,7 +156,7 @@ app:
156156

157157
server:
158158
host: "0.0.0.0"
159-
port: 8000
159+
port: 8081
160160
reload: false
161161

162162
ai_providers:
@@ -234,7 +234,7 @@ AI_wenda/
234234

235235
| 服务 | 容器端口 | 主机端口 | 说明 |
236236
|------|----------|----------|------|
237-
| AI问答系统 | 8000 | 8000 | API服务 |
237+
| AI问答系统 | 8081 | 8081 | API服务 |
238238
| Redis | 6379 | 6379 | 缓存服务 |
239239
| Nginx | 80/443 | 80/443 | 反向代理 |
240240
| Prometheus | 9090 | 9090 | 监控服务 |
@@ -330,11 +330,11 @@ docker-compose build --no-cache
330330

331331
```bash
332332
# 检查端口占用
333-
netstat -tulpn | grep :8000
333+
netstat -tulpn | grep :8081
334334
335335
# 修改docker-compose.yml中的端口映射
336336
ports:
337-
- "8001:8000" # 改为其他端口
337+
- "8002:8081" # 改为其他端口
338338
```
339339

340340
#### 3. 数据库连接失败

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ RUN mkdir -p /app/data && \
3636
chown appuser:appuser /app/data
3737

3838
# 暴露端口
39-
EXPOSE 8000
39+
EXPOSE 8081
4040

4141
# 切换到非root用户
4242
USER appuser

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ deploy.bat --mode full --build
232232
docker build -t ai-quiz-system .
233233

234234
# 运行容器(简单部署)
235-
docker run -p 8000:8000 -v $(pwd)/config.yaml:/app/config.yaml ai-quiz-system
235+
docker run -p 8081:8081 -v $(pwd)/config.yaml:/app/config.yaml ai-quiz-system
236236

237237
# 使用Docker Compose(推荐)
238238
docker-compose up -d
@@ -247,11 +247,11 @@ docker-compose up -d
247247
==================================================
248248
👤 作者: Toni Wang
249249
📧 邮箱: shell7@petalmail.com
250-
🌐 地址: http://0.0.0.0:8000
250+
🌐 地址: http://0.0.0.0:8081
251251
==================================================
252252
```
253253

254-
访问 http://localhost:8000 查看API文档
254+
访问 http://localhost:8081 查看API文档
255255

256256
## 🐳 Docker部署
257257

@@ -283,7 +283,7 @@ graph TB
283283
# 应用基础配置
284284
APP_NAME=AI智能题库查询系统
285285
SERVER_HOST=0.0.0.0
286-
SERVER_PORT=8000
286+
SERVER_PORT=8081
287287
288288
# 数据库配置
289289
DATABASE_URL=sqlite:///./data/app.db
@@ -310,7 +310,7 @@ services:
310310
ai-wenda:
311311
build: .
312312
ports:
313-
- "8000:8000"
313+
- "8081:8081"
314314
environment:
315315
- PYTHONPATH=/app
316316
volumes:
@@ -360,8 +360,8 @@ volumes:
360360
361361
| 服务 | 开发模式 | 生产模式 | 完整模式 |
362362
|------|----------|----------|----------|
363-
| **API服务** | http://localhost:8000 | http://localhost | http://localhost |
364-
| **API文档** | http://localhost:8000/docs | http://localhost/docs | http://localhost/docs |
363+
| **API服务** | http://localhost:8081 | http://localhost | http://localhost |
364+
| **API文档** | http://localhost:8081/docs | http://localhost/docs | http://localhost/docs |
365365
| **Redis** | localhost:6379 | localhost:6379 | localhost:6379 |
366366
| **监控面板** | - | - | http://localhost:9090 |
367367
@@ -376,7 +376,7 @@ volumes:
376376
#### 健康检查
377377
```bash
378378
# 检查服务状态
379-
curl http://localhost:8000/api/health
379+
curl http://localhost:8081/api/health
380380

381381
# 查看容器状态
382382
docker-compose ps
@@ -465,7 +465,7 @@ docker-compose build --no-cache
465465
```bash
466466
# 修改docker-compose.yml中的端口映射
467467
ports:
468-
- "8001:8000" # 改为其他端口
468+
- "8002:8081" # 改为其他端口
469469
```
470470

471471
3. **权限问题**
@@ -511,10 +511,10 @@ sudo chown -R 1000:1000 ./data
511511
**请求示例:**
512512
```bash
513513
# GET请求
514-
curl "http://localhost:8000/api/query?title=中国的首都是哪里?&options=A.北京 B.上海 C.广州&type=选择题"
514+
curl "http://localhost:8081/api/query?title=中国的首都是哪里?&options=A.北京 B.上海 C.广州&type=选择题"
515515

516516
# POST请求
517-
curl -X POST http://localhost:8000/api/query \
517+
curl -X POST http://localhost:8081/api/query \
518518
-H "Content-Type: application/json" \
519519
-d '{
520520
"title": "1+1等于多少?",
@@ -610,12 +610,12 @@ curl -X POST http://localhost:8000/api/query \
610610

611611
启动服务后,访问以下地址查看完整API文档:
612612

613-
- **📘 Swagger UI**: http://localhost:8000/docs
613+
- **📘 Swagger UI**: http://localhost:8081/docs
614614
- 支持在线测试API
615615
- 详细的请求/响应示例
616616
- 参数说明和约束
617617

618-
- **📗 ReDoc**: http://localhost:8000/redoc
618+
- **📗 ReDoc**: http://localhost:8081/redoc
619619
- 美观的三栏式文档
620620
- 适合打印和分享
621621
- 完整的API规范
@@ -625,7 +625,7 @@ curl -X POST http://localhost:8000/api/query \
625625
#### 批量查询
626626
```bash
627627
# 使用POST进行批量查询
628-
curl -X POST http://localhost:8000/api/query/batch \
628+
curl -X POST http://localhost:8081/api/query/batch \
629629
-H "Content-Type: application/json" \
630630
-d '{
631631
"questions": [
@@ -638,7 +638,7 @@ curl -X POST http://localhost:8000/api/query/batch \
638638
#### 指定AI提供商
639639
```bash
640640
# 临时指定使用的AI平台
641-
curl "http://localhost:8000/api/query?title=编程问题&provider=deepseek"
641+
curl "http://localhost:8081/api/query?title=编程问题&provider=deepseek"
642642
```
643643

644644
## 🔧 配置说明
@@ -648,7 +648,7 @@ curl "http://localhost:8000/api/query?title=编程问题&provider=deepseek"
648648
```yaml
649649
server:
650650
host: "0.0.0.0" # 服务器地址
651-
port: 8000 # 服务器端口
651+
port: 8081 # 服务器端口
652652
reload: false # 是否开启热重载
653653
```
654654
@@ -687,13 +687,13 @@ python test_app.py
687687

688688
```bash
689689
# 测试查询接口
690-
curl "http://localhost:8000/api/query?title=1+1等于多少?&type=填空题"
690+
curl "http://localhost:8081/api/query?title=1+1等于多少?&type=填空题"
691691

692692
# 测试健康检查
693-
curl "http://localhost:8000/api/health"
693+
curl "http://localhost:8081/api/health"
694694

695695
# 测试系统信息
696-
curl "http://localhost:8000/api/system/info"
696+
curl "http://localhost:8081/api/system/info"
697697
```
698698

699699
## 🏗️ 项目结构
@@ -757,8 +757,8 @@ project/
757757
**问题1:端口被占用**
758758
```bash
759759
# 查找占用端口的进程
760-
netstat -ano | findstr :8000 # Windows
761-
lsof -i :8000 # macOS/Linux
760+
netstat -ano | findstr :8081 # Windows
761+
lsof -i :8081 # macOS/Linux
762762

763763
# 杀死进程或修改配置文件中的端口
764764
```
@@ -854,10 +854,10 @@ logging:
854854
tail -f app.log
855855

856856
# 检查系统状态
857-
curl http://localhost:8000/api/health
857+
curl http://localhost:8081/api/health
858858

859859
# 测试AI提供商状态
860-
curl http://localhost:8000/api/ai-providers
860+
curl http://localhost:8081/api/ai-providers
861861
```
862862

863863
### 获取帮助

deploy.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ docker-compose ps
268268

269269
echo.
270270
echo [INFO] 服务访问地址:
271-
echo - API服务: http://localhost:8000
272-
echo - API文档: http://localhost:8000/docs
271+
echo - API服务: http://localhost:8081
272+
echo - API文档: http://localhost:8081/docs
273273

274274
if "%DEPLOY_MODE%"=="prod" echo - Nginx代理: http://localhost
275275
if "%DEPLOY_MODE%"=="full" echo - Prometheus监控: http://localhost:9090

deploy.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ show_status() {
201201
docker-compose ps
202202

203203
print_info "服务访问地址:"
204-
echo " - API服务: http://localhost:8000"
205-
echo " - API文档: http://localhost:8000/docs"
204+
echo " - API服务: http://localhost:8081"
205+
echo " - API文档: http://localhost:8081/docs"
206206

207207
if [[ "$DEPLOY_MODE" == "prod" || "$DEPLOY_MODE" == "full" ]]; then
208208
echo " - Nginx代理: http://localhost"

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
dockerfile: Dockerfile
99
container_name: ai-wenda-app
1010
ports:
11-
- "8000:8000"
11+
- "8081:8081"
1212
environment:
1313
- PYTHONPATH=/app
1414
- PYTHONUNBUFFERED=1
@@ -24,7 +24,7 @@ services:
2424
depends_on:
2525
- redis
2626
healthcheck:
27-
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
27+
test: ["CMD", "curl", "-f", "http://localhost:8081/health"]
2828
interval: 30s
2929
timeout: 10s
3030
retries: 3

docker.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ APP_DESCRIPTION=基于FastAPI的高性能智能题库查询系统
88

99
# 服务器配置
1010
SERVER_HOST=0.0.0.0
11-
SERVER_PORT=8000
11+
SERVER_PORT=8081
1212
SERVER_RELOAD=false
1313
SERVER_WORKERS=1
1414

0 commit comments

Comments
 (0)