mirror of
https://github.com/jkaninda/mysql-bkup.git
synced 2025-12-07 05:59:43 +01:00
doc: reviewed docs
This commit is contained in:
@@ -1,63 +1,96 @@
|
||||
---
|
||||
title: Run multiple backup schedules in the same container
|
||||
title: Run multiple database backup schedules in the same container
|
||||
layout: default
|
||||
parent: How Tos
|
||||
nav_order: 11
|
||||
---
|
||||
|
||||
Multiple backup schedules with different configuration can be configured by mounting a configuration file into `/config/config.yaml` `/config/config.yml` or by defining an environment variable `BACKUP_CONFIG_FILE=/backup/config.yaml`.
|
||||
|
||||
## Configuration file
|
||||
# Multiple Backup Schedules
|
||||
|
||||
You can configure multiple backup schedules with different configurations by using a configuration file.
|
||||
|
||||
This file can be mounted into the container at `/config/config.yaml`, `/config/config.yml`, or specified via the `BACKUP_CONFIG_FILE` environment variable.
|
||||
|
||||
---
|
||||
|
||||
## Configuration File
|
||||
|
||||
The configuration file allows you to define multiple databases and their respective backup settings.
|
||||
|
||||
Below is an example configuration file:
|
||||
|
||||
```yaml
|
||||
#cronExpression: "@every 20m" //Optional for scheduled backups
|
||||
cronExpression: ""
|
||||
# Optional: Define a global cron expression for scheduled backups
|
||||
# cronExpression: "@every 20m"
|
||||
cronExpression: ""
|
||||
|
||||
databases:
|
||||
- host: mysql1
|
||||
port: 3306
|
||||
name: database1
|
||||
user: database1
|
||||
password: password
|
||||
path: /s3-path/database1 #For SSH or FTP you need to define the full path (/home/toto/backup/)
|
||||
path: /s3-path/database1 # For SSH or FTP, define the full path (e.g., /home/toto/backup/)
|
||||
|
||||
- host: mysql2
|
||||
port: 3306
|
||||
name: lldap
|
||||
user: lldap
|
||||
password: password
|
||||
path: /s3-path/lldap #For SSH or FTP you need to define the full path (/home/toto/backup/)
|
||||
path: /s3-path/lldap # For SSH or FTP, define the full path (e.g., /home/toto/backup/)
|
||||
|
||||
- host: mysql3
|
||||
port: 3306
|
||||
name: keycloak
|
||||
user: keycloak
|
||||
password: password
|
||||
path: /s3-path/keycloak #For SSH or FTP you need to define the full path (/home/toto/backup/)
|
||||
path: /s3-path/keycloak # For SSH or FTP, define the full path (e.g., /home/toto/backup/)
|
||||
|
||||
- host: mysql4
|
||||
port: 3306
|
||||
name: joplin
|
||||
user: joplin
|
||||
password: password
|
||||
path: /s3-path/joplin #For SSH or FTP you need to define the full path (/home/toto/backup/)
|
||||
path: /s3-path/joplin # For SSH or FTP, define the full path (e.g., /home/toto/backup/)
|
||||
```
|
||||
## Docker compose file
|
||||
|
||||
---
|
||||
|
||||
## Docker Compose Configuration
|
||||
|
||||
To use the configuration file in a Docker Compose setup, mount the file and specify its path using the `BACKUP_CONFIG_FILE` environment variable.
|
||||
|
||||
### Example: Docker Compose File
|
||||
|
||||
```yaml
|
||||
services:
|
||||
mysql-bkup:
|
||||
# In production, it is advised to lock your image tag to a proper
|
||||
# release version instead of using `latest`.
|
||||
# Check https://github.com/jkaninda/mysql-bkup/releases
|
||||
# for a list of available releases.
|
||||
# In production, lock your image tag to a specific release version
|
||||
# instead of using `latest`. Check https://github.com/jkaninda/mysql-bkup/releases
|
||||
# for available releases.
|
||||
image: jkaninda/mysql-bkup
|
||||
container_name: mysql-bkup
|
||||
command: backup
|
||||
volumes:
|
||||
- ./backup:/backup
|
||||
- ./backup:/backup # Mount the backup directory
|
||||
- ./config.yaml:/backup/config.yaml # Mount the configuration file
|
||||
environment:
|
||||
## Multi backup config file
|
||||
## Specify the path to the configuration file
|
||||
- BACKUP_CONFIG_FILE=/backup/config.yaml
|
||||
# mysql-bkup container must be connected to the same network with your database
|
||||
# Ensure the pg-bkup container is connected to the same network as your database
|
||||
networks:
|
||||
- web
|
||||
|
||||
networks:
|
||||
web:
|
||||
```
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Key Notes
|
||||
|
||||
- **Global Cron Expression**: You can define a global `cronExpression` in the configuration file to schedule backups for all databases. If omitted, backups will run immediately.
|
||||
- **Database-Specific Paths**: For SSH or FTP storage, ensure the `path` field contains the full remote path (e.g., `/home/toto/backup/`).
|
||||
- **Environment Variables**: Use the `BACKUP_CONFIG_FILE` environment variable to specify the path to the configuration file.
|
||||
- **Security**: Avoid hardcoding sensitive information like passwords in the configuration file. Use environment variables or secrets management tools instead.
|
||||
|
||||
Reference in New Issue
Block a user