Backup & Restore

Creating a Backup

Run the built-in backup command:

docker compose exec gitblixt bin/gitblixt eval "Gitblixt.Release.backup()"

This creates a timestamped .tar.gz in /data/backups containing:

  • A full pg_dump of the database
  • All bare git repositories (/data/repos)
  • Uploads (/data/uploads)
  • SSL certificates (/data/ssl)

Since data is stored on the host via bind mounts, backups are also available directly in your data/backups/ directory.

Automating Backups

Add a cron job on your host:

    # Backup every day at 2am, keep 30 days
0 2 * * * cd /path/to/gitblixt && docker compose exec -T gitblixt \
  bin/gitblixt eval "Gitblixt.Release.backup()" && \
  find data/backups -name "*.tar.gz" -mtime +30 -delete

Restoring from Backup

1. Stop GitBlixt:

docker compose down

2. Extract your backup archive into the data directory:

tar -xzf data/backups/gitblixt-backup-2024-01-15.tar.gz -C data/

3. Start everything:

docker compose up -d

The app will run migrations and start serving traffic.