release: v0.51.494 — TLS-aware launcher health probes (#4412)
Absorbs #4412 (tomas-forgac) rebased onto fresh master, plus two Codex-regression-gate fixes: (1) use the scheme that actually answered the probe for the ready/already-up URL + browser-open, (2) honor an explicit HERMES_WEBUI_HEALTH_URL override in the WSL autostart probe. Co-authored-by: tomas-forgac <tomas-forgac@users.noreply.github.com> Closes #4412
This commit is contained in:
1 parent
67f81b60a2
commit
a308fdd5e8
10 files changed
+658
-44
No files matched your search
@@ -120,21 +120,33 @@ case "${_hermes_host}" in
|
||||
0.0.0.0|""|::|"[::]") _hermes_probe_host="127.0.0.1" ;;
|
||||
*) _hermes_probe_host="${_hermes_host}" ;;
|
||||
esac
|
||||
_hermes_health_url="http://${_hermes_probe_host}:${_hermes_port}/health"
|
||||
|
||||
# Best-effort probe. If neither curl nor wget is present we skip the check and
|
||||
# fall through to the normal launch (unchanged behavior). Short 2s timeout so a
|
||||
# normal cold start is not delayed.
|
||||
# Best-effort, TLS-aware probe via the shared helper. If neither curl nor wget
|
||||
# is present the helper returns non-zero and we fall through to the normal
|
||||
# launch (unchanged behavior). Short 2s timeout so a normal cold start is not
|
||||
# delayed. The helper mirrors the server scheme (https when TLS_CERT/KEY are
|
||||
# set) and handles self-signed certs and the HTTP-fallback contract.
|
||||
# shellcheck source=scripts/lib/health_probe.sh
|
||||
. "${REPO_ROOT}/scripts/lib/health_probe.sh"
|
||||
_hermes_probe_scheme="$(hermes_webui_probe_scheme)"
|
||||
# Run the probe in the CURRENT shell (redirect, not $(...)) so the helper's
|
||||
# _HERMES_WEBUI_PROBE_SCHEME global survives — a command-substitution subshell
|
||||
# would discard it. server.py falls back to plain HTTP when the cert/key are
|
||||
# unloadable, so a TLS-configured instance can be live on http:// while the
|
||||
# configured scheme is https://; prefer the scheme that actually answered.
|
||||
_hermes_probe_body_file="$(mktemp 2>/dev/null || echo "/tmp/hermes-webui-probe.$$")"
|
||||
_hermes_already_up=""
|
||||
if command -v curl >/dev/null 2>&1; then
|
||||
_hermes_already_up="$(curl -fsS --max-time 2 "${_hermes_health_url}" 2>/dev/null || true)"
|
||||
elif command -v wget >/dev/null 2>&1; then
|
||||
_hermes_already_up="$(wget -qO- --timeout=2 --tries=1 "${_hermes_health_url}" 2>/dev/null || true)"
|
||||
if hermes_webui_probe_health "${_hermes_probe_host}" "${_hermes_port}" "/health" 2 > "${_hermes_probe_body_file}" 2>/dev/null; then
|
||||
_hermes_already_up="$(cat "${_hermes_probe_body_file}" 2>/dev/null || true)"
|
||||
fi
|
||||
rm -f "${_hermes_probe_body_file}" 2>/dev/null || true
|
||||
if [[ -n "${_HERMES_WEBUI_PROBE_SCHEME:-}" ]]; then
|
||||
_hermes_probe_scheme="${_HERMES_WEBUI_PROBE_SCHEME}"
|
||||
fi
|
||||
|
||||
if [[ -n "${_hermes_already_up}" ]]; then
|
||||
cat >&2 <<EOF
|
||||
[==] Hermes WebUI is already running at http://${_hermes_probe_host}:${_hermes_port}
|
||||
[==] Hermes WebUI is already running at ${_hermes_probe_scheme}://${_hermes_probe_host}:${_hermes_port}
|
||||
The server was NOT started again (start.sh does not double-start).
|
||||
|
||||
If you need to restart the server, do the following:
|
||||
|
||||
Reference in new issue
Block a user