Compare commits

..
Author SHA1 Message Date
hermes 3a68e81c56 fix(hermes_infra/gitea): add dedicated act_runner cache-server
The built-in act_runner cache-server binds to an interface unreachable
from per-job container networks (default container.network: ""), so
ACTIONS_CACHE_URL resolves to 192.168.112.21:37051 and every job burns
~9 minutes on:

    ::warning::Failed to save:   reserveCache failed: connect ETIMEDOUT
    ::warning::Failed to restore: getCacheEntry  failed: connect ETIMEDOUT

Measured on PR #15 in admin/brencher (gitea/actions/runs/16):
each of 3 jobs ≈12 min wall-clock, of which 9 min is dead air waiting
for cache timeouts.

Run a dedicated act_runner cache-server on the same overlay network and
point the runner at it via external_server. secret shared via
ACT_RUNNER_EXTERNAL_SECRET env on both services.

Related: admin/brencher#15 (whose python-package.yml enables cache:'pip'
but currently gets no benefit because the cache backend is unreachable).

Refs: gitea/actions/runs/16 (job #248 logs)
2026-09-03 18:40:10 +00:00
hermes 6848d114a7 chore(hermes_squid): remove brencher-state-proxy
Drop the brencher-state-proxy sidecar from hermes_infra -- it is
no longer needed. The sidecar existed to relay /state from
brencher.rudolf.keenetic.link into the admin overlay; that relay is
unnecessary since brencher ingress handles the path itself.

Changes vs the brencher-state-proxy commit that was merged in #4:
- delete hermes_squid/brencher-state-proxy.conf
- remove the brencher-state-proxy: service block from
  hermes_squid/stack-compose.yml
- remove the brencher_state_proxy_conf: top-level config object
- drop brencher-state-proxy from the NO_PROXY / no_proxy lists
- update the surrounding comments
2026-08-29 22:47:36 +00:00
c3b7128006 hermes_squid: open docker_socket_proxy to full read-only scope (#4)
Flip CONTAINERS/IMAGES/NETWORKS/VOLUMES/SERVICES/TASKS/NODES from 0 to 1 so hermes-agent can inspect running stacks (read container logs, enumerate swarm services) without going through each node's shell.

POST stays 0 — no container creation, no image builds, no exec into running containers. Anything that mutates state remains blocked at the proxy level.

---------

Co-authored-by: admin <rudolfss13@gmail.com>
Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/ansible/pulls/4
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
2026-08-30 00:09:56 +02:00
hermesandhermes 0c95d8e1ee feat(hermes_squid): enable local STT via faster-whisper (runtime install) (#21)
## What

Wires up local STT (faster-whisper) into the hermes-gateway container so voice messages on Telegram transcribe without depending on external services.

Closes #19. Supersedes the closed #20 (which used a custom Dockerfile-hermes; this version uses a bind-mounted entrypoint script instead since pypi.org is now whitelisted).

## Changes

1. **`hermes_squid/squid.conf`** — expands the egress whitelist:
   - new `stt_pkg_domains` for `pypi.org`, `files.pythonhosted.org`, `huggingface.co`, `github.com`, `models.dev`, `registry.npmjs.org`, `cdn-lfs.huggingface.co` — needed for runtime `pip install faster-whisper` and HF model fetch.
   - new `telegram_ips` covering AS62041 (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) as a backstop for the `dstdomain` ACL. squid's `dstdomain` does not match HTTPS CONNECT requests without `ssl_bump`, so the recent log shows 24 of 9083 `api.telegram.org` requests getting 403 in a 5-minute window.
   - renamed `hermes_network` -> `localnet` (squid default name, no behavior change).

2. **`hermes_squid/hermes-gateway-entrypoint.sh`** (new) — bind-mounted into the container at `/opt/data/hermes-gateway-entrypoint.sh` and set as the service entrypoint. The script:
   - is idempotent: on first start, runs `apt-get install -y python3-pip ffmpeg` and `pip3 install --break-system-packages faster-whisper`. Subsequent restarts skip install if `faster_whisper` is already importable.
   - exports `STT_PROVIDER=local`, `STT_LOCAL_MODEL=base`, `STT_LOCAL_DEVICE=cpu`, `STT_LOCAL_COMPUTE_TYPE=int8`.
   - `exec`s the original gateway command (`gateway run`).

3. **`hermes_squid/stack-compose.yml`** — `hermes-gateway` gets:
   - `entrypoint: ["/opt/data/hermes-gateway-entrypoint.sh"]`
   - `command: ["gateway", "run"]`
   - bind-mount `./hermes-gateway-entrypoint.sh:/opt/data/hermes-gateway-entrypoint.sh:ro`
   - new env: `STT_PROVIDER`, `STT_LOCAL_MODEL`, `STT_LOCAL_DEVICE`, `STT_LOCAL_COMPUTE_TYPE`

No other service in the compose file is touched.

## Why runtime install, not a custom image

- `pypi.org` is now whitelisted, so `pip3 install` works at runtime through the same squid.
- Avoids maintaining a custom hermes-agent image and a local registry tag.
- The upstream `nousresearch/hermes-agent:v2026.8.3` image is kept as-is.

## Deploy notes

- brencher apply will trigger `docker service update` for hermes-gateway; the new entrypoint runs the apt+pip install on first start (~1-2 min).
- First start also downloads the `base` faster-whisper model (~150 MB) from `huggingface.co` — covered by `stt_pkg_domains`.
- squid config is reread on `docker service update` for the squid service; new ACLs apply without a full stack restart.
- Subsequent restarts of hermes-gateway skip the install path entirely (idempotent guard).

## Verified locally

- `git diff --stat upstream/master` shows only the three files above (+25 entrypoint, +14 squid, +8 compose).
- The new worktree is `/opt/data/work/thread-114-Alex-InfraAlexBot/ansible` (per-session working dir).

## Risks

- `apt-get update` inside the container needs `deb.debian.org` reachable — already in `allowed_domains`.
- `STT_LOCAL_MODEL=base` is ~150 MB and runs on CPU. If latency on Raspberry-class nodes is bad, switch to `tiny`.
- `--break-system-packages` is required for PEP 668 (Debian trixie + Python 3.11+). If the upstream image switches to PEP 668 strictly, this flag is the right escape hatch.

## Related

- #19 — investigation that found missing faster-whisper + squid deny pattern
- #20 — superseded (used Dockerfile-hermes instead of runtime install)

---------

Co-authored-by: hermes <hermes@rudolf.keenetic.link>
Reviewed-on: http://192.168.1.96/admin/ansible/pulls/21
Reviewed-by: admin <rudolfss13@gmail.com>
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
2026-08-29 22:53:46 +02:00
8 changed files with 51 additions and 950 deletions
-37
View File
@@ -1,37 +0,0 @@
# Architecture diagram
![Architecture diagram](./standalone-adaptive.svg)
Snapshot: 2026-08-27. Light/dark theme via `prefers-color-scheme`.
## What
- **Left column:** external (Client, Tailscale, Keenetic) + lan + all 22 overlay networks. One block = one network.
- **Right column:** all stacks. Inside each stack — its nodes (containers).
## How to update
1. Re-fetch live state from the cluster:
```
curl http://docker_socket_proxy:2375/networks | python3 -m json.tool > /tmp/nets.json
curl http://docker_socket_proxy:2375/services | python3 -m json.tool > /tmp/services.json
curl http://docker_socket_proxy:2375/tasks?filters='{"desired-state":"running"}' > /tmp/tasks.json
```
2. Compare counts/labels against `standalone-adaptive.svg`. Update blocks that changed.
3. For new stacks/services: add a stack rect in the right column + 1+ node rects inside.
4. For new networks: add a network block in the left column at the matching height.
Convention:
- `class="net-fill"` — overlay network (amber border)
- `class="net-external-fill"` — Keenetic/lan (slate)
- `class="ext-client-fill"` — Client (violet border)
- `class="stack-fill"` — running stack (cyan border)
- `class="node-fill"` — running container
- `class="node-dead"` — dead/disabled (red dashed)
- IPs in node title reflect current state — refresh when IPs change
## Sources
- `docker_socket_proxy` (read-only): `/networks`, `/services`, `/tasks`, `/containers/{id}/json`
- `admin/ansible` repo: `poc/*/stack-compose.yml` for stack definitions
- Gitea admin API: `POST /api/v1/repos/admin/ansible/issues` for tickets about drift
-253
View File
@@ -1,253 +0,0 @@
# Architecture diagram — full prod map
> **Snapshot:** 2026-08-27 · sources: `docker_socket_proxy` + gitea admin API
>
> **Two views:**
> - This file — **Mermaid flow** (high-level topology, all elements)
> - `standalone-adaptive.svg` — **per-node detail** (IPs, container names)
```mermaid
flowchart LR
%% ==================== EXTERNAL ====================
subgraph EXT[" "]
direction TB
Client["Client<br/>tailscale"]:::client
Keenetic["Keenetic<br/>DNS · TLS"]:::external
Tailscale["Tailscale<br/>subnet router"]:::external
lan["lan<br/>192.168.1.0/24"]:::external
Client -->|https| Tailscale
Tailscale --> Keenetic
Keenetic -->|TLS term| lan
end
%% ==================== INGRESS / EGRESS ====================
subgraph IO[" "]
direction TB
ingress["ingress<br/>10.0.0.0/24"]:::egress
proxy_egress["squid_egress<br/>hermes_proxy<br/>admin"]:::egress
nginx_nets["nginx_ingress<br/>nginx_default<br/>(DEAD)"]:::egress
lan -.->|egress| ingress
end
%% ==================== STACKS (deployed via brencher) ====================
subgraph BRENCHER_DEPLOYED["via brencher (PROFILES env)"]
direction TB
b_gitea["gitea"]:::stack
b_hermes["hermes"]:::stack
b_hermes_infra["hermes_infra"]:::stack
b_immich["immich"]:::stack
b_gmail_mcp["gmail_mcp"]:::stack
b_torrserv["torrserv_proxy"]:::stack
b_brencher2["brencher2<br/>(deploy tool)"]:::deploy
end
ingress --> b_gitea
ingress --> b_hermes
ingress --> b_hermes_infra
ingress --> b_immich
ingress --> b_gmail_mcp
ingress --> b_torrserv
proxy_egress -.-> b_hermes_infra
b_brencher2 -.->|deploys| b_gitea
b_brencher2 -.->|deploys| b_hermes
b_brencher2 -.->|deploys| b_immich
b_brencher2 -.->|deploys| b_hermes_infra
b_brencher2 -.->|deploys| b_gmail_mcp
b_brencher2 -.->|deploys| b_torrserv
%% ==================== STACKS (standalone, not via brencher) ====================
subgraph STANDALONE["standalone (compose или ручной deploy)"]
direction TB
s_dsp["docker_socket_proxy"]:::stack
s_lampa["lampa-jackett<br/>(compose)"]:::stack
s_photosHelper["photosHelper<br/>(DEAD · Replicas: 0)"]:::dead
s_nginx["nginx<br/>(DEAD · Replicas: 0)"]:::dead
s_registry["registry<br/>(DEAD · Replicas: 0)"]:::dead
end
ingress --> s_dsp
ingress --> s_lampa
%% ==================== ZOMBIE STACKS (volumes only, no services) ====================
subgraph ZOMBIE["zombie stacks (volumes orphaned)"]
direction TB
z_nextcloud["nextcloud<br/>(4 volumes)"]:::dead
z_portainer["portainer<br/>(1 volume)"]:::dead
z_swarmpit["swarmpit<br/>(1 volume)"]:::dead
z_sstp["sstp · softether<br/>(4 volumes)"]:::dead
z_test["test<br/>(1 volume)"]:::dead
z_torr_cache["torr_cache<br/>(1 volume)"]:::dead
z_beszel["beszel-poc<br/>(2 volumes)"]:::dead
end
%% ==================== EPHEMERAL (gitea act_runner jobs) ====================
subgraph EPHEMERAL["gitea act_runner ephemeral jobs"]
direction TB
eph_jobs["~48 exited<br/>ephemeral job pods<br/>(random names)"]:::ephemeral
end
b_gitea -.->|spawns| eph_jobs
%% ==================== INTERNAL NETS (one per stack) ====================
subgraph INTERNAL["internal nets (12)"]
direction TB
gitea_net["gitea_gitea"]:::internal
hermes_net["hermes_hermes"]:::internal
hi_net["hermes_infra_default"]:::internal
immich_net["immich_default"]:::internal
gmail_net["gmail_mcp_default"]:::internal
torr_net["torrserv_proxy_default"]:::internal
brencher2_nets["brencher2-net +<br/>brencher2_default"]:::internal
dsp_net["dsp_default"]:::internal
lampa_net["lampa_default"]:::internal
b_gitea --> gitea_net
b_hermes --> hermes_net
b_hermes_infra --> hi_net
b_immich --> immich_net
b_gmail_mcp --> gmail_net
b_torrserv --> torr_net
b_brencher2 --> brencher2_nets
s_dsp --> dsp_net
s_lampa --> lampa_net
end
%% ==================== VOLUMES (153 total) ====================
subgraph VOLS["volumes (153 total, 18 mounted · 135 orphaned)"]
direction TB
vol_active["active: gitea_data · immich_* ·<br/>hermes_*_data · brencher_tmp ·<br/>docker_socket_proxy_*_data ·<br/>torrserv_proxy_data · lampa_*"]:::volumes
vol_orphaned["orphaned: 119 (no stack) ·<br/>nextcloud · portainer · sstp ·<br/>swarmpit · test · torr_cache ·<br/>beszel-poc · immich_postgres"]:::dead
end
%% ==================== SECRETS / CONFIGS (403 from socket proxy) ====================
subgraph SECRETS["secrets & configs (read-only proxy: 403)"]
direction TB
sec_known["known to exist in gitea app.ini:<br/>LFS_JWT_SECRET · JWT_SECRET ·<br/>SECRET_KEY · INTERNAL_TOKEN"]:::secret
sec_hermes["hermes-agent runtime secrets<br/>(gmail creds · telegram token)"]:::secret
end
%% ==================== STYLING ====================
classDef client fill:#0f172a,stroke:#a78bfa,color:#ddd6fe
classDef external fill:#1e293b,stroke:#94a3b8,color:#cbd5e1
classDef egress fill:#052e16,stroke:#22c55e,color:#bbf7d0
classDef stack fill:#0c4a6e,stroke:#22d3ee,color:#cffafe
classDef dead fill:#1f1717,stroke:#fb7185,color:#fecaca,stroke-dasharray: 4 2
classDef deploy fill:#422006,stroke:#fbbf24,color:#fde68a
classDef ephemeral fill:#1e1b4b,stroke:#818cf8,color:#c7d2fe,stroke-dasharray: 2 2
classDef internal fill:#1e1b4b,stroke:#818cf8,color:#c7d2fe
classDef volumes fill:#0f172a,stroke:#475569,color:#cbd5e1
classDef secret fill:#0f172a,stroke:#f59e0b,color:#fde68a,stroke-dasharray: 3 2
```
## Полная картина прода
### 🟢 Running stacks (12)
**Через `brencher` (PROFILES env):**
1. **gitea** — gitea_server + gitea_runner (act_runner для CI)
2. **hermes** — hermes-agent + hermes-gateway
3. **hermes_infra** — squid + sarg + hermes-ui + hermes-gateway + docker_socket_proxy + brencher-state-proxy
4. **immich** — server + database + redis + machine-learning
5. **gmail_mcp** — gmail-mcp-server + telegram-mcp-server
6. **torrserv_proxy** — reverseproxy + fileserver
7. **brencher2** — второй deploy tool (сам себя не деплоит)
**Standalone (не через brencher):**
8. **docker_socket_proxy** — standalone, для hermes-gateway
9. **lampa-jackett** — docker-compose, port 9117
**DEAD services (но стек определён):**
10. **photosHelper** (Replicas: 0, 1 volume)
11. **nginx** (Replicas: 0, 2 services, 5 volumes)
12. **registry** (Replicas: 0, 1 volume)
### 🟡 Zombie stacks (volumes, но 0 running services)
Volumes остались после того как сервисы удалили. 4–5 volumes на стек:
- **nextcloud** (4 volumes · config + данные)
- **sstp** (4 volumes · SoftEther VPN, конфиг + logs)
- **portainer** (1 volume · swarm UI)
- **swarmpit** (1 volume · swarm UI)
- **test** (1 volume)
- **torr_cache** (1 volume)
- **beszel-poc** (2 volumes · monitoring POC)
### 🟣 Ephemeral: gitea act_runner job pods
Когда CI job запускается в gitea, `act_runner` создаёт **ephemeral контейнер** со случайным именем (`romantic_wozniak`, `compassionate_goodall` и т.п.). После завершения контейнер остаётся в `exited` state. На текущий момент ~48 таких exited контейнеров.
Реестр: image `ghcr.io/immich-app/runner-images:ubuntu-latest` (определён в `poc/gitea/config.yaml`).
### 🔴 Volumes (153 total)
- **18 mounted** в running контейнеры
- **135 orphaned** (либо от zombie-стеков, либо anonymous)
Основные используемые:
- `gitea_data` — критичные данные gitea (NFS на 192.168.1.96:/root/volumes/gitea)
- `immich_*` — uploads, model-cache, postgres
- `hermes_infra_*_data`, `hermes_hermes_*_data`
- `brencher_tmp`, `brencher2_tmp` — git clones
- `lampa_jackett_config`
- `torrserv_proxy_data`
### 🔐 Secrets & configs
`/configs` и `/secrets` через socket-proxy **403** (требуется POST:1). Известные по другим источникам:
**В gitea `/data/gitea/conf/app.ini`:**
- `LFS_JWT_SECRET`
- `JWT_SECRET` (oauth2)
- `SECRET_KEY`
- `INTERNAL_TOKEN`
**В hermes-agent runtime:**
- Gmail API creds (для gmail_mcp server)
- Telegram bot token (для telegram_mcp server)
**Swarm configs** (из `poc/gitea/stack-compose.yml`):
- `runner_config` — `config.yaml` для act_runner
### 🗑️ Dead-overlay сети (сеть есть, контейнеров нет)
- `nginx_ingress` (10.0.3.0/24) — для nginx-proxy, но nginx Replicas=0
- `nginx_default` (10.0.4.0/24) — то же
Сети **живые** в swarm mesh, но не используются.
## Что НЕ показывает эта диаграмма
- Конкретные IP контейнеров (см. `standalone-adaptive.svg`)
- Cross-stack сети в деталях (см. SVG)
- Точные timestamps exited containers
- Полный список 119 orphaned volumes без stack'а
## Как обновить
Запусти в этом окружении:
```bash
# Stacks & services
curl http://docker_socket_proxy:2375/services | jq -r '.[] | .Spec.Labels["com.docker.stack.namespace"]' | sort -u
# Volumes per stack
curl http://docker_socket_proxy:2375/volumes | jq -r '.Volumes[] | "\(.Name) \(.Labels["com.docker.stack_namespace"] // "no-stack")"'
# Ephemeral containers (exited)
curl http://docker_socket_proxy:2375/containers/json?all=1 | jq '[.[] | select(.State=="exited")] | length'
# BRENCHER profiles (env var)
curl http://docker_socket_proxy:2375/containers/brencher_brencher-backend* 2>/dev/null
```
## Связанные
- `standalone-adaptive.svg` — per-node detail (IPs, container names)
- `admin/ansible#5` — re-deploy hermes_squid
- `admin/ansible#6` — pre-create socket_proxy overlay
- `admin/ansible#7` — gitea stack deploy / app.ini fix
-487
View File
@@ -1,487 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1610 1145" font-family="ui-monospace, SFMono-Regular, monospace" font-size="10">
<title>Production architecture · internet / ingress-egress / stacks / internal-nets</title>
<desc>
4 columns:
1. Internet (Client, Tailscale, Keenetic, lan)
2. Ingress &amp; egress networks (10)
3. Stacks with nodes (12 stacks)
4. Internal-only networks (12, paired with their stack's y)
</desc>
<style>
.bg { fill: #020617; }
.grid-dot { fill: #1e293b; }
.title { fill: #e2e8f0; }
.col-label { fill: #94a3b8; font-size: 11; font-weight: bold; letter-spacing: 1px; }
.net-fill { fill: #422006; fill-opacity: 0.4; stroke: #f59e0b; }
.net-text { fill: #fde68a; }
.net-sub { fill: #fbbf24; font-size: 8; }
.net-external-fill { fill: #1e293b; fill-opacity: 0.5; stroke: #94a3b8; }
.net-external-text { fill: #cbd5e1; }
.net-io-fill { fill: #052e16; fill-opacity: 0.5; stroke: #22c55e; }
.net-io-text { fill: #bbf7d0; }
.net-internal-fill { fill: #1e1b4b; fill-opacity: 0.5; stroke: #818cf8; }
.net-internal-text { fill: #c7d2fe; }
.ext-client-fill { fill: #0f172a; stroke: #a78bfa; }
.ext-client-text { fill: #ddd6fe; }
.stack-fill { fill: #0c4a6e; fill-opacity: 0.3; stroke: #22d3ee; }
.stack-text { fill: #cffafe; font-weight: bold; }
.node-fill { fill: #0f172a; stroke: #475569; stroke-width: 1; }
.node-text { fill: #cbd5e1; }
.arrow-lan { stroke: #f59e0b; fill: none; }
.arrow-egress { stroke: #22c55e; fill: none; }
.arrow-internal { stroke: #818cf8; fill: none; }
.legend-text { fill: #cbd5e1; }
.footer { fill: #475569; }
@media (prefers-color-scheme: light) {
.bg { fill: #f8fafc; }
.grid-dot { fill: #cbd5e1; }
.title { fill: #0f172a; }
.col-label { fill: #475569; }
.net-fill { fill: #fef3c7; fill-opacity: 0.6; stroke: #b45309; }
.net-text { fill: #78350f; }
.net-sub { fill: #92400e; }
.net-external-fill { fill: #e2e8f0; fill-opacity: 0.7; stroke: #64748b; }
.net-external-text { fill: #1e293b; }
.net-io-fill { fill: #dcfce7; fill-opacity: 0.6; stroke: #16a34a; }
.net-io-text { fill: #14532d; }
.net-internal-fill { fill: #e0e7ff; fill-opacity: 0.6; stroke: #4f46e5; }
.net-internal-text { fill: #312e81; }
.ext-client-fill { fill: #faf5ff; stroke: #7c3aed; }
.ext-client-text { fill: #581c87; }
.stack-fill { fill: #ecfeff; fill-opacity: 0.4; stroke: #0e7490; }
.stack-text { fill: #0c4a6e; }
.node-fill { fill: #ffffff; stroke: #94a3b8; }
.node-text { fill: #1e293b; }
.arrow-lan { stroke: #b45309; }
.arrow-egress { stroke: #16a34a; }
.arrow-internal { stroke: #4f46e5; }
.legend-text { fill: #1e293b; }
.footer { fill: #94a3b8; }
}
</style>
<defs>
<pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">
<circle cx="20" cy="20" r="0.5" class="grid-dot"/>
</pattern>
<marker id="a-lan" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#f59e0b"/>
</marker>
<marker id="a-egress" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#22c55e"/>
</marker>
<marker id="a-internal" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse">
<path d="M 0 0 L 10 5 L 0 10 z" fill="#818cf8"/>
</marker>
</defs>
<rect width="1610" height="1145" class="bg"/>
<rect width="1610" height="1145" fill="url(#grid)"/>
<text x="40" y="36" class="title" font-size="18" font-weight="bold">
Production architecture · 4 columns
</text>
<!-- ============== COL 1: INTERNET ============== -->
<text x="40" y="80" class="col-label">1. INTERNET</text>
<g>
<rect x="40" y="100" width="220" height="50" rx="5" class="ext-client-fill" stroke-width="2"/>
<text x="150" y="119" text-anchor="middle" class="ext-client-text" font-size="12" font-weight="bold">Client</text>
<text x="150" y="133" text-anchor="middle" class="ext-client-text" font-size="8">из tailscale-сети</text>
<text x="150" y="144" text-anchor="middle" class="ext-client-text" font-size="7">100.x.x.x</text>
</g>
<g>
<rect x="40" y="160" width="220" height="100" rx="5" class="net-external-fill" stroke-width="2"/>
<text x="150" y="178" text-anchor="middle" class="net-external-text" font-size="11" font-weight="bold">Keenetic router</text>
<text x="150" y="192" text-anchor="middle" class="net-external-text" font-size="8">192.168.1.1 · DNS · TLS term</text>
<text x="150" y="205" text-anchor="middle" class="net-external-text" font-size="7">.rudolf.keenetic.link → 192.168.1.96:443</text>
<text x="150" y="226" text-anchor="middle" class="net-external-text" font-size="10" font-weight="bold">Tailscale subnet</text>
<text x="150" y="240" text-anchor="middle" class="net-external-text" font-size="7">announces 192.168.1.0/24</text>
</g>
<g>
<rect x="40" y="270" width="220" height="50" rx="5" class="net-external-fill" stroke-width="2"/>
<text x="150" y="288" text-anchor="middle" class="net-external-text" font-size="12" font-weight="bold">lan</text>
<text x="150" y="303" text-anchor="middle" class="net-external-text" font-size="8">192.168.1.0/24 · физическая LAN</text>
</g>
<!-- ============== COL 2: INGRESS / EGRESS ============== -->
<text x="290" y="80" class="col-label">2. INGRESS / EGRESS</text>
<text x="290" y="338" class="col-label" font-size="9">могут выйти в интернет</text>
<g>
<rect x="290" y="345" width="220" height="30" rx="4" class="net-io-fill"/>
<text x="298" y="358" class="net-io-text" font-size="10">ingress</text>
<text x="502" y="358" text-anchor="end" class="net-sub">10.0.0.0/24</text>
<text x="298" y="369" class="net-sub" font-size="7">swarm routing mesh</text>
</g>
<g>
<rect x="290" y="378" width="220" height="30" rx="4" class="net-io-fill"/>
<text x="298" y="391" class="net-io-text" font-size="10">nginx_ingress</text>
<text x="502" y="391" text-anchor="end" class="net-sub">10.0.3.0/24</text>
<text x="298" y="402" class="net-sub" font-size="7">nginx-proxy · dead</text>
</g>
<g>
<rect x="290" y="411" width="220" height="30" rx="4" class="net-io-fill"/>
<text x="298" y="424" class="net-io-text" font-size="10">nginx_default</text>
<text x="502" y="424" text-anchor="end" class="net-sub">10.0.4.0/24</text>
<text x="298" y="435" class="net-sub" font-size="7">nginx-proxy · dead</text>
</g>
<g>
<rect x="290" y="444" width="220" height="30" rx="4" class="net-io-fill"/>
<text x="298" y="457" class="net-io-text" font-size="10">hermes_infra_squid_egress</text>
<text x="502" y="457" text-anchor="end" class="net-sub">10.0.12.0/24</text>
<text x="298" y="468" class="net-sub" font-size="7">squid</text>
</g>
<g>
<rect x="290" y="477" width="220" height="30" rx="4" class="net-io-fill"/>
<text x="298" y="490" class="net-io-text" font-size="10">hermes_infra_admin</text>
<text x="502" y="490" text-anchor="end" class="net-sub">10.0.14.0/24</text>
<text x="298" y="501" class="net-sub" font-size="7">admin overlay</text>
</g>
<g>
<rect x="290" y="510" width="220" height="30" rx="4" class="net-io-fill"/>
<text x="298" y="523" class="net-io-text" font-size="10">hermes_infra_hermes_proxy</text>
<text x="502" y="523" text-anchor="end" class="net-sub">10.0.15.0/24</text>
<text x="298" y="534" class="net-sub" font-size="7">hermes</text>
</g>
<g>
<rect x="290" y="543" width="220" height="30" rx="4" class="net-io-fill"/>
<text x="298" y="556" class="net-io-text" font-size="10">docker_socket_proxy_socket_proxy</text>
<text x="502" y="556" text-anchor="end" class="net-sub">10.0.16.0/24</text>
<text x="298" y="567" class="net-sub" font-size="7">docker socket</text>
</g>
<g>
<rect x="290" y="576" width="220" height="30" rx="4" class="net-io-fill"/>
<text x="298" y="589" class="net-io-text" font-size="10">docker_socket_proxy_admin</text>
<text x="502" y="589" text-anchor="end" class="net-sub">10.0.18.0/24</text>
<text x="298" y="600" class="net-sub" font-size="7">admin overlay</text>
</g>
<g>
<rect x="290" y="609" width="220" height="30" rx="4" class="net-io-fill"/>
<text x="298" y="622" class="net-io-text" font-size="10">docker_socket_proxy_hermes_proxy</text>
<text x="502" y="622" text-anchor="end" class="net-sub">10.0.19.0/24</text>
<text x="298" y="633" class="net-sub" font-size="7">hermes</text>
</g>
<g>
<rect x="290" y="642" width="220" height="30" rx="4" class="net-io-fill"/>
<text x="298" y="655" class="net-io-text" font-size="10">docker_socket_proxy_squid_egress</text>
<text x="502" y="655" text-anchor="end" class="net-sub">10.0.20.0/24</text>
<text x="298" y="666" class="net-sub" font-size="7">squid</text>
</g>
<!-- ============== COL 3: STACKS &amp; PODS ============== -->
<text x="540" y="80" class="col-label">STACKS &amp; PODS</text>
<g><rect x="540" y="100" width="760" height="66" rx="8" class="stack-fill"/>
<text x="550" y="116" class="stack-text" font-size="12">gitea</text>
<g class="node-fill"><rect x="550" y="127" width="740" height="15" rx="3"/>
<text x="558" y="134" class="node-text" font-size="9">gitea_server.1.fx8lrhxza6s7xhjeqr46oiioa</text>
<text x="558" y="144" class="node-text" font-size="7" fill="#67e8f9">10.0.0.235 ingress · 10.0.17.13 gitea_gitea · 10.0.3.134 nginx_ingress</text>
</g>
<g class="node-fill"><rect x="550" y="145" width="740" height="15" rx="3"/>
<text x="558" y="152" class="node-text" font-size="9">gitea_runner.1.7qu01adpg71cpk5seaa22ve76</text>
<text x="558" y="162" class="node-text" font-size="7" fill="#67e8f9">10.0.0.6 ingress · gitea_gitea</text>
</g>
</g>
<g><rect x="540" y="171" width="760" height="66" rx="8" class="stack-fill"/>
<text x="550" y="187" class="stack-text" font-size="12">hermes</text>
<g class="node-fill"><rect x="550" y="198" width="740" height="15" rx="3"/>
<text x="558" y="205" class="node-text" font-size="9">hermes_hermes-agent.1.lbx30ov89d2nhukviexnb32sz</text>
<text x="558" y="215" class="node-text" font-size="7" fill="#67e8f9">hermes_hermes .11.9</text>
</g>
<g class="node-fill"><rect x="550" y="216" width="740" height="15" rx="3"/>
<text x="558" y="223" class="node-text" font-size="9">hermes_hermes-gateway.1.4ceprn5xwyd1jdvxk7r5i9mde</text>
<text x="558" y="233" class="node-text" font-size="7" fill="#67e8f9">10.0.0.204 ingress · hermes_hermes .11.10</text>
</g>
</g>
<g><rect x="540" y="242" width="760" height="138" rx="8" class="stack-fill"/>
<text x="550" y="258" class="stack-text" font-size="12">hermes_infra</text>
<g class="node-fill"><rect x="550" y="269" width="740" height="15" rx="3"/>
<text x="558" y="276" class="node-text" font-size="9">squid.1.l9zssq6kvlxwdw7ywlzri7miw</text>
<text x="558" y="286" class="node-text" font-size="7" fill="#67e8f9">.108 ingress · squid_egress .12.11 · hermes_proxy .15.44</text>
</g>
<g class="node-fill"><rect x="550" y="287" width="740" height="15" rx="3"/>
<text x="558" y="294" class="node-text" font-size="9">sarg.1.ucvl44g6djt49y4fgfydmia4y</text>
<text x="558" y="304" class="node-text" font-size="7" fill="#67e8f9">.107 ingress · admin .14.48</text>
</g>
<g class="node-fill"><rect x="550" y="305" width="740" height="15" rx="3"/>
<text x="558" y="312" class="node-text" font-size="9">hermes-ui.1.8mohposymmwn3sxcrupcf2a4h</text>
<text x="558" y="322" class="node-text" font-size="7" fill="#67e8f9">.106 ingress · hermes_infra_default .13.16 · hermes_proxy .15.43</text>
</g>
<g class="node-fill"><rect x="550" y="323" width="740" height="15" rx="3"/>
<text x="558" y="330" class="node-text" font-size="9">hermes-gateway.1.vrbji4iqmw2e69zq1cbf2ooqb</text>
<text x="558" y="340" class="node-text" font-size="7" fill="#67e8f9">hermes_proxy .15.47</text>
</g>
<g class="node-fill"><rect x="550" y="341" width="740" height="15" rx="3"/>
<text x="558" y="348" class="node-text" font-size="9">docker_socket_proxy.1.h80ql7v0epork75q3ij3h6gqf</text>
<text x="558" y="358" class="node-text" font-size="7" fill="#67e8f9">admin .14.46 · hermes_proxy .15.46</text>
</g>
<g class="node-fill"><rect x="550" y="359" width="740" height="15" rx="3"/>
<text x="558" y="366" class="node-text" font-size="9">brencher-state-proxy (dead)</text>
<text x="558" y="376" class="node-text" font-size="7" fill="#67e8f9">nginx_ingress · Replicas: 0</text>
</g>
</g>
<g><rect x="540" y="385" width="760" height="102" rx="8" class="stack-fill"/>
<text x="550" y="401" class="stack-text" font-size="12">immich</text>
<g class="node-fill"><rect x="550" y="412" width="740" height="15" rx="3"/>
<text x="558" y="419" class="node-text" font-size="9">immich_server.1.a83c7oac6f4ukkzhae1tsj2ym</text>
<text x="558" y="429" class="node-text" font-size="7" fill="#67e8f9">.225 ingress · immich_default .2.14</text>
</g>
<g class="node-fill"><rect x="550" y="430" width="740" height="15" rx="3"/>
<text x="558" y="437" class="node-text" font-size="9">immich_database.1.lstdz3kkogsrcg7vx7sae6rfa</text>
<text x="558" y="447" class="node-text" font-size="7" fill="#67e8f9">.13 ingress · immich_default .2.6</text>
</g>
<g class="node-fill"><rect x="550" y="448" width="740" height="15" rx="3"/>
<text x="558" y="455" class="node-text" font-size="9">immich_redis.1.85hnh4elu9xxl9jcs64v4u0u2</text>
<text x="558" y="465" class="node-text" font-size="7" fill="#67e8f9">immich_default .2.8</text>
</g>
<g class="node-fill"><rect x="550" y="466" width="740" height="15" rx="3"/>
<text x="558" y="473" class="node-text" font-size="9">immich_machine-learning.1.wnkv2chqsfaq3st7a0qgezt7b</text>
<text x="558" y="483" class="node-text" font-size="7" fill="#67e8f9">.11 ingress · immich_default .2.3</text>
</g>
</g>
<g><rect x="540" y="492" width="760" height="48" rx="8" class="stack-fill"/>
<text x="550" y="508" class="stack-text" font-size="12">brencher</text>
<g class="node-fill"><rect x="550" y="519" width="740" height="15" rx="3"/>
<text x="558" y="526" class="node-text" font-size="9">brencher_brencher-backend.1.vdeqwr97iafplzieas71sq55a</text>
<text x="558" y="536" class="node-text" font-size="7" fill="#67e8f9">.105 ingress · brencher-net .6.195 · brencher_default .7.195 · nginx_ingress .3.224</text>
</g>
</g>
<g><rect x="540" y="545" width="760" height="48" rx="8" class="stack-fill"/>
<text x="550" y="561" class="stack-text" font-size="12">brencher2</text>
<g class="node-fill"><rect x="550" y="572" width="740" height="15" rx="3"/>
<text x="558" y="579" class="node-text" font-size="9">brencher2_brencher-backend.1.ma4m7uabhe5lckk0fktaicf19</text>
<text x="558" y="589" class="node-text" font-size="7" fill="#67e8f9">.102 ingress · brencher2-net .5.12 · brencher2_default .1.12 · nginx_ingress .3.221</text>
</g>
</g>
<g><rect x="540" y="598" width="760" height="66" rx="8" class="stack-fill"/>
<text x="550" y="614" class="stack-text" font-size="12">gmail_mcp</text>
<g class="node-fill"><rect x="550" y="625" width="740" height="15" rx="3"/>
<text x="558" y="632" class="node-text" font-size="9">gmail_mcp_gmail-mcp-server.1.wxhzdnibwssve5trbwffzyzpu</text>
<text x="558" y="642" class="node-text" font-size="7" fill="#67e8f9">.10 ingress · gmail_mcp_default .8.6</text>
</g>
<g class="node-fill"><rect x="550" y="643" width="740" height="15" rx="3"/>
<text x="558" y="650" class="node-text" font-size="9">gmail_mcp_telegram-mcp-server.1.yehnql7ova2a65s6d6wly5y6m</text>
<text x="558" y="660" class="node-text" font-size="7" fill="#67e8f9">.6 ingress · gmail_mcp_default .8.3</text>
</g>
</g>
<g><rect x="540" y="669" width="760" height="66" rx="8" class="stack-fill"/>
<text x="550" y="685" class="stack-text" font-size="12">torrserv_proxy</text>
<g class="node-fill"><rect x="550" y="696" width="740" height="15" rx="3"/>
<text x="558" y="703" class="node-text" font-size="9">torrserv_proxy_reverseproxy.1.r906zcw2jyny6g6w56an1u193</text>
<text x="558" y="713" class="node-text" font-size="7" fill="#67e8f9">.15 ingress · torrserv_proxy_default .10.4</text>
</g>
<g class="node-fill"><rect x="550" y="714" width="740" height="15" rx="3"/>
<text x="558" y="721" class="node-text" font-size="9">torrserv_proxy_fileserver.1.zrum9hzhght93z9yxv0ae7hbs</text>
<text x="558" y="731" class="node-text" font-size="7" fill="#67e8f9">.12 ingress · torrserv_proxy_default .10.3</text>
</g>
</g>
<g><rect x="540" y="740" width="760" height="66" rx="8" class="node-dead"/>
<text x="550" y="756" class="node-dead-text" font-size="12">nginx (dead)</text>
<g class="node-dead"><rect x="550" y="767" width="740" height="15" rx="3"/>
<text x="558" y="774" class="node-text" font-size="9">nginx_nginx (jwilder/nginx-proxy)</text>
<text x="558" y="784" class="node-text" font-size="7" fill="#67e8f9">Replicas: 0 · no containers</text>
</g>
<g class="node-dead"><rect x="550" y="785" width="740" height="15" rx="3"/>
<text x="558" y="792" class="node-text" font-size="9">nginx_nginx_acme (acme-companion)</text>
<text x="558" y="802" class="node-text" font-size="7" fill="#67e8f9">Replicas: 0</text>
</g>
</g>
<g><rect x="540" y="811" width="760" height="48" rx="8" class="stack-fill"/>
<text x="550" y="827" class="stack-text" font-size="12">photosHelper</text>
<g class="node-fill"><rect x="550" y="838" width="740" height="15" rx="3"/>
<text x="558" y="845" class="node-text" font-size="9">photosHelper_nfs_crypt</text>
<text x="558" y="855" class="node-text" font-size="7" fill="#67e8f9">.9 ingress · photosHelper_default</text>
</g>
</g>
<g><rect x="540" y="864" width="760" height="48" rx="8" class="stack-fill"/>
<text x="550" y="880" class="stack-text" font-size="12">docker_socket_proxy</text>
<g class="node-fill"><rect x="550" y="891" width="740" height="15" rx="3"/>
<text x="558" y="898" class="node-text" font-size="9">docker_socket_proxy_hermes-gateway.1.kb09yigdxe9i7yqk9m0ecu2h5</text>
<text x="558" y="908" class="node-text" font-size="7" fill="#67e8f9">hermes_proxy .19.3 · dsp_default</text>
</g>
</g>
<g><rect x="540" y="917" width="760" height="48" rx="8" class="stack-fill"/>
<text x="550" y="933" class="stack-text" font-size="12">lampa-jackett (standalone, не swarm)</text>
<g class="node-fill"><rect x="550" y="944" width="740" height="15" rx="3"/>
<text x="558" y="951" class="node-text" font-size="9">lampa-jackett-1</text>
<text x="558" y="961" class="node-text" font-size="7" fill="#67e8f9">port 9117:9117 на хосте</text>
</g>
</g>
<!-- ============== COL 4: INTERNAL NETWORKS ============== -->
<text x="1330" y="80" class="col-label">4. INTERNAL NETS</text>
<text x="1330" y="94" class="col-label" font-size="9">только для своего стека</text>
<g>
<rect x="1330" y="106" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="117" class="net-internal-text" font-size="9">gitea_gitea</text>
<text x="1564" y="117" text-anchor="end" class="net-sub" font-size="7">10.0.17.0/24</text>
</g>
<g>
<rect x="1330" y="391" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="402" class="net-internal-text" font-size="9">immich_default</text>
<text x="1564" y="402" text-anchor="end" class="net-sub" font-size="7">10.0.2.0/24</text>
</g>
<g>
<rect x="1330" y="177" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="188" class="net-internal-text" font-size="9">hermes_hermes</text>
<text x="1564" y="188" text-anchor="end" class="net-sub" font-size="7">10.0.11.0/24</text>
</g>
<g>
<rect x="1330" y="248" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="259" class="net-internal-text" font-size="9">hermes_infra_default</text>
<text x="1564" y="259" text-anchor="end" class="net-sub" font-size="7">10.0.13.0/24</text>
</g>
<g>
<rect x="1330" y="604" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="615" class="net-internal-text" font-size="9">gmail_mcp_default</text>
<text x="1564" y="615" text-anchor="end" class="net-sub" font-size="7">10.0.8.0/24</text>
</g>
<g>
<rect x="1330" y="106" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="117" class="net-internal-text" font-size="9">torrserv_proxy_default</text>
<text x="1564" y="117" text-anchor="end" class="net-sub" font-size="7">10.0.10.0/24</text>
</g>
<g>
<rect x="1330" y="498" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="509" class="net-internal-text" font-size="9">brencher_brencher-net</text>
<text x="1564" y="509" text-anchor="end" class="net-sub" font-size="7">10.0.6.0/24</text>
</g>
<g>
<rect x="1330" y="516" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="527" class="net-internal-text" font-size="9">brencher_default</text>
<text x="1564" y="527" text-anchor="end" class="net-sub" font-size="7">10.0.7.0/24</text>
</g>
<g>
<rect x="1330" y="551" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="562" class="net-internal-text" font-size="9">brencher2_brencher-net</text>
<text x="1564" y="562" text-anchor="end" class="net-sub" font-size="7">10.0.5.0/24</text>
</g>
<g>
<rect x="1330" y="569" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="580" class="net-internal-text" font-size="9">brencher2_default</text>
<text x="1564" y="580" text-anchor="end" class="net-sub" font-size="7">10.0.1.0/24</text>
</g>
<g>
<rect x="1330" y="817" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="828" class="net-internal-text" font-size="9">photosHelper_default</text>
<text x="1564" y="828" text-anchor="end" class="net-sub" font-size="7">10.0.9.0/24</text>
</g>
<g>
<rect x="1330" y="870" width="240" height="16" rx="3" class="net-internal-fill"/>
<text x="1336" y="881" class="net-internal-text" font-size="9">docker_socket_proxy_default</text>
<text x="1564" y="881" text-anchor="end" class="net-sub" font-size="7">10.0.21.0/24</text>
</g>
<!-- connector dots on col 2 right edge -->
<circle cx="510" cy="360" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<circle cx="510" cy="393" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<circle cx="510" cy="426" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<circle cx="510" cy="459" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<circle cx="510" cy="492" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<circle cx="510" cy="525" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<circle cx="510" cy="558" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<circle cx="510" cy="591" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<circle cx="510" cy="624" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<circle cx="510" cy="657" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<!-- connector dots on col 4 left edge -->
<circle cx="1330" cy="114" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="399" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="185" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="256" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="612" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="275" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="506" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="559" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="506" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="559" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="825" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<circle cx="1330" cy="878" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<!-- col 2 (ingress/egress) -> nodes (col 3) -->
<line x1="510" y1="360" x2="550" y2="136" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="393" x2="550" y2="136" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="154" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="225" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="278" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="459" x2="550" y2="278" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="525" x2="550" y2="278" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="296" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="492" x2="550" y2="296" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="314" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="525" x2="550" y2="314" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="525" x2="550" y2="332" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="492" x2="550" y2="350" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="525" x2="550" y2="350" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="421" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="439" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="475" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="528" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="393" x2="550" y2="528" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="581" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="393" x2="550" y2="581" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="634" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="652" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="705" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="723" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="360" x2="550" y2="847" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="510" y1="624" x2="550" y2="900" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<!-- nodes (col 3) -> col 4 (internal nets) -->
<line x1="1300" y1="136" x2="1330" y2="114" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="154" x2="1330" y2="114" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="207" x2="1330" y2="185" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="225" x2="1330" y2="185" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="314" x2="1330" y2="256" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="421" x2="1330" y2="399" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="439" x2="1330" y2="399" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="457" x2="1330" y2="399" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="475" x2="1330" y2="399" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="528" x2="1330" y2="506" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="528" x2="1330" y2="506" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="581" x2="1330" y2="559" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="581" x2="1330" y2="559" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="634" x2="1330" y2="612" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="652" x2="1330" y2="612" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="705" x2="1330" y2="275" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="723" x2="1330" y2="275" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="847" x2="1330" y2="825" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<line x1="1300" y1="900" x2="1330" y2="878" stroke="#a78bfa" stroke-width="0.8" stroke-opacity="0.4"/>
<!-- External flow arrows (col 1) -->
<line x1="150" y1="150" x2="150" y2="160" class="arrow-lan" stroke-width="1.5" marker-end="url(#a-lan)"/>
<line x1="150" y1="260" x2="150" y2="270" class="arrow-lan" stroke-width="1.5" marker-end="url(#a-lan)"/>
<line x1="260" y1="295" x2="290" y2="360" class="arrow-egress" stroke-width="1" stroke-dasharray="3 3" stroke-opacity="0.6" marker-end="url(#a-egress)"/>
<g>
<rect x="40" y="995" width="900" height="100" rx="8" class="stack-fill" stroke="#22d3ee"/>
<text x="55" y="1015" class="col-label">LEGEND</text>
<rect x="55" y="1025" width="22" height="14" rx="3" class="ext-client-fill"/>
<text x="85" y="1036" class="legend-text" font-size="9">Client (tailscale)</text>
<rect x="55" y="1043" width="22" height="14" rx="3" class="net-external-fill"/>
<text x="85" y="1054" class="legend-text" font-size="9">Keenetic / lan</text>
<rect x="240" y="1025" width="22" height="14" rx="3" class="net-io-fill"/>
<text x="270" y="1036" class="legend-text" font-size="9">ingress / egress net</text>
<rect x="240" y="1043" width="22" height="14" rx="3" class="net-internal-fill"/>
<text x="270" y="1054" class="legend-text" font-size="9">internal net (stack-private)</text>
<rect x="460" y="1025" width="22" height="14" rx="3" class="stack-fill"/>
<text x="490" y="1036" class="legend-text" font-size="9">stack</text>
<rect x="460" y="1043" width="22" height="14" rx="3" class="node-fill"/>
<text x="490" y="1054" class="legend-text" font-size="9">node (container)</text>
<circle cx="660" cy="1032" r="3" fill="#fbbf24" stroke="#92400e" stroke-width="1"/>
<text x="670" y="1036" class="legend-text" font-size="9">net connector (col 2)</text>
<circle cx="660" cy="1050" r="3" fill="#a78bfa" stroke="#5b21b6" stroke-width="1"/>
<text x="670" y="1054" class="legend-text" font-size="9">net connector (col 4)</text>
<line x1="55" y1="1070" x2="80" y2="1070" class="arrow-egress" stroke-width="1.5" stroke-dasharray="3 3" marker-end="url(#a-egress)"/>
<text x="90" y="1073" class="legend-text" font-size="9">egress flow</text>
<line x1="240" y1="1070" x2="265" y2="1070" class="arrow-internal" stroke-width="1" marker-end="url(#a-internal)"/>
<text x="275" y="1073" class="legend-text" font-size="9">internal flow (col 3 -&gt; col 4)</text>
<line x1="460" y1="1070" x2="485" y2="1070" stroke="#94a3b8" stroke-width="0.8" stroke-opacity="0.4"/>
<text x="495" y="1073" class="legend-text" font-size="9">node &lt;-&gt; network</text>
</g>
<text x="40" y="1135" class="footer" font-size="9">
snapshot 2026-08-27 · 4 columns · 10 egress + 12 internal + 5 external · 12 stacks
</text>
</svg>

Before

Width:  |  Height:  |  Size: 31 KiB

-93
View File
@@ -1,93 +0,0 @@
# nginx config for the brencher-state-proxy sidecar.
#
# Path-locked reverse proxy for the brencher /state endpoint:
# - /state -> proxied to https://brencher.rudolf.keenetic.link/state
# - everything else -> 403 Forbidden
#
# This lets hermes-agent reach /state without going through squid's
# host-level allowlist (which can't see inside TLS) and without exposing
# the rest of brencher's surface area.
#
# Listen on 8080 (plain HTTP). No TLS -- this is a private internal
# API on the admin overlay, reachable only from inside the swarm. No
# host port is published.
#
# Upstream is the public URL on purpose -- the sidecar reaches the public
# brencher.rudolf.keenetic.link through the nginx-ingress overlay the same
# way any external client would, which means it doesn't need to be on the
# brencher container's private networks.
server {
listen 8080;
server_name _;
# Tiny access log; default nginx format
access_log /var/log/nginx/brencher-state-access.log;
error_log /var/log/nginx/brencher-state-error.log warn;
# Healthcheck for swarm -- not /state, deliberately, so a 200 here
# doesn't accidentally imply /state is reachable from outside the
# allowlist.
location = /healthz {
access_log off;
return 200 "ok\n";
add_header Content-Type text/plain;
}
# The only allowed path. Exact match: query strings or trailing
# anything else fall through to the default 403.
location = /state {
proxy_pass https://brencher.rudolf.keenetic.link/state;
proxy_http_version 1.1;
# Upstream is HTTPS; the sidecar trusts the LE-issued cert via
# the system CA bundle. SNI explicitly named so any future
# transparent-proxy middlebox doesn't break the handshake.
proxy_ssl_server_name on;
proxy_ssl_name brencher.rudolf.keenetic.link;
proxy_set_header Host brencher.rudolf.keenetic.link;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_connect_timeout 5s;
proxy_read_timeout 30s;
proxy_send_timeout 10s;
# Don't cache -- state should be live.
proxy_buffering off;
add_header Cache-Control "no-store" always;
}
# Secondary brencher (runs on the docker host via host.docker.internal,
# reached as http://host.docker.internal:5002 -- same trick the brencher
# container itself uses in docker-compose.yml's extra_hosts). Only the
# /state2 path is exposed; everything else returns 403 like /state.
location = /state2 {
proxy_pass http://host.docker.internal:5002/state;
proxy_http_version 1.1;
# Cleartext HTTP upstream (port 5002), no TLS to wrangle.
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_connect_timeout 5s;
proxy_read_timeout 30s;
proxy_send_timeout 10s;
proxy_buffering off;
add_header Cache-Control "no-store" always;
}
# Catch-all: deny everything else, including /state/ (with trailing
# slash), /state?foo=bar (with query), and any other path.
location / {
access_log off;
return 403 "forbidden: only /state is allowed through this proxy\n";
add_header Content-Type text/plain;
}
}
+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 .hf.co .xethub.hf.co .cas-server.xethub.hf.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
+18 -56
View File
@@ -64,10 +64,10 @@ 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.
# No admin overlay membership here: the docker_socket_proxy sidecar
# is 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
volumes:
- hermes_gateway_data:/opt/data
@@ -84,21 +84,21 @@ services:
HTTPS_PROXY: http://squid:3128
http_proxy: http://squid:3128
https_proxy: http://squid:3128
# 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
# them anyway and would 403 the request).
# The docker_socket_proxy sidecar is reachable on the hermes_proxy
# overlay. It is NOT a public service, so traffic to it MUST NOT be
# routed through squid (which can't reach it anyway and would 403
# the request).
# Comma-separated list. Format accepted by curl/requests/urllib:
# bare hostnames, IPs, CIDR ranges. Order doesn't matter; case-insensitive.
# 127.0.0.1 - loopback
# .local - mDNS / link-local (covers host.docker.internal)
# squid, hermes-gateway, hermes-agent - same-overlay services that
# hermes-gateway itself needs to talk to without going through squid
# brencher-state-proxy, docker_socket_proxy - the new sidecars
# docker_socket_proxy - the sidecar
# 10.0.0.0/8 - the swarm's typical overlay subnet (defensive: covers
# any IP-direct call that bypasses DNS)
NO_PROXY: localhost,127.0.0.1,.local,squid,hermes-gateway,hermes-agent,brencher-state-proxy,docker_socket_proxy,10.0.0.0/8
no_proxy: localhost,127.0.0.1,.local,squid,hermes-gateway,hermes-agent,brencher-state-proxy,docker_socket_proxy,10.0.0.0/8
NO_PROXY: localhost,127.0.0.1,.local,squid,hermes-gateway,hermes-agent,docker_socket_proxy,10.0.0.0/8
no_proxy: localhost,127.0.0.1,.local,squid,hermes-gateway,hermes-agent,docker_socket_proxy,10.0.0.0/8
depends_on:
- squid
deploy:
@@ -169,13 +169,13 @@ services:
# Anything else (POST, CONTAINERS, IMAGES, SERVICES, ...) must be explicitly
# toggled to 1 by a consumer that has a reason to need it. NEVER widen the
# scope from a generic change like this one.
CONTAINERS: 0
IMAGES: 0
NETWORKS: 0
VOLUMES: 0
SERVICES: 0
TASKS: 0
NODES: 0
CONTAINERS: 1
IMAGES: 1
NETWORKS: 1
VOLUMES: 1
SERVICES: 1
TASKS: 1
NODES: 1
POST: 0
ports:
- target: 2375
@@ -193,42 +193,6 @@ services:
delay: 5s
max_attempts: 3
brencher-state-proxy:
# Path-locked reverse proxy for brencher.rudolf.keenetic.link/state.
# Lets hermes-agent reach /state without going through squid (which
# can't see inside TLS) and without exposing the rest of brencher.
# See hermes_squid/brencher-state-proxy.conf for the path rules.
image: nginx:alpine
hostname: brencher-state-proxy
extra_hosts:
# Lets the sidecar reach the secondary brencher at
# http://host.docker.internal:5002/state -- same trick the brencher
# container itself uses in its own docker-compose.yml.
- "host.docker.internal:host-gateway"
networks:
# 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
deploy:
mode: replicated
replicas: 1
placement:
constraints:
- node.hostname == odroid # must run where the secret is mounted (and where the public ingress routes back to)
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
networks:
hermes_proxy:
driver: overlay
@@ -247,8 +211,6 @@ configs:
file: ./squid.conf
nginx_hermes_conf:
file: ./nginx-hermes.conf
brencher_state_proxy_conf:
file: ./brencher-state-proxy.conf
volumes:
squid_etc:
+11 -17
View File
@@ -73,24 +73,18 @@ cache:
# Enable cache server to use actions/cache.
enabled: true
# The directory to store the cache data.
# If it's empty, the cache data will be stored in $HOME/.cache/actcache.
dir: ""
# The host of the cache server.
# It's not for the address to listen, but the address to connect from job containers.
# So 0.0.0.0 is a bad choice, leave it empty to detect automatically.
host: ""
# The port of the cache server.
# 0 means to use a random available port.
port: 0
# The external cache server URL. Valid only when enable is true.
# If it's specified, act_runner will use this URL as the ACTIONS_CACHE_URL rather than start a server by itself.
# The URL should generally end with "/".
# Requires external_secret below to be set to the same value on both this runner and the cache-server.
external_server: ""
# Shared secret between this runner and the external `act_runner cache-server`. Required when external_server
# (or `act_runner cache-server`) is in use: the runner pre-registers each job's ACTIONS_RUNTIME_TOKEN with the
# cache-server, and the cache-server enforces bearer auth + per-repo cache isolation.
external_secret: ""
# Point at the dedicated gitea_cache_server container on the `gitea` overlay.
# The runner's built-in cache server binds to an interface unreachable from
# per-job container networks, causing ~9 min/job wasted on
# "reserveCache failed: connect ETIMEDOUT" (see gitea/actions/runs/16 job #248).
host: "gitea_cache_server"
port: 37051
# Trailing slash required.
external_server: "http://gitea_cache_server:37051/"
# Shared with the cache-server via ACT_RUNNER_EXTERNAL_SECRET env on both
# services. Rotate via Docker secret; do not commit a real value.
external_secret: "CHANGE_ME_SHARED_SECRET"
container:
# Specifies the network to which the container will connect.
+13 -2
View File
@@ -1,4 +1,3 @@
services:
server:
image: docker.gitea.com/gitea:1.27.0
@@ -26,6 +25,7 @@ services:
GITEA_RUNNER_NAME: "runner1"
GITEA_RUNNER_LABELS: "runner_label1"
# GITEA_RUNNER_EPHEMERAL: "1"
ACT_RUNNER_EXTERNAL_SECRET: "CHANGE_ME_SHARED_SECRET"
networks:
- gitea
# - nginx_ingress
@@ -35,6 +35,16 @@ services:
volumes:
- /var/run/docker.sock:/var/run/docker.sock
cache_server:
image: docker.io/gitea/act_runner:nightly
command: ["cache-server"]
environment:
ACT_RUNNER_EXTERNAL_SECRET: "CHANGE_ME_SHARED_SECRET"
networks:
- gitea
volumes:
- cache_data:/root/.cache/actcache
networks:
nginx_ingress:
external: true
@@ -52,4 +62,5 @@ volumes:
type: nfs
o: addr=192.168.1.96
device: :/root/volumes/gitea
# device: :/media/DATA/runtime/gitea
# device: :/media/DATA/runtime/gitea
cache_data: