fix: enforce dashboard cdc env file
This commit is contained in:
parent
6ad3c7a99a
commit
6dff58f16f
@ -1425,14 +1425,14 @@ def ensure_dashboard_cdc_remote_env(host_entry: dict[str, Any]) -> dict[str, Any
|
|||||||
|
|
||||||
|
|
||||||
def ensure_dashboard_cdc_compose_service(host_name: str) -> dict[str, Any] | None:
|
def ensure_dashboard_cdc_compose_service(host_name: str) -> dict[str, Any] | None:
|
||||||
# 新服务首次上线前远端还没有运行容器,不能依赖 docker inspect 自动生成模板。
|
# 既处理首次上线,也修正已存在服务从旧模板继承 service.env 的情况。
|
||||||
model = load_local_host_compose_model(host_name)
|
model = load_local_host_compose_model(host_name)
|
||||||
service_map = dict(model.get("services") or {})
|
service_map = dict(model.get("services") or {})
|
||||||
if DASHBOARD_CDC_SERVICE_NAME in service_map:
|
|
||||||
return None
|
|
||||||
|
|
||||||
service_map[DASHBOARD_CDC_SERVICE_NAME] = {
|
current = dict(service_map.get(DASHBOARD_CDC_SERVICE_NAME) or {})
|
||||||
"image": f"{HARBOR_REGISTRY}/{HARBOR_PROJECT}/dashboard-cdc-worker:bootstrap",
|
desired = {
|
||||||
|
**current,
|
||||||
|
"image": current.get("image") or f"{HARBOR_REGISTRY}/{HARBOR_PROJECT}/dashboard-cdc-worker:bootstrap",
|
||||||
"container_name": f"likei-{host_name}-{DASHBOARD_CDC_SERVICE_NAME}",
|
"container_name": f"likei-{host_name}-{DASHBOARD_CDC_SERVICE_NAME}",
|
||||||
"network_mode": "host",
|
"network_mode": "host",
|
||||||
"restart": "unless-stopped",
|
"restart": "unless-stopped",
|
||||||
@ -1453,6 +1453,10 @@ def ensure_dashboard_cdc_compose_service(host_name: str) -> dict[str, Any] | Non
|
|||||||
"options": {"max-size": "200m", "max-file": "5"},
|
"options": {"max-size": "200m", "max-file": "5"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
if current == desired:
|
||||||
|
return None
|
||||||
|
|
||||||
|
service_map[DASHBOARD_CDC_SERVICE_NAME] = desired
|
||||||
return save_local_host_compose_model(host_name, service_map)
|
return save_local_host_compose_model(host_name, service_map)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user