Document isolated Hermes Webapp development test and rollback
This commit is contained in:
1 parent
9abee55397
commit
a70a5fd57c
4 files changed
+242
No files matched your search
@@ -0,0 +1,123 @@
|
||||
# Isolated Hermes Webapp test — 26 October 2026
|
||||
|
||||
Requested deployment: alternate the production and test containers at the same
|
||||
network address and ports, without changing Nginx or any VPN container. This is
|
||||
a development-build test, not a claim of a released, manufacturer-built image.
|
||||
|
||||
## Scope and packaging
|
||||
|
||||
- Production: `Hermes-Agent-Desktop`; its image and data remain intact.
|
||||
- Alternate: `Hermes-Webapp-Test`, image `local/hermes-webapp-test:e5f2b153`.
|
||||
- All host-side test data, source, recipes, private clone requests and reports:
|
||||
`/mnt/nvme-storage/appdata/Hermes-Webapp-Test/` (root mode `0700`).
|
||||
- Test data is a separate copy under `data/`, mounted at the same `/opt/data`.
|
||||
Copies exclude every file named `vpn.auth`; symlinks are not followed.
|
||||
Private clone requests contain credentials and must never enter Git.
|
||||
- Source pin: `e5f2b15300a3d04978e4c07cc64adc7bcf8e7b1c` from the official
|
||||
NousResearch/hermes-agent repository. The published `main-desktop` image
|
||||
inspected beforehand was older and lacked Webapp support.
|
||||
- The stock Dockerfile omits Desktop source and does not build its Webapp.
|
||||
Our packaging-only change admits `apps/desktop` to the build context, runs
|
||||
upstream `node apps/desktop/scripts/build-webapp.mjs` in the frontend build
|
||||
stage and copies its output into the runtime image. No Hermes application
|
||||
code is patched. This packaging extension is ours, not an upstream image.
|
||||
- Build instructions and output are retained in `build/`; Docker manages the
|
||||
actual image layers in its own storage, not as loose image archives.
|
||||
|
||||
## Network and operation
|
||||
|
||||
The alternate preserves the production container's existing shared network
|
||||
namespace, resource limits, credentials, role-specific settings and restart
|
||||
policy. The referenced VPN container is neither inspected nor changed.
|
||||
The old dashboard service is disabled **in the alternate container only**;
|
||||
Webapp binds its former internal port `9119`. The existing external address
|
||||
and proxy route therefore need no port change.
|
||||
|
||||
The clone merges the **current copied `container.env`** over Docker's older
|
||||
environment snapshot. This is essential: the production container predates
|
||||
the recent `HERMES_MANAGED_DIR` addition and uses overlay symlinks, whereas a
|
||||
new container must use that persistent environment variable directly.
|
||||
|
||||
Only one Hermes container may run at a time. After both are provisioned:
|
||||
|
||||
```sh
|
||||
/mnt/nvme-storage/appdata/Hermes-Webapp-Test/build/switch.sh test
|
||||
/mnt/nvme-storage/appdata/Hermes-Webapp-Test/build/switch.sh production
|
||||
```
|
||||
|
||||
The helper checks persisted active-agent counts and a fresh live gateway
|
||||
heartbeat before stopping the current container. It never starts/stops the VPN
|
||||
container. Docker's `unless-stopped` policy preserves a manual stop, but external
|
||||
Unraid autostart/backup/update automation is a separate concern; never start
|
||||
both instances through such automation.
|
||||
|
||||
The first copy is synchronized again while production is stopped, before the
|
||||
test's first start. Subsequent switches do **not** merge data. Chats, skills or
|
||||
configuration changed in the test stay in its data folder; rolling back starts
|
||||
the untouched production data. Shared remote services and SSH targets remain
|
||||
real systems, even though Hermes data is separate.
|
||||
|
||||
## Removal
|
||||
|
||||
Stop and remove only `Hermes-Webapp-Test`, remove only its recorded local image
|
||||
tag/ID, and then delete the explicit test root above. Remove its specifically
|
||||
named Unraid template if registered. Do not run global image/volume/system
|
||||
pruning or touch production appdata. Build cache is managed by Docker; the
|
||||
current build uses the existing default builder, so global cache pruning is
|
||||
not an acceptable test-cleanup action.
|
||||
|
||||
## Acceptance
|
||||
|
||||
Before change: the existing thirteen-profile configuration/runtime audit passed
|
||||
280 checks with no failures. Build, alternate-container startup, post-change
|
||||
audit and browser checks must be recorded separately after execution. Native
|
||||
Mac, Conduit, inference, TTS and notification delivery are not proven merely
|
||||
by a working browser page.
|
||||
|
||||
## Execution record
|
||||
|
||||
- Build completed successfully. Image ID:
|
||||
`sha256:95a5bb76a1683292a3fe87464d62f17711b43afb796864aa759a8205f421a9aa`.
|
||||
Pinned install stamp and compiled `dist-webapp/index.html` checked in a
|
||||
network-disabled, read-only temporary container.
|
||||
- Offline compatibility audit: 278/280 passed. The two remaining assertions
|
||||
hard-code the old running container's `/etc/hermes` overlay symlinks. The
|
||||
new container intentionally uses the documented `HERMES_MANAGED_DIR`
|
||||
environment bootstrap instead; this difference must not be called a
|
||||
successful symlink check.
|
||||
- Production was confirmed idle from fresh gateway metadata, stopped normally,
|
||||
and copied again before the test's first start. Its image and data were not
|
||||
migrated or edited.
|
||||
- Test is running with the same 2-CPU/4-GiB limit and `unless-stopped`; original
|
||||
container is stopped. No VPN-container operation was performed.
|
||||
- Direct LAN port `http://192.168.1.2:9120/` and existing proxy
|
||||
`https://hermes.casaderoll.de/` redirect to sign-in. LAN sign-in page returned
|
||||
HTTP 200 and was visibly checked in the browser. Login uses the copied
|
||||
existing authentication, not a new password.
|
||||
- Manufacturer stage2 changes root `config.yaml` to mode `0640` at boot.
|
||||
Restored `0600` in the **test copy only** after startup, matching the existing
|
||||
stricter audit. A subsequent manufacturer boot applies `0640` again; no
|
||||
upstream startup-code patch was added to conceal this behavior. The test
|
||||
data root remains private. Managed `.env` remains `0600`.
|
||||
- Startup briefly returned `gateway_not_ready`/503, then reached sign-in
|
||||
normally. No restart loop was observed.
|
||||
- An attempt to emit filtered Hermes startup logs was refused by automatic
|
||||
approval review because filtering cannot guarantee removal of credentials.
|
||||
It was not retried indirectly; diagnosis proceeded through safe status
|
||||
fields and public source instead.
|
||||
- User signed in normally. Authenticated browser UI showed all 13 bots Ready,
|
||||
the Privat/KIT groups and existing chat previews. No chat message was sent.
|
||||
The visible `syncthing-blade` MCP notification requests re-authentication;
|
||||
no credential reset or MCP repair was performed.
|
||||
- Post-start audit after restoring root config mode: 278/280 passed; only the
|
||||
two old overlay-symlink assertions remain. Independently verified the actual
|
||||
running container's `HERMES_MANAGED_DIR`, `get_managed_dir()`, managed config
|
||||
keys and nonempty managed credential resolver. No credential values emitted.
|
||||
- Compared all fourteen root/profile/managed YAML files internally. Thirteen
|
||||
match exactly. Root differs in the enabled Webapp plus manufacturer migration:
|
||||
`_config_version` and removal of `browser.extension_control`. Official step
|
||||
51→52 removes the old built-in browser tools/extension control in favor of
|
||||
`browser_exec`; this is a substantive development-branch compatibility limit,
|
||||
not a claim that browser behavior is identical. Production files are intact.
|
||||
- Native Mac/Conduit behavior and actual model/audio/browser/plugin actions
|
||||
remain untested. This operation initiated no inference or delivery tests.
|
||||
@@ -0,0 +1,24 @@
|
||||
diff --git a/tmp/hermes-webapp-Dockerfile b/tmp/Hermes-Webapp-Test.Dockerfile
|
||||
index d7fa4f7..1104adf 100644
|
||||
--- a/tmp/hermes-webapp-Dockerfile
|
||||
+++ b/tmp/Hermes-Webapp-Test.Dockerfile
|
||||
@@ -322,6 +322,9 @@ COPY --from=icons /tmp/hermes-icons /tmp/hermes-icons
|
||||
RUN node scripts/build/tui.mjs --source /opt/hermes --out /opt/products/tui && \
|
||||
node scripts/build/web.mjs --source /opt/hermes --icons /tmp/hermes-icons --out /opt/products/web
|
||||
|
||||
+COPY . .
|
||||
+RUN node apps/desktop/scripts/build-webapp.mjs
|
||||
+
|
||||
FROM python_deps AS runtime
|
||||
# Standalone TypeScript linting is a runtime feature; Vite/esbuild are not.
|
||||
COPY --from=frontend_build /opt/hermes/node_modules/typescript /opt/hermes/node_modules/typescript
|
||||
@@ -366,6 +369,9 @@ RUN mkdir -p /tmp/hermes-runtime && chmod 0700 /tmp/hermes-runtime
|
||||
# write so the build steps below don't need chmod u+w dances.
|
||||
COPY --link --chmod=a+rX,go-w . .
|
||||
|
||||
+# Webapp renderer built by the upstream product builder.
|
||||
+COPY --from=frontend_build /opt/hermes/apps/desktop/dist-webapp /opt/hermes/apps/desktop/dist-webapp
|
||||
+
|
||||
# The shared assembler binds the prepared environment and frontend products.
|
||||
RUN /opt/hermes/.venv/bin/python -m docker.build_agent
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
"""Prepare an isolated alternate Hermes container; never contact Docker here.
|
||||
|
||||
Run in a temporary, network-disabled helper using the old Hermes image:
|
||||
docker run --rm --network none -v TEST_ROOT:/test \
|
||||
--entrypoint /opt/hermes/.venv/bin/python OLD_IMAGE /test/build/prepare-container.py
|
||||
The operator passes the resulting private create request to Docker locally.
|
||||
No credentials are printed. Production appdata is never mounted in the helper.
|
||||
"""
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, '/opt/hermes')
|
||||
import hermes_yaml as yaml
|
||||
|
||||
root = Path('/test')
|
||||
original = json.loads((root / 'build/production-container.private.json').read_text())[0]
|
||||
assert original['Name'] == '/Hermes-Agent-Desktop'
|
||||
host_root = '/mnt/nvme-storage/appdata/Hermes-Webapp-Test'
|
||||
prod_root = '/mnt/nvme-storage/appdata/Hermes-Agent-Desktop'
|
||||
config = original['Config'].copy()
|
||||
config['Image'] = 'local/hermes-webapp-test:e5f2b153'
|
||||
# Docker owns hostname selection when joining an existing network namespace.
|
||||
config.pop('Hostname', None)
|
||||
config.pop('Domainname', None)
|
||||
env = dict(v.split('=', 1) for v in config.get('Env', []) if '=' in v)
|
||||
# Docker's snapshot can predate persistent env-file changes. Apply that same
|
||||
# env-file internally, without executing it or displaying any of its values.
|
||||
for raw in (root / 'data/container.env').read_text().splitlines():
|
||||
line = raw.lstrip()
|
||||
if not line or line.startswith('#'):
|
||||
continue
|
||||
assert '=' in line, 'Bare inherited env keys are not supported by this clone'
|
||||
key, value = line.split('=', 1)
|
||||
env[key] = value
|
||||
assert env.get('HERMES_MANAGED_DIR') == '/opt/data/managed'
|
||||
env['HERMES_DASHBOARD'] = '0'
|
||||
config['Env'] = [f'{k}={v}' for k, v in env.items()]
|
||||
config.setdefault('Labels', {})['de.casaderoll.test'] = 'hermes-webapp'
|
||||
hc = original['HostConfig'].copy()
|
||||
assert hc['NetworkMode'].startswith('container:')
|
||||
binds = hc.get('Binds') or []
|
||||
assert len(binds) == 1 and binds[0].split(':')[:2] == [prod_root, '/opt/data']
|
||||
parts = binds[0].split(':')
|
||||
parts[0] = host_root + '/data'
|
||||
hc['Binds'] = [':'.join(parts)]
|
||||
# An alternate, manually stopped container stays stopped with this policy.
|
||||
assert hc['RestartPolicy']['Name'] == 'unless-stopped'
|
||||
body = {**config, 'HostConfig': hc}
|
||||
p = root / 'build/test-create.private.json'
|
||||
p.write_text(json.dumps(body))
|
||||
p.chmod(0o600)
|
||||
|
||||
cfg_path = root / 'data/config.yaml'
|
||||
cfg = yaml.safe_load(cfg_path.read_text()) or {}
|
||||
cfg['webapp'] = {
|
||||
'enabled': True,
|
||||
'host': '0.0.0.0',
|
||||
'port': 9119,
|
||||
'public_url': cfg.get('dashboard', {}).get('public_url', 'http://192.168.1.2:9120'),
|
||||
}
|
||||
cfg_path.write_text(yaml.safe_dump(cfg, allow_unicode=True, sort_keys=False))
|
||||
cfg_path.chmod(0o600)
|
||||
os.chown(cfg_path, 99, 100)
|
||||
print('Prepared private create request; only copied root config changed: webapp on port 9119.')
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
# Alternate the two Hermes containers; no VPN-container operations.
|
||||
set -eu
|
||||
case "${1:-}" in
|
||||
test) target=Hermes-Webapp-Test; other=Hermes-Agent-Desktop ;;
|
||||
production) target=Hermes-Agent-Desktop; other=Hermes-Webapp-Test ;;
|
||||
*) echo 'Usage: switch.sh test|production' >&2; exit 2 ;;
|
||||
esac
|
||||
docker inspect "$target" >/dev/null
|
||||
if [ "$(docker inspect -f '{{.State.Running}}' "$other")" = true ]; then
|
||||
docker exec --user 99:100 -i "$other" /opt/hermes/.venv/bin/python - <<'PY'
|
||||
import datetime, json, os
|
||||
from pathlib import Path
|
||||
root = Path('/opt/data')
|
||||
paths = [root/'gateway_state.json'] + list((root/'profiles').glob('*/gateway_state.json'))
|
||||
assert paths[0].is_file(), 'No gateway status; refusing a blind stop'
|
||||
for p in paths:
|
||||
d = json.loads(p.read_text())
|
||||
assert int(d.get('active_agents', 0)) == 0, 'Hermes is busy; wait before switching'
|
||||
if p == paths[0]:
|
||||
os.kill(int(d['pid']), 0)
|
||||
age = datetime.datetime.now(datetime.timezone.utc) - datetime.datetime.fromisoformat(d['updated_at'])
|
||||
assert age.total_seconds() < 120, 'Gateway heartbeat stale; inspect before switching'
|
||||
print('No active agent turns in the persisted gateway status.')
|
||||
PY
|
||||
docker stop --time 120 "$other"
|
||||
fi
|
||||
docker start "$target"
|
||||
echo "Running: $target. Other instance remains stopped. Data folders are independent."
|
||||
Reference in new issue
Block a user