Auto-init repo in case it's not existing #117
Labels
No Label
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: borgmatic-collective/borgmatic#117
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
#110 (Support for initializing repositories) adds the feature to manually initialize the repo. In automated setups it would be great if borgmatic automatically checks before a backup if the repo exists, and if not, initilizes it with the parameters from the given config.
Sorry for some reason I can't edit the above issue description anymore (it's too bold!).
To properly link to the above mentioned issue: #110
What were you thoughts on this comment?
Also, could you talk a little about the use case where auto-initialization would be useful for you? Thanks.
For my part, I've built a docker image with borg+bormatic and some shell script to do auto-initialization. I put that docker image in all our team docker-compose projects to backup docker volumes data.
Auto-initialization is very good for the ease of setting up backup on our projects. The documentation for my team members is very light: just append the backup container to the docker project with a few environment variables and it's done.
Having Bormatic taking care of initialization would ease the maintenance of this backup docker image: fewer shell scripts
@witten: Before using borgmatic we hat a backup script that would check if the repo existed and if not, it would get initialised:
I'd like to offload this task to borgmatic, with a similar reason as @thomasleveil: The less logic you need to bake in your custom scripts, the better. This should be a job of borgmatic.
What do you all think about the edge case with auto-initialization where the repository originally exists, and then somehow accidentally gets deleted? At that point, the repository will get automatically recreated completely silently, and the user will not realize that they've actually had a major loss of archives.
Any ideas on ways to mitigate that?
Other questions:
borgmatic --init
does accept a few optional parameters and one required parameter (--encryption
). How will the values of those get determined automatically?Well, if the repository data is lost, it does not harm to recreate it and push new backups to it. At least it ensures our data is not only existing in our app for too long.
To me, the responsibility of borgmatic is to make backups and upload them. If the repository does not exists, I have other monitoring tools which have for responsibility to check my borg repositories (last update time, size, etc). So I don't care if borgmatic is not alerting me if it had to recreate the repository.
However, borgmatic should log that it did create the repository.
In my current setup, this is done with environment variables, but I guess borgmatic could make use of its yaml config file for reading those values
Okay. Here's another idea for the user interface for this feature: Make use of the existing borgmatic command-line flags for repository initialization to make this feature opt-in. For instance, instead of just:
You would be able to do:
The idea being that if the repository doesn't exist, it'll create it with the requested encryption mode and any other initialization flags. But if it already exists, it'll log that fact and continue on with the backup as per usual.
Thoughts?
That sounds reasonable
Thanks!
Implemented and released in borgmatic 1.2.13. The usage is as described above: Just mix and match
--init
and--create
or other command-line flags to get the behavior you're looking for. Enjoy!Awesome, thx !