Commit Graph

67 Commits

Author SHA1 Message Date
n72595987@gmail.com
1c96ef4f6f refactor: 重组项目目录结构
All checks were successful
continuous-integration/drone/push Build is passing
将 doc/ 目录重组为更标准的结构:

目录变更:
- doc/ → docs/ (文档目录,只包含 .md 文件)
- doc/sql/ → database/ (数据库脚本目录)
  - database/bladex/ (BladeX 框架数据库)
  - database/flowable/ (Flowable 工作流数据库)
  - database/martial-db/ (武术系统业务数据库)
  - database/upgrade/ (数据库升级脚本)
- doc/script/ → scripts/ (部署和运维脚本)
  - scripts/docker/ (Docker 部署脚本)
  - scripts/fatjar/ (Fat JAR 启动脚本)

优势:
- 符合标准项目结构规范
- 文档、数据库、脚本分离更清晰
- 便于维护和查找

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-30 10:53:50 +08:00
n72595987@gmail.com
dfeaa48e28 文档:添加 Drone CI/CD 自动化部署说明
All checks were successful
continuous-integration/drone/push Build is passing
新增内容:
- 部署架构图和流程说明
- 详细的部署步骤(4个阶段,耗时约5-6分钟)
- 日常开发使用方法
- .drone.yml 配置文件示例
- systemd 服务管理命令
- 环境要求说明
- 常见问题排查和手动回滚方法
- 部署历史查看入口

开发者现在可以通过 README.md 快速了解:
1. 如何触发自动部署(git push origin main)
2. 部署过程中发生了什么
3. 如何查看部署状态和日志
4. 遇到问题如何排查

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 22:21:54 +08:00
n72595987@gmail.com
319cfb4268 调整健康检查等待时间:15秒 → 45秒
All checks were successful
continuous-integration/drone/push Build is passing
问题:
- Build #9 所有步骤成功(编译、部署)
- 但健康检查失败(15秒等待不够)
- Spring Boot 应用需要约30-40秒完全启动

解决:
- 将健康检查等待时间调整为45秒
- 确保服务完全启动后再进行检查

验证:
- 手动测试服务正常运行
- http://154.30.6.21:8123/actuator/health 返回 UP

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 22:09:18 +08:00
n72595987@gmail.com
8a779a56ac 修复 Drone CI 编译失败:合并框架和项目编译步骤
Some checks failed
continuous-integration/drone/push Build is failing
问题原因:
- 步骤1和步骤2在不同容器中执行
- Maven 本地仓库(~/.m2/repository)不共享
- 后端项目找不到已编译的 BladeX 框架依赖
- 导致 401 Unauthorized 错误(尝试从远程下载)

解决方案:
- 将"编译框架依赖"和"编译后端项目"合并为一个步骤
- 在同一个 Maven 容器中顺序执行
- 框架编译后立即可用于后端项目编译

执行流程:
1. 克隆 martial-tool 框架代码
2. 编译框架并 install 到 Maven 本地仓库
3. 切换到后端项目目录
4. 编译后端项目(可使用本地 Maven 仓库中的框架)

优势:
- Maven 本地仓库在同一容器中共享
- 无需访问远程私有仓库
- 构建更可靠和快速

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 22:00:07 +08:00
n72595987@gmail.com
15579f43cb 修复后端服务外网访问问题
Some checks failed
continuous-integration/drone/push Build is failing
- 将 server.address 从 127.0.0.1 改为 0.0.0.0,允许外部访问
- 配置 UFW 防火墙允许 8123 端口

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 20:08:50 +08:00
n72595987@gmail.com
f9df72ebb8 改为直接部署:使用 systemd 管理 Java 进程
Some checks failed
continuous-integration/drone/push Build is failing
变更说明:
- 不再使用 Docker 容器部署后端
- 使用 sdkman 管理的 JDK 17 直接运行 JAR
- 使用 systemd 服务管理进程(自动重启、日志管理)

部署流程:
1. Drone CI 编译 BladeX 框架和后端项目
2. SCP 传输 blade-api.jar 到 /app/martial-backend/bin/
3. SSH 执行 systemctl restart martial-backend
4. systemd 自动启动 Java 进程

优势:
- 简化部署,不需要 Docker 镜像层
- 更直接的进程管理和日志查看
- 启动速度更快
- 资源占用更少

systemd 服务配置:
- 服务名:martial-backend.service
- 工作目录:/app/martial-backend
- JAR 位置:/app/martial-backend/bin/blade-api.jar
- 日志目录:/app/martial-backend/logs/
- JVM 参数:-Xms512m -Xmx1024m
- 自动重启:失败后 10 秒重启

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 18:17:22 +08:00
n72595987@gmail.com
667c11b474 修复后端 CI/CD:改为在部署服务器上构建镜像
Some checks failed
continuous-integration/drone/push Build is failing
问题:
- plugins/docker 尝试推送镜像到远程 registry
- 需要配置认证且增加网络传输时间

解决方案:
- 移除 plugins/docker 步骤
- 添加 drone-scp 步骤传输构建产物(blade-api.jar、Dockerfile)
- 在部署服务器上执行 docker build
- 直接使用本地镜像启动容器

优势:
- 不需要配置 Docker registry 认证
- 不需要推送和拉取大型镜像,部署更快
- JAR 文件小(约 50-100MB),传输速度快
- 镜像只存在于部署服务器本地,更安全

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 18:05:07 +08:00
n72595987@gmail.com
44f01e2219 修复 CI 构建:合并克隆和编译步骤
Some checks failed
continuous-integration/drone/push Build is failing
问题:
- 分离的克隆步骤(alpine/git)可能存在权限或文件共享问题
- 导致后续编译步骤找不到克隆的目录

解决方案:
- 将克隆和编译合并到同一个步骤
- 使用 maven 镜像直接执行 git clone(maven 镜像包含 git)
- 在同一容器环境中完成克隆和编译,避免跨容器问题
- 添加错误处理,如果目录已存在则跳过克隆

优势:
- 简化流程,减少步骤数量
- 避免容器间文件系统共享问题
- 更可靠的执行

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 18:02:25 +08:00
n72595987@gmail.com
9475e164af 修复 CI 构建:更正 martial-tool 克隆路径
Some checks failed
continuous-integration/drone/push Build is failing
问题:
- Drone 的工作目录是 /drone/src(当前仓库)
- 之前尝试 cd /drone 会失败
- 导致 martial-tool 克隆到错误位置

解决方案:
- 使用 cd /drone/src/.. 导航到父目录
- 在 /drone/src/../martial-tool 位置克隆框架代码
- 编译时使用相同的路径 /drone/src/../martial-tool

路径结构:
/drone/
  ├── src/              # martial-master (当前仓库)
  └── martial-tool/     # BladeX 框架 (克隆的)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 18:00:32 +08:00
n72595987@gmail.com
ad1f3df70b 修复 CI 构建:添加克隆 BladeX 框架步骤
Some checks failed
continuous-integration/drone/push Build is failing
问题:
- Drone CI 只会 clone 当前仓库,不会自动获取 martial-tool
- 导致编译框架依赖步骤失败

解决方案:
- 添加步骤0:使用 alpine/git 镜像克隆 martial-tool 代码
- 将框架代码 clone 到 /drone/martial-tool
- 编译步骤使用正确的路径 /drone/martial-tool

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 17:52:47 +08:00
n72595987@gmail.com
9d37f3f73d 修复 Drone CI 配置:移除 host volumes 以解决 untrusted 仓库问题
Some checks failed
continuous-integration/drone/push Build is failing
- 移除 maven-cache volume 挂载
- 同一构建内的步骤仍可共享 Maven 本地仓库
- BladeX 框架编译结果可被后端编译步骤复用

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 17:45:28 +08:00
n72595987@gmail.com
5ce4c4601d 添加 Drone CI/CD 自动化部署配置
Some checks failed
continuous-integration/drone/push Build encountered an error
1. 新增 .drone.yml 配置文件
   - 自动编译 BladeX 框架依赖
   - 自动编译后端项目并打包
   - 构建 Docker 镜像
   - 自动部署到生产服务器
   - 健康检查验证部署成功

2. 新增 Dockerfile
   - 基于 eclipse-temurin:17-jre 轻量镜像
   - 配置 JVM 参数优化内存使用
   - 添加健康检查端点
   - 支持多环境配置(dev/test/prod)

现在推送代码到 main 分支后,Drone CI 会自动:
- 编译项目
- 构建 Docker 镜像
- 部署到 154.30.6.21 服务器
- 执行健康检查

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 17:04:39 +08:00
n72595987@gmail.com
38472ee832 优化后端配置和数据库结构
1. 修复Swagger配置,添加武术模块API分组
   - 在SwaggerConfiguration中新增martialApi()方法
   - 使武术模块的66个接口能在Knife4j界面正常显示

2. 优化项目依赖配置
   - 添加spring-boot-starter-actuator用于健康检查
   - 暂时注释flowable工作流依赖以简化项目

3. 更新数据库结构
   - 优化martial_db.sql,精简表结构从123张减少到53张
   - 保留核心BladeX系统表和15张武术业务表
   - 更新测试数据:2场比赛、10名运动员、9个项目

4. 补充项目文档
   - 添加架构说明、开发指南等中文文档

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 16:30:20 +08:00
9c77fcb4ac Merge branch 'main' of git.waypeak.work:martial/martial-master 2025-11-29 15:03:56 +08:00
109f226371 fix bugs 2025-11-29 15:03:33 +08:00
n72595987@gmail.com
9c7604d98b chore: 配置开发环境并更新数据库设置
- 添加 VS Code 调试配置(launch.json, tasks.json)
- 添加 VS Code 调试使用指南
- 更新数据库端口为高位端口(MySQL: 33066, Redis: 63379)
- 更新应用服务器端口为 8123
- 启用 blade-starter-liteflow 依赖
- 添加 SDKMAN 配置文件(.sdkmanrc)
- 添加项目开发文档(CLAUDE.md)
- 更新 .gitignore 忽略日志和部署文件

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 13:26:22 +08:00
3b097b5f63 fix bugs 2025-11-28 16:17:55 +08:00