Browse Source

new: [mariadb] added ``backup`` relation.

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
dev1
Valentin Lab 4 years ago
parent
commit
b7c1d19f08
  1. 21
      mariadb/hooks/backup-relation-joined
  2. 16
      mariadb/metadata.yml

21
mariadb/hooks/backup-relation-joined

@ -0,0 +1,21 @@
#!/bin/bash
## When writing relation script, remember:
## - they should be idempotents
## - they can be launched while the dockers is already up
## - they are launched from the host
## - the target of the link is launched first, and get a chance to ``relation-set``
## - both side of the scripts get to use ``relation-get``.
. lib/common
set -e
## if I'm not linked to a schedule-command, then complain
if read-0 ts _ _ < <(get_service_relation "$SERVICE_NAME" "schedule-command"); then
debug "schedule-command relation fullfilled"
else
## XXXvlab: relation dependence as this one could actually be implemented in compose-core
err "backup relation requires schedule-command relation to be set"
exit 1
fi

16
mariadb/metadata.yml

@ -16,3 +16,19 @@ uses:
backup: "Automatic regular dumps for backuping purpose"
default-options:
schedule: "31 * * * *" ## schedule backup every hour
## This one is useful only if previous relation is used
backup:
constraint: optional
auto: pair
solves:
backup: "Automatic regular backups of dumps"
default-options:
## First pattern matching wins, no pattern matching includes.
## include-patterns are checked first, then exclude-patterns
## Patterns rules:
## - ending / for directory
## - '*' authorized
## - must start with a '/', will start from $SERVICE_DATASTORE
exclude-patterns:
- "/var/lib/" ## mariadb working data files
- "/var/backups/mysql/*.inprogress" ## database dump in progress
Loading…
Cancel
Save