Skip to main content

Backup & Restore

ftctl backup dumps and restores the PostgreSQL database from the running factorythread-postgres container. Output goes to /opt/factorythread/backups/ by default.

The database is only half of a recoverable backup

A dump restores cleanly only if you also have the ENCRYPTION_KEY that encrypted the connection credentials inside it. Keep a secrets export next to every DB backup — see Disaster Recovery.

Back up

sudo ./ftctl backup now

On a terminal it prompts for the format and whether to include insights; otherwise it defaults to a compressed custom dump with insights included.

Formats

FormatFileNotes
custom.dumpcompressed, supports parallel restore — recommended
plain.sqlhuman-readable SQL
tar.tararchive, supports parallel restore
sudo ./ftctl backup now --format custom
sudo ./ftctl backup now --format plain --out /mnt/backups

Insights (execution telemetry)

Execution telemetry (flow_execution_insights) is usually the largest part of a dump. It's included by default; exclude the row data (keeping the table structure) to get a much smaller dump:

sudo ./ftctl backup now --format custom --exclude-insights

Flags: --exclude-insights (or answer No at the prompt) drops the rows; --include-insights forces them in.

Restore

sudo ./ftctl backup restore /opt/factorythread/backups/<file>
  • On a terminal with no file argument, it lists the dumps in the backup dir and lets you pick one.
  • It auto-detects the format (by inspecting the file, not the extension) and restores with the right tool.
  • Restoring DROPs and recreates the objects in the dump, so it asks for confirmation first (skip with --yes in scripts).
  • pg_restore warnings (exit code 1) are treated as non-fatal and reported; anything worse fails the restore.

Scheduled backups

The stack includes a backup scheduler container (factorythread-backup) that takes periodic dumps automatically. Manual ftctl backup now runs are independent of it and useful before an upgrade or migration.

Restoring onto a rebuilt or different server

A raw dump carries data, not the encryption key. To make a restore actually usable on a new box, install with the same secrets first (so ENCRYPTION_KEY matches), then restore:

sudo ./ftctl install --secrets factorythread-secrets.enc --password '<pw>' --version <ver>
sudo ./ftctl backup restore /path/to/dump

See Disaster Recovery for the full rebuild flow, and Migrating from a Legacy Deployment when the source is an older setup.sh stack.