feat(backup): take Tinyforge DB snapshot before every deploy

Adds an opt-in "auto_backup_before_deploy" setting that triggers a
"pre-deploy" backup at the start of every project deploy via the deploy
pipeline (covers both the async HTTP path and the sync poller/webhook
path). Failures are logged to the deploy log but do not abort — missing
a backup is preferable to refusing to ship a fix.

- store: settings.auto_backup_before_deploy column + scan/update wiring
- backup: accept "pre-deploy" as a valid backup_type
- deployer: small PreDeployBackuper interface, hooked into runDeploy
  right after settings load and before any state-mutating work
- api: settings request/response surface the new flag
- web: ToggleSwitch on the backup settings page; "Pre-deploy" badge
  variant in the backup list (badge-warning so it stands out)
- i18n: en/ru strings for the toggle, help text, and badge label
This commit is contained in:
2026-05-07 02:14:26 +03:00
parent 0405ecd9ce
commit 8b886ddf2b
11 changed files with 95 additions and 13 deletions
+3
View File
@@ -553,6 +553,9 @@
"restoreFailed": "Failed to restore backup",
"typeManual": "Manual",
"typeAuto": "Auto",
"typePreDeploy": "Pre-deploy",
"preDeploy": "Backup before every deploy",
"preDeployHelp": "Take a Tinyforge DB snapshot at the start of every project deploy. Independent of the periodic schedule above; restorable from this list under the \"Pre-deploy\" type.",
"save": "Save",
"saving": "Saving...",
"saved": "Backup settings saved",
+3
View File
@@ -553,6 +553,9 @@
"restoreFailed": "Не удалось восстановить резервную копию",
"typeManual": "Ручная",
"typeAuto": "Авто",
"typePreDeploy": "Перед деплоем",
"preDeploy": "Снимок перед каждым деплоем",
"preDeployHelp": "Создавать снимок БД Tinyforge в начале каждого деплоя проекта. Независимо от периодического расписания выше; восстанавливается из списка ниже по типу «Перед деплоем».",
"save": "Сохранить",
"saving": "Сохранение...",
"saved": "Настройки копирования сохранены",
+1
View File
@@ -134,6 +134,7 @@ export interface Settings {
backup_enabled: boolean;
backup_interval_hours: number;
backup_retention_count: number;
auto_backup_before_deploy: boolean;
stats_interval_seconds: number;
stats_retention_hours: number;
updated_at: string;