Files
recover-server/internal/backup/source.go
Olaf Berberich 29a2886402 Initial commit: Disaster recovery CLI tool
A Go-based CLI tool for recovering servers from backups to new cloud VMs.

Features:
- Multi-cloud support: Exoscale, Cloudscale, Hetzner Cloud
- Backup sources: Local filesystem, Hetzner Storage Box
- 6-stage restore pipeline with /etc whitelist protection
- DNS migration with safety checks and auto-rollback
- Dry-run by default, requires --yes to execute
- Cloud-init for SSH key injection

Packages:
- cmd/recover-server: CLI commands (recover, migrate-dns, list, cleanup)
- internal/providers: Cloud provider implementations
- internal/backup: Backup source implementations
- internal/restore: 6-stage restore pipeline
- internal/dns: Exoscale DNS management
- internal/ui: Prompts, progress, dry-run display
- internal/config: Environment and host configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-08 00:31:27 +00:00

41 lines
1.2 KiB
Go

package backup
import (
"context"
"time"
)
// BackupInfo contains metadata about a backup
type BackupInfo struct {
Host string
Source string // "local" or "hetzner"
Path string // Full path to backup
Timestamp time.Time // Last modified time
SizeBytes int64 // Total size
HasRoot bool // Has /root backup
HasOpt bool // Has /opt backup
HasEtc bool // Has /etc backup
}
// BackupSource defines the interface for backup sources
type BackupSource interface {
// Name returns the source name
Name() string
// List returns available backups for a host (or all hosts if empty)
List(ctx context.Context, host string) ([]BackupInfo, error)
// SyncTo syncs backup data to target VM via rsync over SSH
// targetSSH is user@host, sshKeyPath is path to private key
SyncTo(ctx context.Context, host string, targetSSH string, sshKeyPath string, dirs []string) error
// GetPath returns the base path for a host's backup
GetPath(host string) string
// Validate checks if backup source is accessible
Validate(ctx context.Context) error
}
// SupportedDirs lists directories that can be restored
var SupportedDirs = []string{"root", "opt", "etc"}