fix: move run-multi-gateways.sh into build context, bake into image #50

Merged
gortium merged 11 commits from fix/multi-gateway-path into master 2026-05-23 02:12:52 +00:00
Collaborator

What

  • Move run-multi-gateways.sh from repo root to ai/hermes/ (inside the Docker build context)
  • COPY the script into the image at /usr/local/bin/run-multi-gateways.sh so it's available at container startup without relying on a manually-placed root-owned copy on the persistent volume
  • Fix compose.yml entrypoint to reference /usr/local/bin/run-multi-gateways.sh instead of the old /opt/data/hermes-tools/ path

Why

The previous setup placed run-multi-gateways.sh at the repo root and referenced it from /opt/data/hermes-tools/ (a persistent volume path). This caused:

  1. File not in build context — the Dockerfile build context is ./hermes, so COPY run-multi-gateways.sh couldn't reach it from the repo root
  2. Root-owned copy on volume — a separate copy had to be manually placed in /opt/data/hermes-tools/ owned by root, with trailing spaces before backslash continuations that broke bash parsing (\ vs \$), causing env: ' ': No such file or directory
  3. Messy repo root — the file doesn't belong at the top level of the compose repo

Changes

File Change
ai/hermes/run-multi-gateways.sh Moved from repo root
ai/hermes/Dockerfile Added COPY --chmod=0755 run-multi-gateways.sh /usr/local/bin/run-multi-gateways.sh
ai/compose.yml Entrypoint now calls bash /usr/local/bin/run-multi-gateways.sh
## What - **Move** `run-multi-gateways.sh` from repo root to `ai/hermes/` (inside the Docker build context) - **COPY** the script into the image at `/usr/local/bin/run-multi-gateways.sh` so it's available at container startup without relying on a manually-placed root-owned copy on the persistent volume - **Fix** compose.yml entrypoint to reference `/usr/local/bin/run-multi-gateways.sh` instead of the old `/opt/data/hermes-tools/` path ## Why The previous setup placed `run-multi-gateways.sh` at the repo root and referenced it from `/opt/data/hermes-tools/` (a persistent volume path). This caused: 1. **File not in build context** — the Dockerfile build context is `./hermes`, so `COPY run-multi-gateways.sh` couldn't reach it from the repo root 2. **Root-owned copy on volume** — a separate copy had to be manually placed in `/opt/data/hermes-tools/` owned by root, with **trailing spaces before backslash continuations** that broke bash parsing (`\ ` vs `\$`), causing `env: ' ': No such file or directory` 3. **Messy repo root** — the file doesn't belong at the top level of the compose repo ## Changes | File | Change | |------|--------| | `ai/hermes/run-multi-gateways.sh` | Moved from repo root | | `ai/hermes/Dockerfile` | Added `COPY --chmod=0755 run-multi-gateways.sh /usr/local/bin/run-multi-gateways.sh` | | `ai/compose.yml` | Entrypoint now calls `bash /usr/local/bin/run-multi-gateways.sh` |
Hermes added 11 commits 2026-05-23 01:37:16 +00:00
The volume mount at /mnt/HoardingCow_docker_data/Hermes/venv overrides the
container's built .venv with an empty or stale host directory, causing
entrypoint.sh line 62 to fail on 'source .venv/bin/activate' (set -e).

The Docker image already builds a complete venv — no need to persist it.
- Add libolm-dev system dep (required by mautrix[encryption])
- Add mautrix[encryption] + openai pip packages to build
- These were previously installed inline at container startup and
  persisted via the fragile venv volume mount (now removed)
Without this,  is empty and entrypoint.sh runs bare 'hermes'
which defaults to interactive chat mode. With a non-TTY stdin
this exits immediately with prompt_toolkit's 'Input is not a
terminal' warning, causing a container restart loop.

The profile gateways (run-multi-gateways.sh) were unaffected
because the script passes 'gateway run' explicitly.
Without this,  is empty and entrypoint.sh runs bare 'hermes'
which defaults to interactive chat mode. With a non-TTY stdin
this exits immediately with prompt_toolkit's 'Input is not a
terminal' warning, causing a container restart loop.

The profile gateways (run-multi-gateways.sh) were unaffected
because the script passes 'gateway run' explicitly.
- Use /opt/hermes/.venv/bin/hermes (full path) — not on PATH
  before entrypoint.sh sources the venv
- Wrap with gosu hermes to avoid root guard in gateway run
- Add error check if hermes binary doesn't exist
Shell prefix didn't work with nohup+gosu chain - Docker compose
env var API_SERVER_ENABLED=true leaked through. Using 'env'
command guarantees the override is in the child process env.
Line 1521 in gateway/config.py: if api_server_enabled or api_server_key:
The compose.yml sets API_SERVER_KEY=hermes_local_key, which was enough
to enable the API server even with API_SERVER_ENABLED=false.
fix: move run-multi-gateways.sh into ai/hermes/ and bake into image
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
Build ollama (gfx906) / build (pull_request) Has been cancelled
c1cd9d31e9
gortium merged commit 3d90f57e7f into master 2026-05-23 02:12:52 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gortium/compose#50
No description provided.