Improve this documentation: How to backup your databases: new section for backing up a database that is inside a docker container #649

Closed
opened 2023-03-15 11:09:05 +00:00 by martylake · 1 comment

What I'm trying to do and why

Save a database that is inside a docker container, while borgmatic runs outside of the container.

Proposed change

Add a new section in https://torsion.org/borgmatic/docs/how-to/backup-your-databases/ that includes the fix of @Firesphere in #495 where a user can expose to a port on the same machine at ip localhost to avoid exposing it to a wider audience, with this snippet as a concrete example of docker-compose section:

version: '3'
services:
  db:
    image: mariadb:latest
    volumes:
      - mariadb-data:/var/lib/mysql
    environment:
      - MYSQL_RANDOM_ROOT_PASSWORD=1
    env_file:
      - .env
    ports:
      - "127.0.0.1:3307:3306"

and the corresponding borgmatic configuration snippet:

hooks:
    mysql_databases:
        - name: posts
          hostname: 127.0.0.1
          port: 3307
          username: root
          password: trustsome1
          options: "--skip-comments"

Then hostname is just set to 127.0.0.1, and port to 3307.

#### What I'm trying to do and why Save a database that is inside a docker container, while borgmatic runs outside of the container. #### Proposed change Add a new section in https://torsion.org/borgmatic/docs/how-to/backup-your-databases/ that includes the fix of @Firesphere in https://projects.torsion.org/borgmatic-collective/borgmatic/issues/495 where a user can expose to a port on the same machine at ip localhost to avoid exposing it to a wider audience, with this snippet as a concrete example of docker-compose section: ``` version: '3' services: db: image: mariadb:latest volumes: - mariadb-data:/var/lib/mysql environment: - MYSQL_RANDOM_ROOT_PASSWORD=1 env_file: - .env ports: - "127.0.0.1:3307:3306" ``` and the corresponding borgmatic configuration snippet: ``` hooks: mysql_databases: - name: posts hostname: 127.0.0.1 port: 3307 username: root password: trustsome1 options: "--skip-comments" ``` Then `hostname` is just set to `127.0.0.1`, and `port` to `3307`.
Owner
Done! https://torsion.org/borgmatic/docs/how-to/backup-your-databases/#containers Thanks for the suggestion!
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#649
No description provided.