Restic-replica: a "restic copy" wrapper, with snapshot filtering

Hi All,

As an excuse to sharpen my programming skills, I took my personal “restic copy” wrapper script and fleshed it out into something more general purpose.
restic-replica is essentially “yet another restic wrapper”, written in python, although one focused specifically on a single operation; restic copy.
There is no functionality to perform other restic operations like backup, forget, etc.

The main feature on offer (and the reason I wrote it) is that it can optionally filter the list of snapshots to be copied, using the same paradigm of “keep-daily, keep-weekly, etc.” as restic forget.
If you have a high change rate dataset, this could cut down on the amount of storage needed for the repository the snapshots are being copied to.
An example of a use case this solves is: “I take snapshots daily, and I want to copy the monthly snapshots to a second repository for longer term storage”.

Configuration is performed via a TOML file, which defines the repositories, the policy (snapshot filtering), etc.

Download/Install

The easiest way is via pip:
pip install restic-replica

There is a readme with more details about usage on my github, and the project can also be found on pypi.

I hope you find it useful :slight_smile:
Cheers!

2 Likes

I’ve released an update (v0.2.0) that adds support for snapshot grouping and filtering by host/path/tag.

This grouping/filtering is done natively by restic, and then the defined policy (keep-daily etc.) is applied by restic-replica on a per-group basis.

This adds more flexibility when working with repositories that contain snapshots with multiple paths, or from multiple clients. Both the new grouping and filtering options are fully configurable.

Note: Grouping snapshots by host and path is now the default behaviour (the behaviour in previous releases was no snapshot grouping). This change was made because grouping by host and path is less likely to cause unexpected surprises with snapshot selection. Setting all the grouping options in the config file to false will disable grouping (i.e. revert to the pre 0.2.0 behaviour).

Cheers!