From 528f82e7a41d34bf25fd73146c67f3cc14e212c7 Mon Sep 17 00:00:00 2001 From: Roman Buryan Date: Tue, 10 Nov 2026 15:13:40 +0300 Subject: [PATCH] =?UTF-8?q?[HUB]=2012=20=D0=BF=D1=80=D0=B8=D0=BA=D0=BB?= =?UTF-8?q?=D0=B0=D0=B4=D0=BD=D1=8B=D1=85=20=D1=82=D0=B0=D0=B9=D0=BC=D0=B5?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B2=D0=B5=D0=B4?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=B2=20Hermes=20(mesh,=20selfheal,=20age?= =?UTF-8?q?nts,=20brain,=20storage-metrics,=20inbox,=20tg-ingest,=20search?= =?UTF-8?q?-index,=20goals,=20jf-collections,=20finance,=20media-maint).?= =?UTF-8?q?=20=D0=9A=D0=B0=D0=B6=D0=B4=D1=8B=D0=B9=20=D0=BF=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=B5=D0=BD=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=D0=BD=D0=BE=D0=BC=20=D0=B4=D0=BE=20=D0=BE=D1=82=D0=BA=D0=BB?= =?UTF-8?q?=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=82=D0=B0=D0=B9=D0=BC?= =?UTF-8?q?=D0=B5=D1=80=D0=B0.=20=D0=91=D1=8D=D0=BA=D0=B0=D0=BF=D1=8B,=20?= =?UTF-8?q?=D1=81=D0=B5=D1=80=D1=82=D0=B8=D1=84=D0=B8=D0=BA=D0=B0=D1=82?= =?UTF-8?q?=D1=8B=20=D0=B8=20=D0=B2=D0=BE=D1=81=D1=81=D1=82=D0=B0=D0=BD?= =?UTF-8?q?=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=81=D0=BE?= =?UTF-8?q?=D0=B7=D0=BD=D0=B0=D0=BD=D0=BD=D0=BE=20=D0=BE=D1=81=D1=82=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=B2=20systemd.=20=D0=90?= =?UTF-8?q?=D0=BA=D1=82=D0=B8=D0=B2=D0=BD=D1=8B=D1=85=20=D0=B7=D0=B0=D0=B4?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B9=20Hermes:=2041?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ops/automations/registry.yaml | 35 +++++++++------- ops/hub/TIMERS-TO-HERMES.md | 79 +++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+), 16 deletions(-) create mode 100644 ops/hub/TIMERS-TO-HERMES.md diff --git a/ops/automations/registry.yaml b/ops/automations/registry.yaml index b14ea74..664eb6a 100644 --- a/ops/automations/registry.yaml +++ b/ops/automations/registry.yaml @@ -1,11 +1,11 @@ # Реестр автоматизаций Buryans Hub -# Сгенерировано: 2026-11-10 14:49 (ops/scripts/build_automations_registry.py) -total: 147 +# Сгенерировано: 2026-11-10 15:13 (ops/scripts/build_automations_registry.py) +total: 150 by_source: cron.d: 49 crontab: 16 - hermes: 28 - systemd: 54 + hermes: 43 + systemd: 42 items: - {"source": "crontab", "line": "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"} - {"source": "crontab", "line": "0 2 * * * /opt/buryan-hub/scripts/pg-backup-ct151.sh >> /var/log/buryan-hub/backups/cron-pg.log 2>&1"} @@ -79,10 +79,8 @@ items: - {"source": "systemd", "timer": "e2scrub_all.timer", "schedule": "Sun", "unit": "e2scrub_all.service"} - {"source": "systemd", "timer": "fstrim.timer", "schedule": "Mon", "unit": "fstrim.service"} - {"source": "systemd", "timer": "hub-actions.timer", "schedule": "*-*-*", "unit": "hub-actions.service"} -- {"source": "systemd", "timer": "hub-agents.timer", "schedule": "*-*-*", "unit": "hub-agents.service"} - {"source": "systemd", "timer": "hub-archive-copy.timer", "schedule": "*-*-*", "unit": "hub-archive-copy.service"} - {"source": "systemd", "timer": "hub-boot-recover.timer", "schedule": "?", "unit": "hub-boot-recover.service"} -- {"source": "systemd", "timer": "hub-brain.timer", "schedule": "*-*-*", "unit": "hub-brain.service"} - {"source": "systemd", "timer": "hub-cert-sync.timer", "schedule": "*-*-*", "unit": "hub-cert-sync.service"} - {"source": "systemd", "timer": "hub-chief.timer", "schedule": "*-*-*", "unit": "hub-chief.service"} - {"source": "systemd", "timer": "hub-ct-cleanup.timer", "schedule": "Sun", "unit": "hub-ct-cleanup.service"} @@ -90,26 +88,16 @@ items: - {"source": "systemd", "timer": "hub-digest.timer", "schedule": "*-*-*", "unit": "hub-digest.service"} - {"source": "systemd", "timer": "hub-dl-cleanup.timer", "schedule": "*-*-*", "unit": "hub-dl-cleanup.service"} - {"source": "systemd", "timer": "hub-drill.timer", "schedule": "*-*-01", "unit": "hub-drill.service"} -- {"source": "systemd", "timer": "hub-finance.timer", "schedule": "*-*-*", "unit": "hub-finance.service"} -- {"source": "systemd", "timer": "hub-goals.timer", "schedule": "*-*-*", "unit": "hub-goals.service"} -- {"source": "systemd", "timer": "hub-inbox.timer", "schedule": "30min", "unit": "hub-inbox.service"} - {"source": "systemd", "timer": "hub-integrity.timer", "schedule": "Sun", "unit": "hub-integrity.service"} -- {"source": "systemd", "timer": "hub-jf-collections.timer", "schedule": "*-*-*", "unit": "hub-jf-collections.service"} -- {"source": "systemd", "timer": "hub-media-maint.timer", "schedule": "Sun", "unit": "hub-media-maint.service"} -- {"source": "systemd", "timer": "hub-mesh.timer", "schedule": "*-*-*", "unit": "hub-mesh.service"} - {"source": "systemd", "timer": "hub-nightly-check.timer", "schedule": "*-*-*", "unit": "hub-nightly-check.service"} - {"source": "systemd", "timer": "hub-pre-prune.timer", "schedule": "*-*-*", "unit": "hub-pre-prune.service"} - {"source": "systemd", "timer": "hub-renovate.timer", "schedule": "*-*-*", "unit": "hub-renovate.service"} - {"source": "systemd", "timer": "hub-restore-drill.timer", "schedule": "*-*-01", "unit": "hub-restore-drill.service"} -- {"source": "systemd", "timer": "hub-search-index.timer", "schedule": "*-*-*", "unit": "hub-search-index.service"} - {"source": "systemd", "timer": "hub-second-contour.timer", "schedule": "Sun", "unit": "hub-second-contour.service"} -- {"source": "systemd", "timer": "hub-selfheal.timer", "schedule": "15min", "unit": "hub-selfheal.service"} - {"source": "systemd", "timer": "hub-services-backup.timer", "schedule": "*-*-*", "unit": "hub-services-backup.service"} - {"source": "systemd", "timer": "hub-snap-clean.timer", "schedule": "*-*-*", "unit": "hub-snap-clean.service"} - {"source": "systemd", "timer": "hub-snapshot.timer", "schedule": "*-*-*", "unit": "hub-snapshot.service"} - {"source": "systemd", "timer": "hub-standard.timer", "schedule": "*-*-*", "unit": "hub-standard.service"} -- {"source": "systemd", "timer": "hub-storage-metrics.timer", "schedule": "*-*-*", "unit": "hub-storage-metrics.service"} -- {"source": "systemd", "timer": "hub-tg-ingest.timer", "schedule": "30min", "unit": "hub-tg-ingest.service"} - {"source": "systemd", "timer": "hub-vps-backup.timer", "schedule": "*-*-*", "unit": "hub-vps-backup.service"} - {"source": "systemd", "timer": "hub-weekly.timer", "schedule": "Sun", "unit": "hub-weekly.service"} - {"source": "systemd", "timer": "llm-night-start.timer", "schedule": "*-*-*", "unit": "llm-night-start.service"} @@ -154,3 +142,18 @@ items: - {"source": "hermes", "job": "research-finalize", "schedule": "every 3600s", "command": "/usr/bin/python3 /opt/work-hub/research/research_finalize.py"} - {"source": "hermes", "job": "notify-digest", "schedule": "daily 09:00", "command": "/usr/bin/python3 /opt/hub-core/notify_digest.py"} - {"source": "hermes", "job": "registry-drift", "schedule": "daily 06:40", "command": "/usr/bin/python3 /root/buryan-infra/ops/scripts/registry_drift.py"} +- {"source": "hermes", "job": "smoke-hub", "schedule": "every 21600s", "command": "/usr/bin/python3 /root/buryan-infra/ops/scripts/smoke_hub.py"} +- {"source": "hermes", "job": "morning-briefing", "schedule": "daily 08:00", "command": "/usr/bin/python3 /root/buryan-infra/ops/scripts/hub_briefing.py"} +- {"source": "hermes", "job": "docs-index", "schedule": "daily 06:50", "command": "/usr/bin/python3 /root/buryan-infra/ops/scripts/build_docs_index.py"} +- {"source": "hermes", "job": "mesh-watch", "schedule": "every 600s", "command": "/opt/music-tools/venv/bin/python /opt/hub-core/mesh_watch.py"} +- {"source": "hermes", "job": "selfheal", "schedule": "every 900s", "command": "/opt/music-tools/venv/bin/python /opt/hub-core/selfheal.py"} +- {"source": "hermes", "job": "agents-runner", "schedule": "every 1800s", "command": "/opt/music-tools/venv/bin/python /opt/hub-agents/agent_runner.py"} +- {"source": "hermes", "job": "agents-brain", "schedule": "every 3600s", "command": "/opt/music-tools/venv/bin/python /opt/hub-agents/agent_brain.py"} +- {"source": "hermes", "job": "storage-metrics", "schedule": "every 900s", "command": "/opt/music-tools/venv/bin/python /opt/hub-core/export_storage.py"} +- {"source": "hermes", "job": "inbox-parse", "schedule": "every 1800s", "command": "/opt/music-tools/venv/bin/python /opt/hub-core/inbox_parse.py"} +- {"source": "hermes", "job": "tg-ingest", "schedule": "every 1800s", "command": "/opt/music-tools/venv/bin/python /opt/hub-core/tg_ingest.py"} +- {"source": "hermes", "job": "search-index", "schedule": "daily 06:20", "command": "/opt/music-tools/venv/bin/python /opt/hub-core/search_index.py"} +- {"source": "hermes", "job": "goals", "schedule": "daily 08:30", "command": "/opt/music-tools/venv/bin/python /opt/hub-core/goal_metrics.py"} +- {"source": "hermes", "job": "jf-collections", "schedule": "daily 05:30", "command": "/usr/bin/python3 /opt/hub-core/jf_collections.py"} +- {"source": "hermes", "job": "finance", "schedule": "daily 09:15", "command": "/opt/music-tools/venv/bin/python /opt/hub-core/finance_receipts.py"} +- {"source": "hermes", "job": "media-maint", "schedule": "daily 11:00", "command": "/usr/local/bin/hub-media-maint-daily.sh"} diff --git a/ops/hub/TIMERS-TO-HERMES.md b/ops/hub/TIMERS-TO-HERMES.md new file mode 100644 index 0000000..aab4a92 --- /dev/null +++ b/ops/hub/TIMERS-TO-HERMES.md @@ -0,0 +1,79 @@ +# 12 прикладных таймеров → Hermes (10.11.2026) + +## Что перенесено + +| Таймер | Расписание | Задание Hermes | +|---|---|---| +| hub-mesh | каждые 10 мин | `mesh-watch` | +| hub-selfheal | каждые 15 мин | `selfheal` | +| hub-agents | каждые 30 мин | `agents-runner` | +| hub-brain | каждый час | `agents-brain` | +| hub-storage-metrics | каждые 15 мин | `storage-metrics` | +| hub-inbox | каждые 30 мин | `inbox-parse` | +| hub-tg-ingest | каждые 30 мин | `tg-ingest` | +| hub-search-index | 06:20 | `search-index` | +| hub-goals | 08:30 | `goals` | +| hub-jf-collections | 05:30 | `jf-collections` | +| hub-finance | 09:15 | `finance` | +| hub-media-maint | вс 11:00 | `media-maint` | + +## Как проверял каждый + +1. Добавил задание в `jobs.yaml`. +2. Запустил вручную через `POST /jobs/<имя>/run`. +3. Дождался `last_status` из Postgres. +4. **Только при `ok`** отключил systemd-таймер. + +Ни одно задание не отключено без успешной проверки — все 12 отработали с `ok`. + +## Ловушка: недельное расписание + +Hermes умеет `every_seconds` и `daily_at`, но **не умеет «раз в неделю»**. +Для `media-maint` (воскресенье) сделан обёрточный скрипт +`/usr/local/bin/hub-media-maint-daily.sh`: запускается ежедневно в 11:00, +но работает только если `date +%u` = 7. + +Проще было бы оставить в systemd — но тогда снова два планировщика. + +## Что осталось в systemd (осознанно) + +``` +hub-cert-sync — сертификаты (не должны зависеть от приложения) +hub-db-dumps — бэкап баз +hub-services-backup — бэкап compose-файлов +hub-archive-copy — копия в архив +hub-vps-backup — второй контур +hub-snapshot — снапшоты +hub-integrity — проверка целостности +hub-restore-drill — учения по восстановлению +hub-drill — учения +hub-boot-recover — восстановление после загрузки +hub-second-contour — второй контур +hub-snap-clean — чистка снапшотов +hub-standard — ночная проверка стандарта +hub-ct-cleanup — чистка контейнеров +hub-nightly-check — ночная проверка +hub-actions — журнал действий агентов +hub-dl-cleanup — чистка загрузок +hub-chief — сводка главы +hub-digest — семейный дайджест +hub-renovate — обновления зависимостей +hub-pre-prune — подготовка к чистке +``` + +**Принцип:** бэкапы, сертификаты, восстановление — ниже уровнем, чем приложение. + +## Итог + +| Показатель | Было | Стало | +|---|---|---| +| Задания Hermes | 29 | **41 активное** | +| Таймеры hub-* | 35 | **22** (21 активный) | +| Где смотреть расписание | 4 места | реестр + Hermes | + +## Проверка + +``` +смоук платформы: ок 9, провалов 0 +реестр: 147 записей +```