feat: enhance Docker setup and startup script for Hermes WebUI#1686
feat: enhance Docker setup and startup script for Hermes WebUI#1686binhpt310 wants to merge 1 commit intonesquena:masterfrom
Conversation
- Added git and xz-utils to Dockerfile for improved build capabilities. - Updated docker-compose.yml to specify build context and Dockerfile location. - Enhanced start.sh to handle environment variable parsing more robustly and set Python executable path.
ReviewReading the diff at 🔴 Blocker: syntax error in the regression test file
ROUTES_PY = (REPO_ROOT / "api" / "routes.py").read_text(encoding="utf-8")
AUTH_PY=*** / "api" / "auth.py").read_text(encoding="utf-8")That looks like an editor/tool artefact from a redacted diff — the test file simply will not parse. AUTH_PY = (REPO_ROOT / "api" / "auth.py").read_text(encoding="utf-8")…which is then asserted against at line 107 ( 🟡 AuthenticationThe endpoint goes through What concerns me more is the default-no-auth case: a fresh WebUI install with no password set has
Note: the polled 🟢 Implementation looks good
def _cpu_percent() -> float:
start = _read_proc_stat_cpu()
time.sleep(_CPU_SAMPLE_SECONDS) # 0.05s
end = _read_proc_stat_cpu()
return _cpu_delta_percent(start, end)50ms blocking sleep on every poll is fine in practice (BaseHTTPServer is threaded), but worth noting this will serialize behind the GIL alongside other GETs. At 5s polling per client × small instance, totally negligible.
The frontend at One small nit: Action items
Once the test file parses I'd be happy with this. Closes #693 — the feature itself is well-scoped and matches the feature request shape. |
|
Thanks for the patch. Three of the symptoms you describe are real ( CI is red on this branch
The guard at def test_start_sh_and_bootstrap_equivalent_env_loading(self):
start_sh = (REPO_ROOT / "start.sh").read_text(encoding="utf-8")
...
assert "source" in start_sh and ".env" in start_sh, (
"start.sh should still source .env (regression guard)"
)Your replacement loop never says set -a
source <(grep -vE "^[[:space:]]*(export[[:space:]]+)?(UID|GID|EUID|EGID|PPID|PID)=" "${REPO_ROOT}/.env")
set +aSame effect as your filter, half the lines, no test churn. Compose context change is breakingThe PR rewrites build:
context: ..
dockerfile: hermes-webui/Dockerfileand the Dockerfile then does The canonical user flow is clone the repo, cd in, then bring up the stack. With this PR applied, that breaks: For two-container layouts, The /app/venv early-exit in start.sh bypasses docker_init.bashif [[ -f "/.within_container" && -x "/app/venv/bin/python" ]]; then
export HERMES_WEBUI_PYTHON="/app/venv/bin/python"
exec "/app/venv/bin/python" "${REPO_ROOT}/bootstrap.py" --no-browser "$@"
fi
Also: the Dockerfile pre-bakes Pieces that look correct and should be split out
RecommendationSplit this into two surgical PRs:
The pre-bake-agent-source plus change-compose-context piece needs a separate design conversation. One question on the |
|
Thanks @binhpt310 — your fixes for the We need to defer this PR from the v0.51.5 release pass because the Dockerfile + docker-compose.yml shape it introduces makes the build context-dependent on a sibling repo: # docker-compose.yml:
build:
context: ..
dockerfile: hermes-webui/DockerfileThis means the build now requires a parent directory containing both …will hit There are a few ways forward — pick whichever fits best: Option A — Build arg (smallest change): ARG WITH_AGENT_SOURCE=0
RUN if [ "$WITH_AGENT_SOURCE" = "1" ]; then \
mkdir -p /opt/hermes && \
cp -r /tmp/hermes-agent-desktop/hermes-agent /opt/hermes/; \
fi
Option B — Vendor a download helper: Option C — Drop the agent-pre-bake and keep the rest: The other improvements in this PR are all valuable on their own — the A secondary nit (not blocking): the start.sh re-execs as Happy to absorb a v2 with Option A or C as soon as it lands. The infrastructure half of this is unambiguously good. |
4 PRs (1 surface addition, 3 fixes): - nesquena#1688 VPS resource health Insights panel (@Michaelyklam, closes nesquena#693) - nesquena#1709 preserve scroll on stream completion (@Michaelyklam, closes nesquena#1690) - nesquena#1711 hide rename tooltip on folders (@nesquena-hermes, closes nesquena#1710) - nesquena#1712 guard localStorage.setItem against QuotaExceededError (@24601) Tests: 4504 → 4527 (+23). Opus: SHIP, 6/6 verification clean. Held back: nesquena#1686 (Docker enhance) — Opus flagged sibling-repo dep that breaks standalone clones. Left open for follow-up. Co-authored-by: Michael Lam <[email protected]> Co-authored-by: 24601 <[email protected]>
Problem
Running
./start.shinside the Docker container causes two failures:xz: Cannot exec: No such file or directory—xz-utilsmissingnpm installhangs indefinitely during agent auto-install.envUID/GID variables are readonly in bashSolution
xz-utilsandgitto DockerfileHERMES_WEBUI_AGENT_DIRto skip network installsstart.shto safely parse.env(skip readonly vars)start.shto avoid permission issuesdocker-compose.ymlbuild context to include agent sourceTesting
docker compose build --no-cache docker compose up -d docker exec -it hermes-webui-hermes-webui-1 /apptoo/start.sh