Skip to content

Backup and restore

What should be backed up

Application data

Repomanager application data is stored in a dedicated Docker volume named repomanager-data which is located in /var/lib/docker/volumes/repomanager-data on the host (unless you have changed the default location).

This volume contains databases, logs and configuration files of the application.

You should back up this volume to ensure you can restore your data in case of a failure. This can be done by copying the content of the volume to another location with rsync or cp. As the database is SQLite, no dump is needed.

The repomanager-data volume also contains the version file which contains the version of the application. This can be useful to know which version of the application was running when the backup was made and to restore the same version when restoring the backup.

Warning

Make sure the container is stopped before backing up repomanager-data volume to avoid database write while the backup is being made. Otherwise you could end up with a corrupted backup and will not be able to restore your data correctly.

docker stop repomanager

Curated and local repositories

Curated and local repositories are stored in a dedicated Docker volume named repomanager-repo which is located in /var/lib/docker/volumes/repomanager-repo on the host (unless you have changed the default location).

This volume contains the snapshots (packages and metadata) of the curated and local repositories.

You should back up this volume to ensure you can restore your data in case of a failure. This can be done by copying the content of the volume to another location with rsync or cp.

Info

When the DEDUPLICATION setting is enabled (default, see Global settings), snapshots of a repository share their unchanged packages through hard links. Use rsync -H (or cp -a) to preserve hard links, otherwise each snapshot is copied in full in the backup.

Mirrors

Mirrors are stored in a dedicated Docker volume named repomanager-mirror which is located in /var/lib/docker/volumes/repomanager-mirror on the host (unless you have changed the default location).

This volume contains the snapshots of the mirrors. As mirrors are copies of upstream repositories, they can also be synced again from scratch instead of being backed up.

Info

Snapshots of a mirror share their unchanged files through hard links. Use rsync -H (or cp -a) to preserve hard links, otherwise each snapshot is copied in full in the backup.

Summary

In summary, you should back up the repomanager-data, repomanager-repo and repomanager-mirror volume directories which are located:

Volume name Content Default location on host
repomanager-data Databases, logs and configuration /var/lib/docker/volumes/repomanager-data
repomanager-repo Curated and local repositories /var/lib/docker/volumes/repomanager-repo
repomanager-mirror Mirrors /var/lib/docker/volumes/repomanager-mirror

Restoring from backup

First stop the container:

docker stop repomanager

Restore the backup by copying the content of your backup to the volumes:

rsync -aP --delete my_backup/repomanager-data/ /var/lib/docker/volumes/repomanager-data/
rsync -aHP --delete my_backup/repomanager-repo/ /var/lib/docker/volumes/repomanager-repo/
rsync -aHP --delete my_backup/repomanager-mirror/ /var/lib/docker/volumes/repomanager-mirror/

Make sure the permissions are correct:

chown -R 33 /var/lib/docker/volumes/repomanager-data
chown -R 33 /var/lib/docker/volumes/repomanager-repo
chown -R 33 /var/lib/docker/volumes/repomanager-mirror

If you are restoring a previous version of the application, retrieve the version from the version file in the backup:

cat /var/lib/docker/volumes/repomanager-data/version

If you are restoring a previous version of the application, delete the current image and pull the image of the version you are restoring:

docker rm -f repomanager
docker system prune -a -f
docker pull lbr38/repomanager:<version>

Start the container:

docker start repomanager