Command as MySQL domain #495

Closed
opened 2022-02-07 23:11:43 +00:00 by Firesphere · 3 comments

What I'm trying to do and why

Steps to reproduce (if a bug)

Not a bug, feature question:

  • I'd like to be able to execute a command, as the location for my MariaDB backups (MySQL backup).
    Reasoning is, that my MariaDB is a Docker container. As such, the IP might change after a reboot.
    Thus, running the docker command to get the IP of the container, is useful for backing up the MariaDB databases.

Other notes / implementation ideas

Environment

borgmatic version: 1.5.22

borgmatic installation method: pip3

Borg version: 1.1.17

Use sudo borg --version

Python version: 3.8

Use python3 --version

Database version (if applicable): MariaDB 10.5

Use psql --version or mysql --version on client and server.

operating system and version: CentOS 7

#### What I'm trying to do and why #### Steps to reproduce (if a bug) Not a bug, feature question: - I'd like to be able to execute a command, as the location for my MariaDB backups (MySQL backup). Reasoning is, that my MariaDB is a Docker container. As such, the IP might change after a reboot. Thus, running the docker command to get the IP of the container, is useful for backing up the MariaDB databases. #### Other notes / implementation ideas #### Environment **borgmatic version:** 1.5.22 **borgmatic installation method:** pip3 **Borg version:** 1.1.17 Use `sudo borg --version` **Python version:** 3.8 Use `python3 --version` **Database version (if applicable):** MariaDB 10.5 Use `psql --version` or `mysql --version` on client and server. **operating system and version:** CentOS 7
Owner

I believe that the usual way to accomplish this would be to map a port from the container to the "outside world", thereby allowing you to connect to the database container on a stable IP address.

Alternatively, you could run borgmatic itself in a Docker container (either using a pre-built image or your own image), and then you could connect to the database container via the container name you've assigned to it within Docker's DNS.

Let me know if that helps!

I believe that the usual way to accomplish this would be to [map a port from the container to the "outside world"](https://docs.docker.com/config/containers/container-networking/), thereby allowing you to connect to the database container on a stable IP address. Alternatively, you could run borgmatic itself in a Docker container (either using a [pre-built image](https://torsion.org/borgmatic/docs/how-to/set-up-backups/#other-ways-to-install) or your own image), and then you could connect to the database container via the container name you've assigned to it within Docker's DNS. Let me know if that helps!
witten added the
question / support
label 2022-02-07 23:17:34 +00:00
Author

Hey @witten ,

for future reference, possibly. Here's the MariaDB part of my Docker compose:

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:3306:3306"

This accomplishes what I want. I tried to avoid actively exposing the port, but by exposing only to 127.0.0.1, I've got the middle ground of easy access, while not putting it out there on the public internet.

Hey @witten , for future reference, possibly. Here's the MariaDB part of my Docker compose: ``` 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:3306:3306" ``` This accomplishes what I want. I tried to avoid actively exposing the port, but by exposing only to 127.0.0.1, I've got the middle ground of easy access, while not putting it out there on the public internet.
Owner

Awesome, that makes sense! Glad to hear that's working for you.

Awesome, that makes sense! Glad to hear that's working for you.
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#495
No description provided.