remote_path should (also) be per-repository #1185
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
borgmatic-collective/borgmatic#1185
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
What I'd like to do and why
Hi,
I have multiple repositories configured, but one of them needs a
remote_pathsetting. The other repository breaks with theremote_pathfor the first, eliminating the possibility to use the global setting.Isn't
remote_pathvery remote-specific? I really wonder why it is (only) a global option.I know about the possibility to use multiple config files, but I'd rather avoid that as it contains lots of options that are not remote-specific.
Other notes / implementation ideas
No response
The approach that borgmatic takes to repository-specific options is indeed separate configuration files. The way I'd recommend doing that to avoid duplication is via includes. So you'd put all your shared configuration options in a common configuration file. And then you can make one configuration file for each repository, performing an include to pull in the common options so they're not repeated—and then overriding any options (like
remote_path) that vary per repository.Hope that helps.
And to answer your question a little more directly: The reason that
remote_pathisn't an option directly underrepositories:is that one could argue almost any borgmatic option is (or can be) repository-specific, in which case you'd end up with pretty much the entire configuration file repeated underrepositories:. That just seems pretty unwieldy to me from a schema perspective.Well,
remote_pathis something that could be different on every remote and might not be under the control of the local admin. That can not be said about most other options, those are mostly just choices or preferences. For example, one of borg(matic)'s funders (Hetzner) requiresremote_pathif one does not want to use a very ancient borg version.About repeating the options under repositories: Most schema definition formats allow references to objects that can be included on multiple locations. The schema/configuration could be setup so that most (all?) options can be overridden under a repository. That way one does not have the hassle of having to configure multiple backups that still perform the necessary pre- and post actions only once and in the correct order and without overlapping.
While I agree that there are many options that represent client-side preferences, there are several other options that I could see being repository-specific, depending on the situation:
encryption_passphrase(e.g. if each repo has a separate passphrase for security purposes)encryption_passcommandcheckpoint_interval(e.g. if one repo is less reliable than another, depending on where it's hosted)compression(e.g. depending on differing repository server resources)upload_rate_limit(same)upload_buffer_sizeretries(for less reliable servers)retry_waitlock_waitI'm honestly not wild about this either. Let's say we can use a JSON Schema
$refto avoid schema repetition underrepositories. Not all options make sense under there (examples:verbosity,log_file,log_file_format,monitoring_verbosity, etc.). But let's say we ignore those and just support all options under each repository. Then borgmatic would have to effectively merge the "global" options into the repository-specific options, and every corner of borgmatic would have to be updated to pull values out of the repository-specific option rather than global scope. Does that support deep merging of complex values? Are there ways to omit merging of certain values? What about merging of lists?There are all features that are already implemented by the existing includes mechanism, and I don't see the value in reinventing the wheel when all of this already is available to users.
Now, having said all that—and in the interests of actually addressing the spirit of your ask if not the actual request—here are a couple of related ideas:
remote_pathis really an outlier like you're making the case for here, it should be moved outright from global scope to repository scope? That might address your issue without opening up the whole can of worms related to every configuration option. However I can see that being a slippery slope for other options listed above likeencryption_passphrase,checkpoint_interval, etc. I just don't know where we draw the line. And the current includes-based approach means we don't have to draw the line. Every option can be repository-specific if it's thrown in its own config file.I ran into the same issue when trying to set up a Hetzner StorageBox.
When using the suggested approach with includes and separate config files, that means that I can't just run "borgmatic" once for all backup targets, but need to call it multiple times (once per repo), right?
You can indeed just run
borgmaticonce for all backup targets if you put each config file in/etc/borgmatic.dor in another directory you specify. For more information, see: https://torsion.org/borgmatic/how-to/make-per-application-backups/Preferably, but not necessarily. I just want to run a single instance of borgmatic, so there's no multiple backups running at the same time. And I need the the
before_everythinghook to run exactly once per backup (once for all repositories, not once per repository).Multiple configuration files run with a single instance of borgmatic if you either put them in
/etc/borgmatic.dor pass them in with--configon the command line. And the backups for each run serially instead of at the same time. Also,before_everythinghooks collected from all borgmatic configuration files run once before all configuration files (prior to all actions), but only if there is a create action.Anyway, it sounds like the work here is to move
remote_pathbe under individual repositories.