Multiple borg repos on the same server
Opened this issue · 4 comments
As it is now, I don't think it's possible to have multiple backup repositories for the same client.
My use case is the following:
I use borg to back up files and database exports. Since the DB dumps are really big, I do those backups via stdin directly into a borg repo, as opposed to writing to a file and then backing up the file.
I've added those export commands as borgbackup_post_commands
, changing the name of the backup for each one (i.e. $REPOSITORY::${date}-mariadb
and $REPOSITORY::${date}-postgres
).
This works well, but the problem is the pruning, as it only keeps the last one executed, not all of the individual ones. Which makes sense, as they all belong to the same repo, so to speak.
What I'd need though, is to have multiple repos on the backup server for each backup.
Any ideas on how to get this done?
The only thing I could think of so far, is to modify the role to set backups in an array, instead of top-level variables, but that would need quite a bit of rewriting...
Well... when we started to use Borg and wrote this role Borgmatic had some limitations why we decided not to use it (mainly, you could only install it with pip and it pulled borg with it, which was rather painful to get stable results on older systems). We should probably investigate if we can't use Borgmatic before we start to implement all similar features in the not so beautiful bash script we use now. @dverhelst was already looking into that recently.
I'm not familiar with borgmatic, but looking at the screenshots and how it is configured, it looks very similar to what you've done in this role.
So I'm not sure how that would help with this. Mind explaining what you mean?
I believe Borgmatic supports what you're asking for:
https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/
It will probably require quite a bit of refactoring of the role before we can use it, but I just wanted to give you a heads up that we're considering this instead of further expanding the Bash script.
Thanks for the link!
I agree it would need some refactoring, which might be a bit tricky to keep backwards compatibility.
So you're considering adding borgmatic to this role and creating configs files for it then?