gendesign/ops/gendesign-backup.default.example
bot-backend 7218c2094c
All checks were successful
CI Trade-In / changes (pull_request) Successful in 24s
CI Trade-In / backend-tests (pull_request) Has been skipped
CI / changes (pull_request) Successful in 29s
CI Trade-In / browser-tests (pull_request) Has been skipped
CI Trade-In / frontend-checks (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Successful in 3m15s
CI / backend-tests (pull_request) Successful in 7m37s
Бэкапы: образцы env ведут алерты в тему «Metrics», мёртвый uptime-сторож удалён (#3164)
Тема форума для уведомлений бэкапов задаётся только env-файлом на хосте, а в
образцах её не было вовсе. На проде она задана, но не та: 158 («алерты») в
/opt/gendesign/secrets/backup-notify.env и forgejo-backup.env на Beget и в
/etc/default/gendesign-backup на Poincare. По решению #3163 инфраструктура идёт
в 245 «Metrics». Значение на хостах этот коммит не меняет.

- ops/gendesign-backup*.default.example: строка #TELEGRAM_TOPIC_ID=245 с
  причиной и ловушкой: тема обязана лежать в одном файле с токеном и чатом,
  иначе notify() её не прочитает.
- ops/crontab-beget.cron сверен с живым crontab Beget: сторожа и бэкап волта
  получают BACKUP_ENV_FILE=/opt/gendesign/secrets/backup-notify.env. Без него
  переустановка crontab из репозитория глушила бы алерты бэкапов на Beget.
- ops/uptime-healthcheck.sh и его образец удалены: скрипт не запущен ни на
  одном хосте (crontab, cron.d, таймеры), доступность сторожат uptime-мониторы
  GlitchTip на Beget (gendsgn.ru, /health, meraocenka.ru — раз в 60 с).

Тест исполняет настоящий check-backup-staleness.sh с образцом, заполненным
по инструкции, и проверяет адрес в вызове curl: message_thread_id=245.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 12:49:33 +05:00

60 lines
3.6 KiB
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Environment file for ops/backup.sh (MAIN gendesign DB backup, #71).
#
# Install on the prod VM as a ROOT-OWNED, chmod-600 file that is NOT in git:
# sudo cp /opt/gendesign/ops/gendesign-backup.default.example /etc/default/gendesign-backup
# sudo chmod 600 /etc/default/gendesign-backup
# sudo $EDITOR /etc/default/gendesign-backup # fill in real S3 credentials
#
# backup.sh sources this file if present. With NO S3 vars set, dumps stay
# local-only under /opt/gendesign/backups (retention KEEP=7). Fill these in to
# also push each dump off-box to S3 (recommended — local-only dies with the VM).
# backup.sh now also dumps cluster globals (roles/GRANTs, via `pg_dumpall
# --globals-only`) alongside the main dump — same S3 vars, same bucket, no
# separate config needed (#2203).
#
# tradein-mvp/deploy/backup-tradein-db.sh (separate DB, separate cron job)
# prefers its OWN env file at /etc/default/tradein-backup, but falls back to
# THIS file if that one doesn't exist — so filling in the S3 vars here also
# enables off-box upload for the tradein DB backup, unless you want the two
# DBs going to different buckets/creds (then create /etc/default/tradein-backup
# with its own S3_* vars instead).
#
# To rehearse a restore from a dump this script produced (safe, throwaway
# container, never touches prod) see ops/restore-drill.sh.
#
# Missed-run alerting (#2203): ops/check-backup-staleness.sh (separate cron
# entry, see its header) alerts when a backup's sentinel goes stale. It reads
# TELEGRAM_BOT_TOKEN/TELEGRAM_CHAT_ID/TELEGRAM_TOPIC_ID from THIS file.
# Without the first two set, ops/check-backup-staleness.sh still logs, just
# doesn't send a Telegram alert.
# --- S3 off-site upload (Selectel S3-compatible). All four REQUIRED (#3085) —
# without them, backup.sh and backup-tradein-db.sh refuse to run unless
# BACKUP_ALLOW_LOCAL_ONLY=1 is also set (see below). ---
#S3_ENDPOINT=https://s3.ru-1.storage.selcloud.ru
#S3_BUCKET=gendsgn-backups
#S3_ACCESS_KEY=REPLACE_WITH_REAL_ACCESS_KEY
#S3_SECRET_KEY=REPLACE_WITH_REAL_SECRET_KEY
# --- missed-run alerting (Telegram) ---
#TELEGRAM_BOT_TOKEN=123456789:AA-REPLACE_WITH_REAL_BOT_TOKEN
#TELEGRAM_CHAT_ID=123456789
# Тема форума (#3164). Бэкапы — инфраструктура, по решению #3163 они идут в
# «Metrics» (245); «алерты» (158) — только для клиентских инцидентов. Без
# переменной сообщение уходит в общую тему. Держать В ТОМ ЖЕ файле, что токен и
# чат: notify() читает env-файл, только если их нет в окружении.
#TELEGRAM_TOPIC_ID=245
# --- optional overrides (defaults are sensible; uncomment only to change) ---
#BACKUP_ALLOW_LOCAL_ONLY=1 # explicit escape hatch: run without S3 creds and
# accept a local-only backup (still logs a loud
# WARNING each run). Leave unset in prod.
#KEEP=7 # how many recent local dumps to retain (applies to both
# the main dump series and the globals dump series)
#MIN_DUMP_BYTES=51200 # sanity floor for the MAIN dump; a dump smaller than
# this is treated as failed. No equivalent floor for the
# globals dump — a handful of roles legitimately gzips to
# well under this. tradein-backup.sh has its own,
# separate MIN_DUMP_BYTES (default 10240) — set in
# /etc/default/tradein-backup, not here.
#LOCAL_BACKUP_DIR=/opt/gendesign/backups