diff --git a/docker-compose.yaml b/docker-compose.yaml index 3e8cc60..15b8040 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -39,7 +39,7 @@ services: mariadb: image: mariadb:10 labels: - restic-volume-backup.mysql: true + restic-volume-backup.mariadb: true environment: - MYSQL_ROOT_PASSWORD=my-secret-pw - MYSQL_DATABASE=mydb diff --git a/restic_volume_backup/cli.py b/restic_volume_backup/cli.py index 218ef5b..3756cc4 100644 --- a/restic_volume_backup/cli.py +++ b/restic_volume_backup/cli.py @@ -54,6 +54,16 @@ def status(config, containers): 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: logger.info("No containers in the project has 'restic-volume-backup.enabled' label") diff --git a/restic_volume_backup/containers.py b/restic_volume_backup/containers.py index 658651f..3e04215 100644 --- a/restic_volume_backup/containers.py +++ b/restic_volume_backup/containers.py @@ -75,6 +75,7 @@ class Container: return any([ self.volume_backup_enabled, self.mysql_backup_enabled, + self.mariadb_backup_enabled, self.postgresql_backup_enabled, ]) @@ -86,6 +87,10 @@ class Container: def mysql_backup_enabled(self) -> bool: 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 def postgresql_backup_enabled(self) -> bool: return utils.is_true(self.get_label('restic-volume-backup.postgresql'))