Allow multiple db backups #395

Closed
opened 2021-03-10 20:02:47 +00:00 by TCr · 4 comments

It would be nice to allow to backup multiple databases, like this:

hooks:
    mysql_databases:
        - name: db1 db2 db3
          username: backup
          password: 1234567
It would be nice to allow to backup multiple databases, like this: ``` hooks: mysql_databases: - name: db1 db2 db3 username: backup password: 1234567 ```

+1 for this. Currently I do something like this:

hooks:
    mysql_databases:
        - name: db1
          username: borgmatic
          password: "placeholder"
          options: "--order-by-primary --single-transaction --quick"
        - name: db2
          username: borgmatic
          password: "JustAnExamplePassword"
          options: "--order-by-primary --single-transaction --quick"
        - name: db3
          username: borgmatic
          password: "TheSameOne"
          options: "--order-by-primary --single-transaction --quick"

But I am interested if it is possible to somehow prettify this config

+1 for this. Currently I do something like this: ```yaml hooks: mysql_databases: - name: db1 username: borgmatic password: "placeholder" options: "--order-by-primary --single-transaction --quick" - name: db2 username: borgmatic password: "JustAnExamplePassword" options: "--order-by-primary --single-transaction --quick" - name: db3 username: borgmatic password: "TheSameOne" options: "--order-by-primary --single-transaction --quick" ``` But I am interested if it is possible to somehow prettify this config
Owner

Have you tried configuration include merging? Something like:

common.yaml:

username: borgmatic
password: "placeholder"
options: "--order-by-primary --single-transaction --quick"

config.yaml:

...

hooks:
    mysql_databases:
        - name: db1
          <<: !include common.yaml
        - name: db2
          <<: !include common.yaml
        - name: db3
          <<: !include common.yaml
Have you tried [configuration include merging](https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#include-merging)? Something like: common.yaml: ```yaml username: borgmatic password: "placeholder" options: "--order-by-primary --single-transaction --quick" ``` config.yaml: ```yaml ... hooks: mysql_databases: - name: db1 <<: !include common.yaml - name: db2 <<: !include common.yaml - name: db3 <<: !include common.yaml ```

@witten, thanks for your reply! I have seen example of configuration merging, but for some reason I have only tried !include /etc/borgmatic/include.yaml.

@witten, thanks for your reply! I have seen example of configuration merging, but for some reason I have only tried `!include /etc/borgmatic/include.yaml`.
Owner

I'll close this for now given the include work-around. But if this turns out to be a pain and/or not work for your use cases, we can always reopen and discuss. Thank you!

I'll close this for now given the include work-around. But if this turns out to be a pain and/or not work for your use cases, we can always reopen and discuss. Thank you!
Sign in to join this conversation.
No Milestone
No Assignees
3 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#395
No description provided.