Backup & Restore

Creating a Backup

Run the built-in backup command:

docker exec gitblixt 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)

To copy the backup to your host machine:

docker cp gitblixt:/data/backups ./backups

Automating Backups

Add a cron job on your host:

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

Restoring from Backup

1. Stop the running container:

docker stop gitblixt

2. Copy your backup archive into the container's data volume, then extract:

docker run --rm -v gitblixt_data:/data -v $(pwd):/backup \
  debian:bookworm-slim \
  tar -xzf /backup/gitblixt-backup-2024-01-15.tar.gz -C /data

3. Start the container:

docker start gitblixt

The container will detect the restored data and skip first-boot initialization.