Карта хозяйства: собрана из живых данных (4.6.1)

Задача 4.6.1 «карта хозяйства». Обычно такую карту ведут руками, и она
устаревает через неделю. Здесь она СОБИРАЕТСЯ из того, что реально
работает, скриптом ops/inventory/build-map.py:
  * pct list — контейнеры Proxmox (30, запущено 29);
  * docker ps — контейнеры внутри (97);
  * services.yaml — реестр обновлений (50 служб, роли и критичность);
  * конфигурация VPS и AdGuard — домены (40).

В документе: сводка, таблица контейнеров с памятью и ядрами, разбивка
«что где работает» по каждому CT с образами, проектами compose и
портами, список доменов, и честный раздел «что не покрыто»
(promtail, oauth2-proxy, службы без compose).

Пересобрать в любой момент: python3 ops/inventory/build-map.py
This commit is contained in:
root committed 2026-10-17 15:34:39 +03:00
1 parent 7347cf476a
commit e4739b0e12
3 files changed
+567

No files matched your search

+388
View File
@@ -0,0 +1,388 @@
# Карта хозяйства
**Собрана из живых данных 17.10.2026.** Не править вручную:
карту пересобирает `ops/inventory/build-map.py`, поэтому она не
может устареть от забывчивости.
## Сводка
| Что | Сколько |
|---|---|
| Контейнеров Proxmox | 30 |
| Из них запущено | 29 |
| Контейнеров Docker | 97 |
| Служб в реестре обновлений | 50 |
| Доменов | 40 |
## Контейнеры по именам
| CT | Имя | Состояние | Память | Cores | Docker-контейнеров |
|---|---|---|---|---|---|
| 101 | proxy-lxc | running | 1024 МБ | 2 | 2 |
| 102 | portal-lxc | running | 512 МБ | 1 | 3 |
| 103 | media-lxc | running | 4096 МБ | 4 | 3 |
| 105 | files-lxc | running | 2048 МБ | 2 | 4 |
| 106 | smart-lxc | running | 2048 МБ | 2 | 4 |
| 107 | utils-lxc | running | 1024 МБ | 1 | 3 |
| 108 | automation-lxc | running | 2048 МБ | 2 | 6 |
| 109 | cloud-lxc | running | 4096 МБ | 4 | 5 |
| 110 | office-lxc | running | 2048 МБ | 2 | 7 |
| 111 | reading-lxc | running | 2048 МБ | 2 | 8 |
| 113 | backup-lxc | running | 2048 МБ | 2 | 3 |
| 114 | authentik-security | running | 2048 МБ | 2 | 5 |
| 115 | OpenClaw | running | 2048 МБ | 2 | 4 |
| 116 | plex-lxc | running | 4096 МБ | 2 | 3 |
| 117 | sonarr-lxc | running | 1024 МБ | 1 | 3 |
| 118 | radarr-lxc | running | 1024 МБ | 1 | 3 |
| 119 | prowlarr-lxc | running | 512 МБ | 1 | 3 |
| 120 | bazarr-lxc | running | 512 МБ | 1 | 3 |
| 121 | overseerr-lxc | running | 1024 МБ | 1 | 3 |
| 122 | tautulli-lxc | running | 512 МБ | 1 | 3 |
| 125 | navidrome-lxc | running | 512 МБ | 1 | 3 |
| 127 | linkwarden-lxc | running | 512 МБ | 1 | 2 |
| 134 | prometheus-lxc | running | 1024 МБ | 1 | 4 |
| 139 | syncthing-lxc | running | 1024 МБ | 1 | 2 |
| 140 | gitea-lxc | running | 2048 МБ | 1 | 2 |
| 151 | postgres-rbac-lxc | running | 2048 МБ | 1 | 0 |
| 155 | matrix | running | 6144 МБ | 4 | 6 |
| 160 | llm-lxc | stopped | 4096 МБ | 2 | 0 |
| 161 | gateway-lxc | running | 256 МБ | 1 | 0 |
| 201 | headscale-lxc | running | 1024 МБ | 1 | 0 |
## Что где работает
### CT 101 — proxy-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `npm-app-1` | `jc21/nginx-proxy-manager:latest` | `npm` | 80-81/tcp, 80-81/tcp, 443/tcp, 443/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `npm`
**Критичные:** `npm`
### CT 102 — portal-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `dashy` | `lissy93/dashy:latest` | `dashy` | — |
| `oauth2-proxy-dashy` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 9983/tcp, 9983/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `dashy`
### CT 103 — media-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `jellyfin` | `jellyfin/jellyfin:latest` | `jellyfin` | — |
| `oauth2-proxy-jellyfin` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 8097/tcp, 8097/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `jellyfin`
### CT 105 — files-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `paperless` | `ghcr.io/paperless-ngx/paperless-ngx:latest` | `sync-lxc` | 8000/tcp, 8000/tcp |
| `paperless_redis` | `redis:7-alpine` | `sync-lxc` | — |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `syncthing` | `lscr.io/linuxserver/syncthing:latest` | `sync-lxc` | — |
В реестре обновлений: `paperless`, `paperless_redis_files`
### CT 106 — smart-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `homeassistant` | `ghcr.io/home-assistant/home-assistant:stable` | — | — |
| `mosquitto` | `eclipse-mosquitto:latest` | `smart-lxc` | 1883/tcp, 1883/tcp, 9001/tcp, 9001/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `zigbee2mqtt` | `koenkk/zigbee2mqtt:latest` | `smart-lxc` | 8080/tcp, 8080/tcp |
В реестре обновлений: `homeassistant`, `mosquitto`, `zigbee2mqtt`
**Критичные:** `homeassistant`
### CT 107 — utils-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `adguard` | `adguard/adguardhome:latest` | `network-lxc` | — |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `uptime_kuma` | `louislam/uptime-kuma:latest` | `network-lxc` | 3001/tcp, 3001/tcp |
В реестре обновлений: `adguard`, `uptime-kuma`
**Критичные:** `adguard`
### CT 108 — automation-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `n8n` | `n8nio/n8n:latest` | `automation-lxc` | 5680/tcp, 5680/tcp |
| `node_red` | `nodered/node-red:latest` | `automation-lxc` | 1880/tcp, 1880/tcp |
| `oauth2-proxy-n8n` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | `automation-lxc` | 5678/tcp, 5678/tcp |
| `oauth2-proxy-nodered` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | `automation-lxc` | 1881/tcp, 1881/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `tg-admin-bot` | `telegram-admin-bot-tg-admin-bot` | `telegram-admin-bot` | — |
В реестре обновлений: `n8n`, `tg-admin-bot`
**Критичные:** `n8n`
### CT 109 — cloud-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `files_db` | `mariadb:10.6` | `files-lxc` | — |
| `nextcloud` | `nextcloud:latest` | `files-lxc` | 80/tcp, 80/tcp |
| `oauth2-proxy-vaultwarden` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 8001/tcp, 8001/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `vaultwarden` | `vaultwarden/server:latest` | `files-lxc` | 80/tcp, 80/tcp |
В реестре обновлений: `files_db`, `nextcloud`, `vaultwarden`
**Критичные:** `vaultwarden`, `nextcloud`, `files_db`
### CT 110 — office-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `firefly` | `fireflyiii/core:latest` | `lifestyle-lxc` | 8080/tcp, 8080/tcp |
| `mealie` | `ghcr.io/mealie-recipes/mealie:latest` | `lifestyle-lxc` | 9000/tcp, 9000/tcp |
| `oauth2-proxy-paperless` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 9981/tcp, 9981/tcp |
| `paperless_redis` | `redis:7-alpine` | `lifestyle-lxc` | — |
| `paperless_web` | `ghcr.io/paperless-ngx/paperless-ngx:latest` | `lifestyle-lxc` | 8000/tcp, 8000/tcp |
| `paperless_worker` | `ghcr.io/paperless-ngx/paperless-ngx:latest` | `lifestyle-lxc` | — |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `firefly`, `mealie`, `paperless_redis_office`, `paperless_web`, `paperless_worker`
### CT 111 — reading-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `calibre-web` | `linuxserver/calibre-web:latest` | `calibre-web` | 8083/tcp, 8083/tcp |
| `calibre-web-old-20261014-180019` | `linuxserver/calibre-web:latest` | — | — |
| `duplicati` | `duplicati/duplicati:latest` | — | 8200/tcp, 8200/tcp |
| `freshrss` | `freshrss/freshrss:latest` | `freshrss` | 80/tcp, 80/tcp |
| `freshrss-old-20261014-180053` | `9100f649f5c9` | — | — |
| `oauth2-proxy-calibre` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 9982/tcp, 9982/tcp |
| `oauth2-proxy-freshrss` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 8091/tcp, 8091/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `calibre`, `duplicati`, `freshrss`
**Критичные:** `duplicati`
### CT 113 — backup-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `grafana` | `grafana/grafana:latest` | `grafana` | 3000/tcp, 3000/tcp |
| `loki` | `grafana/loki:3.2.1` | — | 3100/tcp, 3100/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `grafana`, `loki`
### CT 114 — authentik-security
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `authentik-security-postgresql-1` | `postgres:16-alpine` | `authentik-security` | — |
| `authentik-security-redis-1` | `redis:7-alpine` | `authentik-security` | — |
| `authentik-security-server-1` | `ghcr.io/goauthentik/server:latest` | `authentik-security` | 9000/tcp, 9000/tcp, 9443/tcp, 9443/tcp |
| `authentik-security-worker-1` | `ghcr.io/goauthentik/server:latest` | `authentik-security` | — |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `authentik`
**Критичные:** `authentik`
### CT 115 — OpenClaw
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `nats` | `nats:2.10.17-alpine` | `swarm` | 4222/tcp, 4222/tcp, 8222/tcp, 8222/tcp |
| `openclaw-old-20261014-181148` | `3814fb1f62f9` | — | — |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `swarm-redis` | `redis:7-alpine` | `swarm` | 6379/tcp, 6379/tcp |
В реестре обновлений: `nats`, `openclaw`, `swarm-redis`
**Критичные:** `nats`, `swarm-redis`
### CT 116 — plex-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `oauth2-proxy-plex` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 9977/tcp, 9977/tcp |
| `plex` | `linuxserver/plex:latest` | `plex` | 32400/tcp, 32400/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `plex`
### CT 117 — sonarr-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `oauth2-proxy-sonarr` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 9989/tcp, 9989/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `sonarr` | `lscr.io/linuxserver/sonarr:latest` | `sonarr` | 8989/tcp, 8989/tcp |
В реестре обновлений: `sonarr`
### CT 118 — radarr-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `oauth2-proxy-radarr` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 9988/tcp, 9988/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `radarr` | `lscr.io/linuxserver/radarr:latest` | `radarr` | 7878/tcp, 7878/tcp |
В реестре обновлений: `radarr`
### CT 119 — prowlarr-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `oauth2-proxy-prowlarr` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 9987/tcp, 9987/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `prowlarr` | `lscr.io/linuxserver/prowlarr:latest` | `prowlarr` | 9696/tcp, 9696/tcp |
В реестре обновлений: `prowlarr`
### CT 120 — bazarr-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `bazarr` | `lscr.io/linuxserver/bazarr:latest` | `bazarr` | 6767/tcp, 6767/tcp |
| `oauth2-proxy-bazarr` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 9986/tcp, 9986/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `bazarr`
### CT 121 — overseerr-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `oauth2-proxy-overseerr` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 9985/tcp, 9985/tcp |
| `overseerr` | `lscr.io/linuxserver/overseerr:latest` | `overseerr` | 5055/tcp, 5055/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `overseerr`
### CT 122 — tautulli-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `oauth2-proxy-tautulli` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | 9984/tcp, 9984/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `tautulli` | `tautulli/tautulli:latest` | `tautulli` | 8181/tcp, 8181/tcp |
В реестре обновлений: `tautulli`
### CT 125 — navidrome-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `navidrome` | `deluan/navidrome:latest` | `navidrome` | — |
| `oauth2-proxy-navidrome` | `quay.io/oauth2-proxy/oauth2-proxy:latest` | — | — |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `navidrome`
### CT 127 — linkwarden-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `linkding` | `sissbruecker/linkding:latest` | `linkding` | 9090/tcp, 9090/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `linkding`
### CT 134 — prometheus-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `alertmanager` | `prom/alertmanager:v0.27.0` | — | — |
| `buryan-alert-webhook` | `python:3.12-alpine` | — | — |
| `prometheus` | `prom/prometheus:latest` | `prometheus` | 9090/tcp, 9090/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `alertmanager`, `buryan-alert-webhook`, `prometheus`
**Критичные:** `alertmanager`
### CT 139 — syncthing-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `promtail` | `grafana/promtail:3.2.1` | — | — |
| `syncthing` | `syncthing/syncthing:latest` | `syncthing` | 8384/tcp, 8384/tcp |
В реестре обновлений: `syncthing`
### CT 140 — gitea-lxc
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `gitea` | `gitea/gitea:latest` | `gitea` | 3000/tcp, 3000/tcp, 22/tcp, 22/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `gitea`
**Критичные:** `gitea`
### CT 155 — matrix
| Контейнер | Образ | Проект compose | Порты |
|---|---|---|---|
| `element-web` | `vectorim/element-web:latest` | `element` | 80/tcp |
| `livekit` | `livekit/livekit-server:latest` | `livekit` | — |
| `matrix-coturn` | `coturn/coturn:latest` | — | — |
| `matrix-synapse` | `matrixdotorg/synapse:latest` | `matrix` | 8008/tcp |
| `mautrix-telegram` | `dock.mau.dev/mautrix/telegram:latest` | `mautrix-telegram` | 29317/tcp |
| `promtail` | `grafana/promtail:3.2.1` | — | — |
В реестре обновлений: `element-web`, `livekit`, `matrix`, `matrix-coturn`, `mautrix-telegram`
**Критичные:** `matrix`, `livekit`, `matrix-coturn`
## Домены
Всего **40**. Каждый обслуживается внешним nginx на VPS и, через
перепись в AdGuard, домашним nginx.
| Домен | |
|---|---|
| `adguard.buryans.ru` | `media.buryans.ru` |
| `admin.buryans.ru` | `music.buryans.ru` |
| `authentik.buryans.ru` | `n8n.buryans.ru` |
| `backup.buryans.ru` | `news.buryans.ru` |
| `bazarr.buryans.ru` | `ns1.buryans.ru` |
| `books.buryans.ru` | `ombi.buryans.ru` |
| `chat.buryans.ru` | `openclaw.buryans.ru` |
| `docs.buryans.ru` | `plex.buryans.ru` |
| `element.buryans.ru` | `prowlarr.buryans.ru` |
| `files.buryans.ru` | `pve.buryans.ru` |
| `finance.buryans.ru` | `radarr.buryans.ru` |
| `flow.buryans.ru` | `recipes.buryans.ru` |
| `git.buryans.ru` | `requests.buryans.ru` |
| `headscale.buryans.ru` | `rss.buryans.ru` |
| `home.buryans.ru` | `sonarr.buryans.ru` |
| `hub.buryans.ru` | `status.buryans.ru` |
| `immich.buryans.ru` | `sync.buryans.ru` |
| `links.buryans.ru` | `turn.buryans.ru` |
| `matrix.buryans.ru` | `vault.buryans.ru` |
| `meals.buryans.ru` | `www.buryans.ru` |
## Что не покрыто
* `promtail` (сбор журналов) — по одному в каждом контейнере, отдельно не обновляется.
* `oauth2-proxy-*` — прокси авторизации, обновляются вместе со стеком.
* Службы без compose (duplicati, alertmanager, buryan-alert-webhook) —
обновление скачивает образ, но пересоздание контейнера требует рук.
+1
View File
@@ -47,6 +47,7 @@
## 1. ЗАВЕРШИТЬ ОБНОВЛЕНИЯ
| № | Задача | Состояние |
+178
View File
@@ -0,0 +1,178 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Строит карту хозяйства из ЖИВЫХ данных (задача 4.6.1).
ЗАЧЕМ. Карта «что где живёт» обычно ведётся руками и устаревает. Здесь
она собирается из того, что реально работает: список контейнеров,
портов, проектов compose, доменов и проверок. Такую карту нельзя
забыть обновить — её пересобирают.
Источники:
* pct list — контейнеры Proxmox;
* docker ps — контейнеры внутри;
* services.yaml — реестр обновлений (роль службы, критичность);
* конфигурация VPS — домены;
* AdGuard — перепись доменов.
"""
import io
import json
import subprocess
import sys
import yaml
OUT = "/root/buryan-infra/docs/INFRASTRUCTURE-MAP.md"
SERV = "/root/buryan-infra/ops/update-manager/services.yaml"
def run(cmd):
r = subprocess.run(cmd, shell=True, capture_output=True, text=True, timeout=180)
return r.stdout.strip()
# --- реестр служб ---
reg = yaml.safe_load(io.open(SERV, encoding="utf-8"))["services"]
by_ct = {}
for name, s in reg.items():
ct = s.get("ct_id")
if ct:
by_ct.setdefault(int(ct), []).append((name, s))
# --- контейнеры Proxmox ---
print("собираю данные...")
cts = []
for line in run("pct list").splitlines()[1:]:
parts = line.split()
if len(parts) < 3:
continue
vmid, status, name = parts[0], parts[1], " ".join(parts[2:])
cfg = run("pct config %s" % vmid)
hostname = ""
memory = ""
cores = ""
for l in cfg.splitlines():
if l.startswith("hostname:"):
hostname = l.split(":", 1)[1].strip()
elif l.startswith("memory:"):
memory = l.split(":", 1)[1].strip()
elif l.startswith("cores:"):
cores = l.split(":", 1)[1].strip()
cts.append({"vmid": int(vmid), "status": status, "name": name,
"hostname": hostname, "memory": memory, "cores": cores})
# --- контейнеры docker ---
for ct in cts:
if ct["status"] != "running":
ct["containers"] = []
continue
has = run("pct exec %s -- bash -c 'command -v docker >/dev/null 2>&1 && echo ok'" % ct["vmid"])
if has != "ok":
ct["containers"] = []
continue
out = run(
"pct exec %s -- bash -c 'docker ps --format \"{{.Names}}|{{.Image}}|"
"{{.Label \\\"com.docker.compose.project\\\"}}|{{.Ports}}\"'" % ct["vmid"])
conts = []
for line in out.splitlines():
if not line.strip():
continue
p = line.split("|")
if len(p) < 4:
continue
ports = []
for seg in p[3].split(","):
seg = seg.strip()
if "->" in seg:
left, right = seg.split("->", 1)
ports.append(right.split("/")[0] + "/" + (right.split("/")[1] if "/" in right else "tcp"))
conts.append({"name": p[0], "image": p[1], "project": p[2], "ports": ports})
ct["containers"] = conts
# --- домены с VPS ---
dom = run("ssh -o BatchMode=yes root@193.233.210.184 "
"\"grep -oE 'server_name [a-z0-9.-]+' /etc/nginx/conf.d/buryans-all.conf "
"| awk '{print \\$2}' | sort -u\" 2>/dev/null")
domains = [d for d in dom.split() if d]
# --- собираю документ ---
L = []
L.append("# Карта хозяйства")
L.append("")
L.append("**Собрана из живых данных 17.10.2026.** Не править вручную:")
L.append("карту пересобирает `ops/inventory/build-map.py`, поэтому она не")
L.append("может устареть от забывчивости.")
L.append("")
L.append("## Сводка")
L.append("")
L.append("| Что | Сколько |")
L.append("|---|---|")
L.append("| Контейнеров Proxmox | %d |" % len(cts))
L.append("| Из них запущено | %d |" % sum(1 for c in cts if c["status"] == "running"))
L.append("| Контейнеров Docker | %d |" % sum(len(c["containers"]) for c in cts))
L.append("| Служб в реестре обновлений | %d |" % len(reg))
L.append("| Доменов | %d |" % len(domains))
L.append("")
L.append("## Контейнеры по именам")
L.append("")
L.append("| CT | Имя | Состояние | Память | Cores | Docker-контейнеров |")
L.append("|---|---|---|---|---|---|")
for c in sorted(cts, key=lambda x: x["vmid"]):
L.append("| %d | %s | %s | %s МБ | %s | %d |" % (
c["vmid"], c["hostname"] or c["name"], c["status"],
c["memory"] or "—", c["cores"] or "—", len(c["containers"])))
L.append("")
L.append("## Что где работает")
L.append("")
for c in sorted(cts, key=lambda x: x["vmid"]):
if not c["containers"]:
continue
L.append("### CT %d — %s" % (c["vmid"], c["hostname"] or c["name"]))
L.append("")
L.append("| Контейнер | Образ | Проект compose | Порты |")
L.append("|---|---|---|---|")
for k in sorted(c["containers"], key=lambda x: x["name"]):
L.append("| `%s` | `%s` | %s | %s |" % (
k["name"], k["image"][:44],
("`%s`" % k["project"]) if k["project"] else "—",
", ".join(k["ports"][:4]) or "—"))
L.append("")
# службы из реестра в этом CT
if c["vmid"] in by_ct:
names = ", ".join("`%s`%s" % (n, "" if s.get("critical") else "")
for n, s in sorted(by_ct[c["vmid"]]))
L.append("В реестре обновлений: %s" % names)
crit = [n for n, s in by_ct[c["vmid"]] if s.get("critical")]
if crit:
L.append("")
L.append("**Критичные:** %s" % ", ".join("`%s`" % n for n in crit))
L.append("")
L.append("## Домены")
L.append("")
L.append("Всего **%d**. Каждый обслуживается внешним nginx на VPS и, через" % len(domains))
L.append("перепись в AdGuard, домашним nginx.")
L.append("")
L.append("| Домен | |")
L.append("|---|---|")
half = (len(domains) + 1) // 2
for i in range(half):
a = domains[i]
b = domains[i + half] if i + half < len(domains) else ""
L.append("| `%s` | %s |" % (a, ("`%s`" % b) if b else ""))
L.append("")
L.append("## Что не покрыто")
L.append("")
unc = [k for k in ("promtail", "oauth2-proxy")]
L.append("* `promtail` (сбор журналов) — по одному в каждом контейнере, отдельно не обновляется.")
L.append("* `oauth2-proxy-*` — прокси авторизации, обновляются вместе со стеком.")
L.append("* Службы без compose (duplicati, alertmanager, buryan-alert-webhook) —")
L.append(" обновление скачивает образ, но пересоздание контейнера требует рук.")
io.open(OUT, "w", encoding="utf-8").write("\n".join(L) + "\n")
print("записано: %s (%d строк)" % (OUT, len(L)))
print(" контейнеров Proxmox: %d" % len(cts))
print(" контейнеров Docker: %d" % sum(len(c["containers"]) for c in cts))
print(" доменов: %d" % len(domains))