Back to Weknora

开发指南

docs/wiki/开发部署/开发指南.md

0.5.12.5 KB
Original Source

开发指南

快速开发模式(推荐)

如果需要频繁修改 appfrontend 代码,不需要每次都重新构建 Docker 镜像,可以使用本地开发模式。

详细的开发模式说明参见 快速开发模式

方式一:使用 Make 命令(推荐)

bash
# 终端 1:启动基础设施
make dev-start

# 终端 2:启动后端
make dev-app

# 终端 3:启动前端
make dev-frontend

方式二:使用脚本命令

bash
./scripts/dev.sh start    # 启动基础设施
./scripts/dev.sh app       # 启动后端
./scripts/dev.sh frontend  # 启动前端

访问地址

服务地址
前端开发服务器http://localhost:5173
后端 APIhttp://localhost:8080
PostgreSQLlocalhost:5432
Redislocalhost:6379
MinIO Consolehttp://localhost:9001
Neo4j Browserhttp://localhost:7474
Jaeger UIhttp://localhost:16686

Neo4j 的使用参见 知识图谱开启知识图谱功能

使用 Air 实现后端热重载

bash
go install github.com/air-verse/air@latest
air  # 修改 Go 代码后自动重新编译和重启

前端独立开发

bash
cd frontend
npm run dev  # 连接到 http://localhost:8080 的后端 API

生产环境部署

bash
sh scripts/build_images.sh    # 构建所有镜像
sh scripts/start_all.sh       # 启动生产环境

常见问题

  • 启动 dev-app 时报错连接不到数据库:确保先运行了 make dev-start
  • 前端 CORS 错误:检查 vite.config.ts 中的代理配置
  • DocReader 需要重新构建sh scripts/build_images.sh -d

更多排查建议参见 常见问题

相关主题


反向链接