feat: configuration backup management with manual and auto backup
Add backup/restore functionality for the SQLite database. Users can trigger manual backups, configure automatic backups on an interval with retention policies, list/download/delete backups, and restore from any backup. - Backup engine using VACUUM INTO (safe with WAL mode) - Backup metadata tracked in DB, files stored in DATA_DIR/backups/ - Settings: backup_enabled, backup_interval_hours, backup_retention_count - API: POST/GET/DELETE /api/backups, download, restore endpoints - Autobackup via cron scheduler with configurable interval - Retention: prune on startup, after each backup (manual and auto) - Orphan cleanup: removes backup files without metadata on startup - Restore: replaces DB and triggers graceful server shutdown - Settings UI: /settings/backup with toggle, interval, retention config - Backup list with download, delete, restore actions - i18n: English and Russian translations
This commit is contained in:
+24
-1
@@ -24,7 +24,8 @@ import type {
|
||||
VolumeScopeInfo,
|
||||
BrowseResult,
|
||||
DnsZone,
|
||||
DnsRecordView
|
||||
DnsRecordView,
|
||||
BackupInfo
|
||||
} from './types';
|
||||
|
||||
// ── Helpers ─────────────────────────────────────────────────────────
|
||||
@@ -292,6 +293,28 @@ export function deleteDnsRecord(fqdn: string): Promise<void> {
|
||||
return del<void>(`/api/dns/records/${encodeURIComponent(fqdn)}`);
|
||||
}
|
||||
|
||||
// ── Backups ────────────────────────────────────────────────────────
|
||||
|
||||
export function listBackups(): Promise<BackupInfo[]> {
|
||||
return get<BackupInfo[]>('/api/backups');
|
||||
}
|
||||
|
||||
export function triggerBackup(): Promise<BackupInfo> {
|
||||
return post<BackupInfo>('/api/backups');
|
||||
}
|
||||
|
||||
export function deleteBackup(id: string): Promise<void> {
|
||||
return del<void>(`/api/backups/${id}`);
|
||||
}
|
||||
|
||||
export function restoreBackup(id: string): Promise<{ status: string; message: string }> {
|
||||
return post<{ status: string; message: string }>(`/api/backups/${id}/restore`);
|
||||
}
|
||||
|
||||
export function backupDownloadUrl(id: string): string {
|
||||
return `/api/backups/${id}/download`;
|
||||
}
|
||||
|
||||
// ── Health ──────────────────────────────────────────────────────────
|
||||
|
||||
export function getHealth(): Promise<{ docker: DockerHealth }> {
|
||||
|
||||
Reference in New Issue
Block a user