mirror of
https://github.com/ZettaIO/restic-compose-backup.git
synced 2025-09-28 06:35:24 +00:00
Separate mariadb and mysql
This commit is contained in:
@@ -39,7 +39,7 @@ services:
|
|||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:10
|
image: mariadb:10
|
||||||
labels:
|
labels:
|
||||||
restic-volume-backup.mysql: true
|
restic-volume-backup.mariadb: true
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_ROOT_PASSWORD=my-secret-pw
|
- MYSQL_ROOT_PASSWORD=my-secret-pw
|
||||||
- MYSQL_DATABASE=mydb
|
- MYSQL_DATABASE=mydb
|
||||||
|
@@ -54,6 +54,16 @@ def status(config, containers):
|
|||||||
creds['password'],
|
creds['password'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if container.mariadb_backup_enabled:
|
||||||
|
logger.info(' -> mariadb %s', container.mysql_backup_enabled)
|
||||||
|
creds = container.get_mysql_credentials()
|
||||||
|
restic.ping_mysql(
|
||||||
|
creds['host'],
|
||||||
|
creds['port'],
|
||||||
|
creds['username'],
|
||||||
|
creds['password'],
|
||||||
|
)
|
||||||
|
|
||||||
if len(backup_containers) == 0:
|
if len(backup_containers) == 0:
|
||||||
logger.info("No containers in the project has 'restic-volume-backup.enabled' label")
|
logger.info("No containers in the project has 'restic-volume-backup.enabled' label")
|
||||||
|
|
||||||
|
@@ -75,6 +75,7 @@ class Container:
|
|||||||
return any([
|
return any([
|
||||||
self.volume_backup_enabled,
|
self.volume_backup_enabled,
|
||||||
self.mysql_backup_enabled,
|
self.mysql_backup_enabled,
|
||||||
|
self.mariadb_backup_enabled,
|
||||||
self.postgresql_backup_enabled,
|
self.postgresql_backup_enabled,
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -86,6 +87,10 @@ class Container:
|
|||||||
def mysql_backup_enabled(self) -> bool:
|
def mysql_backup_enabled(self) -> bool:
|
||||||
return utils.is_true(self.get_label('restic-volume-backup.mysql'))
|
return utils.is_true(self.get_label('restic-volume-backup.mysql'))
|
||||||
|
|
||||||
|
@property
|
||||||
|
def mariadb_backup_enabled(self) -> bool:
|
||||||
|
return utils.is_true(self.get_label('restic-volume-backup.mariadb'))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def postgresql_backup_enabled(self) -> bool:
|
def postgresql_backup_enabled(self) -> bool:
|
||||||
return utils.is_true(self.get_label('restic-volume-backup.postgresql'))
|
return utils.is_true(self.get_label('restic-volume-backup.postgresql'))
|
||||||
|
Reference in New Issue
Block a user