Backup and restore
All of Fret’s state lives in the data folder (/data in Docker, FRET_DATA_DIR otherwise). Your
downloads live in the warehouse and are backed up like any other files.
What to back up
Section titled “What to back up”| File | Content |
|---|---|
fret.db |
Shipments, parcels, tracking history, register, accounts, settings, password, sessions and API tokens |
fret.db-wal, fret.db-shm |
Recent changes not yet merged into fret.db (present while Fret runs) |
secret.key |
The key that encrypts the credentials of your accounts |
Back up secret.key together with the database: without it, the saved credentials of your
carriers and forwarders cannot be read (everything else still works, and you only have to enter them
again). Keep both as carefully as a password.
Backing up
Section titled “Backing up”By stopping Fret
Section titled “By stopping Fret”The simplest consistent backup: stop Fret, copy the folder, start Fret again. Transfers resume where they were.
docker compose stop fretdocker run --rm -v fret-data:/data -v "$PWD":/backup alpine \ tar -czf /backup/fret-data.tar.gz -C /data .docker compose start fretWith a host folder mounted on /data, or with the binary, copy the folder itself.
While Fret runs
Section titled “While Fret runs”The database runs in WAL mode: copying fret.db alone while Fret writes may give an incomplete copy.
For a hot backup, use SQLite’s own backup command from the host (the image has no sqlite3), on the
data folder:
sqlite3 /path/to/data/fret.db ".backup '/path/to/backup/fret.db'"cp /path/to/data/secret.key /path/to/backup/Restoring
Section titled “Restoring”- Stop Fret.
- Put
fret.dbandsecret.keyback into the data folder, and delete anyfret.db-walandfret.db-shmleft there. - Start Fret.
A database from an older version is migrated automatically at startup. A database from a newer version than the program is not supported: restore it with the version that made it, or a newer one.
Moving Fret to another machine
Section titled “Moving Fret to another machine”Install Fret on the new machine, stop it, restore the data folder as above, and copy the warehouse to the same relative layout. The register points at folders relative to the warehouse root, so the root itself may change.