fix(hermes_squid): let hermes-gateway reach the new sidecars

The sidecars added in this PR (brencher-state-proxy, docker_socket_proxy)
are reachable on the admin overlay, but hermes-gateway was not.

hermes-gateway was only on the hermes_proxy overlay, so Docker's
embedded DNS could not resolve the new service names from
inside the gateway container. The first
`requests.get("http://brencher-state-proxy:8080/state")` would
have raised `ConnectionError` with "Name or service not known".

NO_PROXY / no_proxy did not list the sidecar hostnames, so even
after fixing overlay membership, any HTTP client inside the
gateway (requests, urllib, etc.) would have routed the call
through squid. Squid would 403 it because the sidecars are not
on the public allowed_domains list, and the overlay DNS names
don't resolve from squid's process.

This commit:
  - Adds 'admin' to hermes-gateway's networks list, so the gateway
    has L3 reachability to the sidecars on the admin overlay.
  - Adds 'brencher-state-proxy' and 'docker_socket_proxy' to both
    NO_PROXY and no_proxy so requests skip squid and hit the
    sidecars directly.

After this change, code running inside the swarm can do:

    import requests
    requests.get("http://brencher-state-proxy:8080/state")    # public
    requests.get("http://brencher-state-proxy:8080/state2")   # secondary
    os.environ["DOCKER_HOST"] = "tcp://docker_socket_proxy:2375"

and the requests will reach the sidecars without going through squid.

Note: the new overlay membership means hermes-gateway can now L3-reach
ALL services on the admin overlay (registry, gitea, hermes, immich,
gmail_mcp, torrserv_proxy in the brencher stack). That is by design --
the gateway has always been a privileged position in the stack and the
overlay is internal. NO_PROXY is the safety belt that keeps it from
proxying those calls through squid by accident.

Verified:
  - YAML parse via PyYAML: ok
  - hermes-gateway.networks == ['hermes_proxy', 'admin']
  - hermes-gateway.environment.NO_PROXY contains both sidecar names
  - hermes-gateway.environment.no_proxy contains both sidecar names
This commit is contained in:
hermes
2026-08-26 07:12:25 +00:00
parent 0276497a37
commit b08d25df2f
+11 -2
View File
@@ -59,6 +59,11 @@ services:
user: "0:0"
networks:
- hermes_proxy
# admin overlay gives L3 reachability to the sidecars added
# by this PR (brencher-state-proxy, docker_socket_proxy). Combined
# with the NO_PROXY update below, this lets hermes-agent reach
# them directly without going through squid.
- admin
volumes:
- hermes_gateway_data:/opt/data
environment:
@@ -71,8 +76,12 @@ services:
HTTPS_PROXY: http://squid:3128
http_proxy: http://squid:3128
https_proxy: http://squid:3128
NO_PROXY: localhost,127.0.0.1,squid,hermes-gateway,hermes-agent
no_proxy: localhost,127.0.0.1,squid,hermes-gateway,hermes-agent
# The sidecars added in this PR (brencher-state-proxy, docker_socket_proxy)
# are reachable on the admin overlay. They are NOT public services, so
# traffic to them MUST NOT be routed through squid (which can't reach
# them anyway and would 403 the request).
NO_PROXY: localhost,127.0.0.1,squid,hermes-gateway,hermes-agent,brencher-state-proxy,docker_socket_proxy
no_proxy: localhost,127.0.0.1,squid,hermes-gateway,hermes-agent,brencher-state-proxy,docker_socket_proxy
depends_on:
- squid
deploy: