fix: isolate gateway from runtime api port

This commit is contained in:
Felipe Domingues 2026-05-28 15:26:19 -03:00
parent 2d48a02271
commit 23e98ca785
2 changed files with 17 additions and 2 deletions

View file

@ -45,6 +45,11 @@ platform provisions all of these automatically for managed Railway services.
`TELEGRAM_BOT_TOKEN` is present, so the container consumes Telegram polling in `TELEGRAM_BOT_TOKEN` is present, so the container consumes Telegram polling in
addition to serving the dashboard/proxy runtime API. addition to serving the dashboard/proxy runtime API.
By default the entrypoint hides `API_SERVER_KEY` from the gateway subprocess so
Hermes does not start its native `api_server` adapter on the same public port as
the Mika runtime proxy. Set `HERMES_GATEWAY_API_SERVER_ENABLED=true` only if you
intentionally want the native adapter as a separate gateway platform.
## Validation ## Validation
```bash ```bash

View file

@ -17,6 +17,7 @@ STT_OPENAI_MODEL="${HERMES_STT_OPENAI_MODEL:-whisper-1}"
TTS_PROVIDER="${HERMES_TTS_PROVIDER:-disabled}" TTS_PROVIDER="${HERMES_TTS_PROVIDER:-disabled}"
GATEWAY_ENABLED="${HERMES_GATEWAY_ENABLED:-auto}" GATEWAY_ENABLED="${HERMES_GATEWAY_ENABLED:-auto}"
GATEWAY_ARGS="${HERMES_GATEWAY_ARGS:---replace}" GATEWAY_ARGS="${HERMES_GATEWAY_ARGS:---replace}"
GATEWAY_API_SERVER_ENABLED="${HERMES_GATEWAY_API_SERVER_ENABLED:-false}"
HERMES_ALLOW_ROOT_GATEWAY="${HERMES_ALLOW_ROOT_GATEWAY:-1}" HERMES_ALLOW_ROOT_GATEWAY="${HERMES_ALLOW_ROOT_GATEWAY:-1}"
export HERMES_ALLOW_ROOT_GATEWAY export HERMES_ALLOW_ROOT_GATEWAY
@ -153,8 +154,17 @@ esac
if [ "$should_start_gateway" = "true" ]; then if [ "$should_start_gateway" = "true" ]; then
echo "[entrypoint] Iniciando gateway de mensagens Hermes..." echo "[entrypoint] Iniciando gateway de mensagens Hermes..."
# shellcheck disable=SC2086 if [ "$GATEWAY_API_SERVER_ENABLED" = "true" ]; then
hermes gateway run $GATEWAY_ARGS & # shellcheck disable=SC2086
hermes gateway run $GATEWAY_ARGS &
else
# The public runtime API is served by skills_api.py. Provisioned Mika
# instances still receive API_SERVER_KEY for that proxy, so hide it from
# the gateway process to avoid starting Hermes' native api_server adapter
# on the same public port.
# shellcheck disable=SC2086
API_SERVER_ENABLED=false API_SERVER_KEY= hermes gateway run $GATEWAY_ARGS &
fi
GATEWAY_PID="$!" GATEWAY_PID="$!"
PIDS+=("$GATEWAY_PID") PIDS+=("$GATEWAY_PID")
else else