Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ JDMC 是企业版组件,需要在 `/opt/jumpserver/config/config.txt` 中设
`${NAMESPACE:-jumpserver}/jdmc:${VERSION}`,从 `/dist` 提取并执行 JDMC 自带的
`scripts/install.sh` 或 `scripts/upgrade.sh`。
JDMC 与 Core 等自有组件使用相同的拉取和重标记规则,企业版离线包始终包含该镜像。
安装或升级时会尝试安装 JDMC 的 HA 宿主机依赖;依赖安装失败或依赖脚本缺失时,
仅输出警告,单机安装或升级继续。启用 HA 前必须补齐依赖;JDMC 的 HA
`setup`、`prepare` 和 `install` 流程会再次检查并安装依赖,失败时中止 HA 部署。
服务跟随 `jmsctl.sh start/stop/restart/status` 管理,日志可通过
`./jmsctl.sh tail jdmc` 查看。安装器会为 Core 配置
`JDMC_SOCK_PATH=/opt/jumpserver/data/unshare/jdmc.sock`;Core 根据企业版自动启用
Expand Down
7 changes: 1 addition & 6 deletions scripts/4_install_jumpserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,7 @@ function main() {
}
install_jdmc || {
jdmc_status=$?
if [[ "${jdmc_status}" == "20" ]]; then
log_error "JDMC is installed, but required HA host dependencies are incomplete"
log_error "Resolve the dependency error above, then rerun ./jmsctl.sh install"
else
log_error "Failed to install JDMC"
fi
log_error "Failed to install JDMC"
exit "${jdmc_status}"
}

Expand Down
7 changes: 1 addition & 6 deletions scripts/7_upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,7 @@ function main() {
}
upgrade_jdmc || {
jdmc_status=$?
if [[ "${jdmc_status}" == "20" ]]; then
log_error "JDMC package update completed, but required HA host dependencies are incomplete"
log_error "Resolve the dependency error above, then rerun ./jmsctl.sh upgrade"
else
log_error "Failed to upgrade JDMC"
fi
log_error "Failed to upgrade JDMC"
exit "${jdmc_status}"
}

Expand Down
25 changes: 13 additions & 12 deletions scripts/gists/jdmc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,20 @@ function check_jdmc_runtime() {
function ensure_jdmc_ha_dependencies() {
local dependency_installer="${JDMC_INSTALL_DIR}/current/ha/scripts/install-dependencies.sh"

# HA dependencies are optional for standalone install/upgrade. HA setup,
# prepare and install enforce them again before deploying the cluster.
if [[ ! -x "${dependency_installer}" ]]; then
log_error "JDMC is installed, but its HA dependency installer is missing: ${dependency_installer}"
log_error "Repair the JDMC package, then retry the original install/upgrade command"
return 20
log_warn "JDMC HA dependency installer is missing: ${dependency_installer}; continuing standalone install/upgrade"
log_warn "Repair the JDMC package before enabling HA; HA deployment requires complete host dependencies"
return 0
fi
echo_yellow "\n>>> Installing JDMC HA host dependencies"
# Status 20 distinguishes incomplete HA dependencies from a package failure.
if ! "${dependency_installer}"; then
log_error "JDMC is installed, but HA host dependencies are incomplete"
log_error "Resolve the dependency error above, then retry as root: \"${dependency_installer}\""
log_error "After dependencies are ready, rerun the original install/upgrade command"
return 20
log_warn "JDMC HA host dependencies are incomplete; continuing standalone install/upgrade"
log_warn "Before enabling HA, resolve the dependency error above and retry as root: \"${dependency_installer}\""
log_warn "HA deployment will check dependencies again and fail if they are still incomplete"
fi
return 0
}

function jdmc_unit_exists() {
Expand Down Expand Up @@ -267,7 +268,7 @@ function install_jdmc() {

if check_current_jdmc_installed; then
echo_check "JDMC is already installed"
ensure_jdmc_ha_dependencies || return $?
ensure_jdmc_ha_dependencies
cleanup_jdmc_legacy_switches
return $?
fi
Expand All @@ -279,15 +280,15 @@ function install_jdmc() {
echo_yellow "\n>>> Repairing or upgrading JDMC"
fi
run_jdmc_package_action upgrade || return 1
ensure_jdmc_ha_dependencies || return $?
ensure_jdmc_ha_dependencies
configure_jdmc || return 1
cleanup_jdmc_legacy_switches
return $?
fi

echo_yellow "\n>>> Installing JDMC"
run_jdmc_package_action install || return 1
ensure_jdmc_ha_dependencies || return $?
ensure_jdmc_ha_dependencies
configure_jdmc || return 1
cleanup_jdmc_legacy_switches
}
Expand All @@ -306,7 +307,7 @@ function upgrade_jdmc() {
else
run_jdmc_package_action install || return 1
fi
ensure_jdmc_ha_dependencies || return $?
ensure_jdmc_ha_dependencies
configure_jdmc || return 1
cleanup_jdmc_legacy_switches
}
Expand Down
Loading