[Idea] Separate configs in one file #504

Closed
opened 2022-03-01 05:32:04 +00:00 by Firesphere · 4 comments

What I'm trying to do and why

Split backups, some repositories get everything, some only configs, etc.

Current behaviour

Borgmatic requires a configfile passed in, to run a separate or specific backup.

Other notes / implementation ideas

Currently, the YAML for configuration is flat, all repositories are in a single configuration.

My suggestion/idea, is to allow the following:

mount:
    location:
        # List of source directories to backup (required). Globs and
        # tildes are expanded. Do not backslash spaces in path names.
        source_directories:
            - /home
            - /root
        repositories:
            - /media/storage/{fqdn}
    hooks:
        et-cetera
remote:
    location:
        # List of source directories to backup (required). Globs and
        # tildes are expanded. Do not backslash spaces in path names.
        source_directories:
            - /home
            - /var/log
        repositories:
            - user@remote:{fqdn}
    hooks:
        et-cetera

With this configuration, borgmatic, without any specifications, should run all the backups (kinda like it does now)

However, if I run borgmatic -t mount, (-t is fictional, in my head it stands for "target"), it only runs the first configuration, and with -t remote, it (obviously) then only runs the second configuration.

This would give more flexibility with having multiple configurations in one place.
An shared configs would be imported just like any other yaml.

#### What I'm trying to do and why Split backups, some repositories get everything, some only configs, etc. #### Current behaviour Borgmatic requires a configfile passed in, to run a separate or specific backup. #### Other notes / implementation ideas Currently, the YAML for configuration is flat, all repositories are in a single configuration. My suggestion/idea, is to allow the following: ``` mount: location: # List of source directories to backup (required). Globs and # tildes are expanded. Do not backslash spaces in path names. source_directories: - /home - /root repositories: - /media/storage/{fqdn} hooks: et-cetera remote: location: # List of source directories to backup (required). Globs and # tildes are expanded. Do not backslash spaces in path names. source_directories: - /home - /var/log repositories: - user@remote:{fqdn} hooks: et-cetera ``` With this configuration, borgmatic, without any specifications, should run all the backups (kinda like it does now) However, if I run `borgmatic -t mount`, (-t is fictional, in my head it stands for "target"), it only runs the first configuration, and with `-t remote`, it (obviously) then only runs the second configuration. This would give more flexibility with having multiple configurations in one place. An shared configs would be imported just like any other yaml.
Owner

Interesting! What's the benefit of this approach over the existing support for separate configuration files? For instance, if you put a mount.yaml and a separate remote.yaml in /etc/borgmatic.d, you can run them both by invoking borgmatic.. or target one of them individually with, e.g. borgmatic --config /etc/borgmatic.d/mount.yaml.

Is it just that the -t approach is easier to type at the command-line?

Interesting! What's the benefit of this approach over the existing support for separate configuration files? For instance, if you put a `mount.yaml` and a separate `remote.yaml` in `/etc/borgmatic.d`, you can run them both by invoking `borgmatic`.. or target one of them individually with, e.g. `borgmatic --config /etc/borgmatic.d/mount.yaml`. Is it just that the `-t` approach is easier to type at the command-line?
Author

Besides the import, which would make life easier...

I hadn't seen documentation where it said that /etc/borgmatic.d/name.yaml would work, from the docs I understood it had to be /etc/borgmatic/config.yaml. Did I overlook something?

Because then, my only reason would be that it's nice inside a single file, to more easily edit.

Besides the import, which would make life easier... I hadn't seen documentation where it said that `/etc/borgmatic.d/name.yaml` would work, from the docs I understood it had to be `/etc/borgmatic/config.yaml`. Did I overlook something? Because then, my only reason would be that it's nice inside a single file, to more easily edit.
Owner

The documentation covering that is in this how-to guide. Based on that, let me know if you think that'd work for your use case. I hear you about editing in a single file being more convenient though.

The documentation covering that is in [this how-to guide](https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/). Based on that, let me know if you think that'd work for your use case. I hear you about editing in a single file being more convenient though.
witten added the
waiting for response
label 2022-03-08 07:20:42 +00:00
Owner

I'm closing this ticket due to inactivity, but if you have any follow-ups, please feel free to post them here! I'm happy to reopen if needed.

I'm closing this ticket due to inactivity, but if you have any follow-ups, please feel free to post them here! I'm happy to reopen if needed.
witten removed the
waiting for response
label 2022-05-20 21:46:18 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#504
No description provided.