feat: complete daemon operations and recovery tooling

This commit is contained in:
2026-08-22 15:34:09 +08:00
parent a0a4a7556a
commit 1abe8df6ee
19 changed files with 1421 additions and 171 deletions
+47
View File
@@ -1,11 +1,42 @@
# =============================================================================
# yms-daemon 本机部署配置示例
# =============================================================================
# 后端支持两种运行类型,通过 [backend] 的 type 字段切换:
# type = "native" 原生部署:systemd 双实例 JVM + 版本化 JAR
# type = "container" 容器部署:Docker standalone 蓝绿容器
#
# 快速切换步骤:
# 1. 注释掉当前使用的 [backend] 配置块,取消注释目标 [backend] 配置块;
# 2. 确认 [backend] 的 type 与目标一致(native 或 container);
# 3. 重启 yms-daemon.servicesystemctl restart yms-daemon.service。
#
# 重要约束:
# - daemon 不根据现场状态推断运行类型,type 必须与现场实际部署一致;
# - native ↔ container 属于运行类型迁移,必须走独立迁移事务,
# 不能只修改本配置绕过;迁移执行器尚未实现。
# =============================================================================
[daemon]
# 机器级环境标记,只接受精确值 dev 或 prod:
# dev = 容器镜像从 Registry pull(开发环境)
# prod = 容器镜像从离线 repack ZIP load(客户现场)
# 该字段不改变 native 更新、健康检查、切流、事务或回滚行为。
environment = "prod"
# =============================================================================
# 方式一:原生后端(默认启用)
# =============================================================================
[backend]
type = "native"
# 原生后端 JAR 版本目录与当前生效兼容入口,与现有现场保持一致,勿改。
release_dir = "/home/yms/lib/releases"
active_jar = "/home/yms/lib/glory-soft-yms.jar"
# systemctl 可执行文件的绝对路径,必须填写该服务器 command -v systemctl 的精确输出。
systemctl_path = "/bin/systemctl"
# 容器后端停止旧容器时,发送停止信号后到强制终止前的等待秒数。
# 仅容器后端生效(原生后端忽略);可省略,省略时默认 30 秒。
# 配置后会覆盖容器创建时设置的 9000 秒 StopTimeout,避免旧容器优雅停机长期不退。
# stop_grace_seconds = 30
[backend.slot.8080]
unit = "yms-backend@8080.service"
@@ -16,3 +47,19 @@ health_endpoint = "http://127.0.0.1:8080/yms/actuator/health"
unit = "yms-backend@8081.service"
jar = "/home/yms/lib/glory-soft-yms-8081.jar"
health_endpoint = "http://127.0.0.1:8081/yms/actuator/health"
# =============================================================================
# 方式二:容器后端(切换到容器时,取消注释本块,并注释掉上面的方式一)
# =============================================================================
# [backend]
# type = "container"
# systemctl_path = "/bin/systemctl"
# stop_grace_seconds = 30
#
# [backend.slot.8080]
# container_name = "backend-8080"
# health_endpoint = "http://127.0.0.1:8080/yms/actuator/health"
#
# [backend.slot.8081]
# container_name = "backend-8081"
# health_endpoint = "http://127.0.0.1:8081/yms/actuator/health"