refactor(deploy): 升级生产部署脚本,增加优雅启停、健康检查与自动回滚
Some checks failed
Build and Deploy / deploy (push) Has been cancelled

升级部署脚本为运维级实现,新增以下核心特性:
- 优雅启停 (SIGTERM → 等待 → SIGKILL 兜底)
- 健康检查 + 自动回滚
- 版本备份,保留最近 5 个版本
- 并发锁防止重复执行
- 前置检查 (磁盘/内存/端口/编译产物)
- 结构化日志

同时启用 Spring Boot 优雅关闭功能,配置 30 秒超时以等待请求和后台任务完成。
This commit is contained in:
2026-06-03 22:22:05 +08:00
parent 3a3638295b
commit 71ed87371b
2 changed files with 448 additions and 95 deletions

View File

@@ -1,5 +1,12 @@
server:
port: 9900
# 优雅关闭:等待 HTTP 请求和后台任务完成后再退出
shutdown: graceful
spring:
lifecycle:
# 每个阶段最多等待 30 秒,给 CompletableFuture 和线程池排空的机会
timeout-per-shutdown-phase: 30s
--- #################### 数据库相关配置 ####################
spring: