Marketplace

backup

Other

togo backups — scheduled DB + files archives to storage, retention & restore

togo-framework
bash
togo install togo-framework/backup

Install

bash
togo install togo-framework/backup

The togo answer to Spatie Backup. Bundle a database dump + configured files into a single .tar.gz, keep the newest N, and restore on demand. Pair with scheduler to back up on a cadence.

Configuration

Env
Description
BACKUP_SOURCEScomma-separated directories/files to include
BACKUP_DB_DRIVERpostgres | mysql | sqlite (omit to skip the DB)
BACKUP_DB_DSNDB connection string, or the sqlite file path
BACKUP_DIRoutput directory for archives (default backups)
BACKUP_KEEPretention — keep the newest N archives (0 = keep all)
Rows per page
1–5 of 5
Page 1 of 1

Or configure in code:

go
b, _ := backup.FromKernel(k)
b.Configure(backup.Config{
    Sources:  []string{"storage/app", "uploads"},
    DBDriver: "postgres", DBDSN: os.Getenv("DATABASE_URL"),
    Dir:      "backups", Keep: 7,
})

Usage

go
rec, err := b.Run(ctx)        // create a backup now → *Backup{ID, Path, Size, ...}
list := b.List()              // newest first
b.Restore(rec.ID, "/restore") // extract the archive (DB restore is a manual psql/mysql step)
b.Prune()                     // enforce retention

Schedule it

go
scheduler.Register("backup", func(ctx context.Context) error {
    b, _ := backup.FromKernel(k); _, err := b.Run(ctx); return err
})
sched.Schedule("backup", scheduler.DailyAt(3, 0)) // 03:00 nightly

REST API

Method
Path
Description
POST/api/backup/runcreate a backup now
GET/api/backup/backupslist backups (newest first)
GET/api/backup/backups/{id}one backup record
Rows per page
1–3 of 3
Page 1 of 1

pg_dump/mysqldump must be on PATH for the respective drivers; sqlite is copied directly. Archives extract path-traversal-safe.


<div align="center"> <h3>Premium sponsors</h3> <p> <a href="https://id8media.com"><strong>ID8 Media</strong></a> &nbsp;·&nbsp; <a href="https://one-studio.co"><strong>One Studio</strong></a> </p> <p><sub>Support togo — <a href="https://github.com/sponsors/fadymondy">become a sponsor</a>.</sub></p> </div>