feat(hermes_squid): enable local STT via faster-whisper (runtime install)

Replace the previous PR #20 which used a custom Dockerfile-hermes.
This new version uses a bind-mounted entrypoint script that installs
faster-whisper at first start instead of baking it into the image.

Why the change:
- pypi.org is now whitelisted in squid, so runtime pip install works
- avoids maintaining a custom hermes-agent image
- the upstream nousresearch/hermes-agent image is kept as-is

Changes:
- hermes_squid/squid.conf: new stt_pkg_domains ACL (pypi, huggingface,
  github, models.dev, registry.npmjs, files.pythonhosted,
  cdn-lfs.huggingface) for runtime pip and HF model fetch; new
  telegram_ips ACL covering AS62041 as a backstop for squid's
  dstdomain rule which does not match HTTPS CONNECT in some cases
  (24 of 9083 api.telegram.org requests were denied in recent log).
  Renamed hermes_network -> localnet (squid default).
- hermes_squid/hermes-gateway-entrypoint.sh (new): installs
  python3-pip + ffmpeg via apt and faster-whisper via pip3 on first
  start. Idempotent: skips install if faster_whisper importable.
  Exports STT_PROVIDER=local and model/device pins, then execs the
  original gateway command.
- hermes_squid/stack-compose.yml: hermes-gateway now uses
  entrypoint=[/opt/data/hermes-gateway-entrypoint.sh], binds the
  script from ./, and adds STT_* env vars. Other services untouched.
This commit is contained in:
hermes
2026-08-29 17:06:08 +00:00
parent 4cb8eeae35
commit 37af4ae572
3 changed files with 41 additions and 6 deletions
+25
View File
@@ -0,0 +1,25 @@
#!/bin/sh
set -e
need_setup=0
if ! command -v pip3 >/dev/null 2>&1; then
need_setup=1
elif ! python3 -c "import faster_whisper" >/dev/null 2>&1; then
need_setup=1
fi
if [ "$need_setup" = "1" ]; then
apt-get update
apt-get install -y --no-install-recommends python3-pip ffmpeg
rm -rf /var/lib/apt/lists/*
if ! python3 -c "import faster_whisper" >/dev/null 2>&1; then
pip3 install --break-system-packages --no-cache-dir faster-whisper
fi
fi
export STT_PROVIDER=local
export STT_LOCAL_MODEL=base
export STT_LOCAL_DEVICE=cpu
export STT_LOCAL_COMPUTE_TYPE=int8
exec "$@"
+9 -5
View File
@@ -1,16 +1,20 @@
acl hermes_network src 10.0.0.0/8
acl hermes_network src 172.16.0.0/12
acl hermes_network src 192.168.0.0/16
acl localnet src 10.0.0.0/8
acl localnet src 172.16.0.0/12
acl localnet src 192.168.0.0/16
acl allowed_domains dstdomain .minimax.io .minimax.chat .minimax.com .githubusercontent.com deb.debian.org gitea.rudolf.keenetic.link
acl telegram_domains dstdomain .telegram.org .t.me
acl stt_pkg_domains dstdomain .pypi.org .files.pythonhosted.org .huggingface.co .github.com .models.dev .registry.npmjs.org .cdn-lfs.huggingface.co
acl telegram_ips dst 91.108.4.0/22 91.108.8.0/22 91.108.12.0/22 91.108.16.0/22 91.108.20.0/22 91.108.56.0/22 149.154.160.0/20 185.76.151.0/24
acl CONNECT method CONNECT
acl SSL_ports port 443
acl Safe_ports port 80 443
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow hermes_network allowed_domains
http_access allow hermes_network telegram_domains
http_access allow localnet allowed_domains
http_access allow localnet telegram_domains
http_access allow localnet stt_pkg_domains
http_access allow localnet telegram_ips
http_access deny all
http_port 3128
+7 -1
View File
@@ -61,7 +61,8 @@ services:
hermes-gateway:
image: nousresearch/hermes-agent:v2026.8.3
command: gateway run
entrypoint: ["/opt/data/hermes-gateway-entrypoint.sh"]
command: ["gateway", "run"]
user: "0:0"
networks:
# No admin overlay membership here: the sidecars (brencher-state-proxy,
@@ -71,6 +72,7 @@ services:
- hermes_proxy
volumes:
- hermes_gateway_data:/opt/data
- ./hermes-gateway-entrypoint.sh:/opt/data/hermes-gateway-entrypoint.sh:ro
environment:
HERMES_DASHBOARD: "1"
HERMES_DASHBOARD_HOST: "0.0.0.0"
@@ -84,6 +86,10 @@ services:
HTTPS_PROXY: http://squid:3128
http_proxy: http://squid:3128
https_proxy: http://squid:3128
STT_PROVIDER: "local"
STT_LOCAL_MODEL: "base"
STT_LOCAL_DEVICE: "cpu"
STT_LOCAL_COMPUTE_TYPE: "int8"
# The sidecars added in this PR (brencher-state-proxy, docker_socket_proxy)
# are reachable on the hermes_proxy overlay. They are NOT public services, so
# traffic to them MUST NOT be routed through squid (which can't reach