Documentation
¶
Overview ¶
Package backup creates scheduled .tar.gz backups of a togo app's database and configured files (the togo answer to Spatie Backup).
A backup bundles an optional database dump (pg_dump / mysqldump / sqlite copy) plus configured source directories into a single gzip-compressed tar archive written to a destination directory. Retention prunes old archives, and run records are queryable over a Go + REST API. Pair it with the scheduler plugin to run backups on a cadence.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backup ¶
type Backup struct {
ID string `json:"id"`
Name string `json:"name"`
Path string `json:"path"`
Size int64 `json:"size"`
Status string `json:"status"` // done | failed
WithDB bool `json:"with_db"`
CreatedAt time.Time `json:"created_at"`
Error string `json:"error,omitempty"`
}
Backup is a record of one archive.
type Config ¶
type Config struct {
Sources []string // directories/files to include
DBDriver string // "postgres" | "mysql" | "sqlite" (empty = no DB dump)
DBDSN string // connection string, or a sqlite file path
Dir string // output directory for archives (default "backups")
Keep int // retention: keep the newest N archives (0 = keep all)
}
Config controls what is backed up and where.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the backup runtime stored on the kernel (k.Get("backup")).
func FromKernel ¶
FromKernel returns the backup Service.
func (*Service) Prune ¶
Prune keeps only the newest cfg.Keep successful archives, deleting older files.