docker-volume-backup icon indicating copy to clipboard operation
docker-volume-backup copied to clipboard

Consider restic as a backend?

Open prologic opened this issue 2 years ago • 8 comments

Have you considered using restic as a backend directly for storage/backup so this tool can focus on the parts that matter (docker volumes, stopping/restarting containers, etc)? 🤔

prologic avatar Dec 28 '22 01:12 prologic

This is kind of similar to #109 - is it possible to use restic as a Go library instead of using the provided binaries?

m90 avatar Dec 28 '22 07:12 m90

Good question! If it isn't eight now, we could probably adopt it so that it can be?

prologic avatar Dec 28 '22 08:12 prologic

The trouble is, if this tool would consume a blob of Go code that is not meant to be used as a library, we don't get any stability guarantees for the API interface, which I'd consider a deal breaker.

If restic is meant to be used as a library as well, I would be open to thinking about this for whenever V3 is happening (which is not going to be very soon).

m90 avatar Dec 28 '22 08:12 m90

Judging by the open issues and codebase of restic, I don't see an easy way to use it as a library and it looks like it might not happen. Hmmm 🤔 -- What about abstracting the code here in this project such that one could easily (if they wanted to) integrate the use of restic via fork/exec'ing out to a tool to satisfy the interface (TBD)?

prologic avatar Dec 28 '22 09:12 prologic

Theoretically, you could already "bring your own backend" by doing the following:

  • create a Docker image off this one, copying in the restic binary
  • configure the backup schedule without defining any values for a storage
  • define your restic command in the docker-volume-backup.process-post label for the backup container itself

This should basically give you what you want. The only ugly part here would probably be that you have to figure out the filename of the archive yourself somehow.

Maybe it would be nice to make such values (file locations and such) available in the environment so scripts like this could consume them.

m90 avatar Dec 28 '22 09:12 m90

Maybe it would be nice to make such values (file locations and such) available in the environment so scripts like this could consume them.

I added this in v2.24.0. You can check the docs here: https://github.com/offen/docker-volume-backup#handle-file-uploads-using-third-party-tools and the respective test case: https://github.com/offen/docker-volume-backup/tree/main/test/extend for an idea of how this works.

m90 avatar Dec 30 '22 15:12 m90

Nice one! I'm going to give this a try! Thank you 🙏

prologic avatar Dec 30 '22 21:12 prologic