Marketplace
<div align="center"> <h3>Premium sponsors</h3> <p> <a href="https://id8media.com"><strong>ID8 Media</strong></a> · <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>
backup
Othertogo backups — scheduled DB + files archives to storage, retention & restore
togo-framework
bash
togo install togo-framework/backupInstall
bash
togo install togo-framework/backupThe 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_SOURCES | comma-separated directories/files to include |
| BACKUP_DB_DRIVER | postgres | mysql | sqlite (omit to skip the DB) |
| BACKUP_DB_DSN | DB connection string, or the sqlite file path |
| BACKUP_DIR | output directory for archives (default backups) |
| BACKUP_KEEP | retention — keep the newest N archives (0 = keep all) |
Rows per page
1–5 of 5Page 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/run | create a backup now |
| GET | /api/backup/backups | list backups (newest first) |
| GET | /api/backup/backups/{id} | one backup record |
Rows per page
1–3 of 3Page 1 of 1
pg_dump/mysqldumpmust be onPATHfor 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> · <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>