添加基础设施服务启动等待时间
- MySQL 等待 30 秒初始化 - Redis 等待 10 秒 - Nacos 等待 20 秒(确保 MySQL 就绪) - 解决 Nacos 无法连接 MySQL 的问题
This commit is contained in:
parent
bae9bdd9a0
commit
ddf030a178
|
|
@ -217,11 +217,14 @@ infrastructure:
|
|||
- cp sql/ry_20250523.sql docker/mysql/db/
|
||||
- cp sql/ry_config_20250902.sql docker/mysql/db/
|
||||
deployed_flag: .devops/.deployed_mysql
|
||||
wait_time: 30 # MySQL 需要更长时间初始化
|
||||
|
||||
- name: ruoyi-redis
|
||||
docker_service: ruoyi-redis
|
||||
deployed_flag: .devops/.deployed_redis
|
||||
wait_time: 10 # Redis 启动较快
|
||||
|
||||
- name: ruoyi-nacos
|
||||
docker_service: ruoyi-nacos
|
||||
deployed_flag: .devops/.deployed_nacos
|
||||
wait_time: 20 # Nacos 需要等待 MySQL 就绪
|
||||
|
|
|
|||
|
|
@ -350,6 +350,12 @@ class Deployer:
|
|||
self.logger.error(f"部署失败: {name}")
|
||||
return False
|
||||
|
||||
# 等待服务启动(特别是 MySQL 和 Redis)
|
||||
wait_time = infra.get('wait_time', 10)
|
||||
self.logger.info(f"等待 {name} 启动完成 ({wait_time} 秒)...")
|
||||
import time
|
||||
time.sleep(wait_time)
|
||||
|
||||
# 创建部署标记
|
||||
deployed_flag.parent.mkdir(parents=True, exist_ok=True)
|
||||
deployed_flag.touch()
|
||||
|
|
|
|||
Loading…
Reference in New Issue