refactor(hermes_squid): put sidecars on hermes_proxy instead of admin
Followup tob08d25d. That commit put docker_socket_proxy and brencher-state-proxy on the admin overlay, and added admin to hermes-gateway's networks so the gateway could resolve them. This commit moves the sidecars back onto hermes_proxy (which hermes-gateway is already on), and drops the admin overlay membership from hermes-gateway. Why this is better: 1. hermes-gateway's L3 footprint stays the same as it was before this PR series. No new overlay memberships, no privilege expansion. 2. Docker swarm `internal: true` on hermes_proxy only blocks external INGRESS to services on the overlay. It does NOT block outbound traffic from those services. So brencher-state-proxy's upstream `proxy_pass https://brencher.rudolf.keenetic.link/state` still works (it's a public-internet HTTPS call, not a service-name lookup). 3. nginx_ingress membership for brencher-state-proxy is unnecessary. The upstream call goes over the public internet, not via the nginx-proxy overlay. Removed. 4. NO_PROXY / no_proxy entries added inb08d25dstill apply (brencher-state-proxy and docker_socket_proxy are still on the no-proxy list, just reached via hermes_proxy instead of admin). Final overlay layout: squid -> hermes_proxy + squid_egress sarg -> admin hermes-gateway -> hermes_proxy hermes-ui -> hermes_proxy + default docker_socket_proxy -> hermes_proxy brencher-state-proxy -> hermes_proxy sarg is the only service on admin, and it's there because it reads squid logs (via volumes, not network) and exposes the report UI on host port 8090. No reason to move it. Verified: - YAML parse via PyYAML: ok - hermes-gateway.networks == ['hermes_proxy'] (no admin) - docker_socket_proxy.networks == ['hermes_proxy'] (no admin) - brencher-state-proxy.networks == ['hermes_proxy'] (no admin, no nginx_ingress) - admin overlay still declared (sarg still uses it) - nginx_ingress overlay still declared (sarg doesn't use it but the stack predates this PR; leaving for a separate cleanup)
This commit is contained in:
@@ -58,12 +58,11 @@ services:
|
||||
command: gateway run
|
||||
user: "0:0"
|
||||
networks:
|
||||
# No admin overlay membership here: the sidecars (brencher-state-proxy,
|
||||
# docker_socket_proxy) are on hermes_proxy too, so DNS resolves
|
||||
# without expanding hermes-gateway's L3 footprint. The NO_PROXY
|
||||
# list below ensures those requests skip squid.
|
||||
- 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:
|
||||
@@ -132,7 +131,13 @@ services:
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
networks:
|
||||
- admin # so hermes_infra services can reach it as docker_socket_proxy:2375
|
||||
# hermes_proxy: hermes-gateway already lives here, so DNS resolves
|
||||
# the sidecar by name. Despite the overlay's `internal: true` flag,
|
||||
# egress to external IPs is not blocked -- the flag only denies
|
||||
# external ingress to the overlay, not outbound traffic. The sidecar
|
||||
# needs egress to reach any external resource (none today, but the
|
||||
# same overlay can host future sidecars that do).
|
||||
- hermes_proxy
|
||||
environment:
|
||||
BIND_CONFIG: ":2375"
|
||||
LOG_LEVEL: "info"
|
||||
@@ -178,8 +183,14 @@ services:
|
||||
# container itself uses in its own docker-compose.yml.
|
||||
- "host.docker.internal:host-gateway"
|
||||
networks:
|
||||
- admin # so hermes_infra services can reach it
|
||||
- nginx_ingress # so it can reach brencher.rudolf.keenetic.link via the LE front-proxy
|
||||
# hermes_proxy: same as docker_socket_proxy. hermes-gateway is
|
||||
# already on this overlay, so DNS works. Egress is allowed despite
|
||||
# the `internal: true` flag (which only blocks external ingress,
|
||||
# not outbound traffic). The sidecar's upstream
|
||||
# proxy_pass https://brencher.rudolf.keenetic.link/state is a
|
||||
# public-internet HTTPS call, not a service-name lookup, so
|
||||
# nginx_ingress membership is not required.
|
||||
- hermes_proxy
|
||||
configs:
|
||||
- source: brencher_state_proxy_conf
|
||||
target: /etc/nginx/conf.d/brencher-state-proxy.conf
|
||||
|
||||
Reference in New Issue
Block a user