Add a new backup script
This commit adds a backup script to backup all instances regularly. Fixes #11.
This commit is contained in:
parent
65a42f61e9
commit
21bd4f22c3
7 changed files with 115 additions and 17 deletions
|
|
@ -159,6 +159,13 @@ if ! is_valid_number "$PASSWORD_LENGTH"; then
|
|||
exit 1;
|
||||
fi
|
||||
|
||||
# The 'MAX_BACKUP_AGE' variable must be a valid number.
|
||||
if ! is_valid_number "$MAX_BACKUP_AGE"; then
|
||||
log_error "Variable 'MAX_BACKUP_AGE' is missing or not a valid number. ";
|
||||
log_info "Please verify that it is set correctly in '.env'. ";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
# The 'CERTBOT_EMAIL' variable should either be empty or a valid email
|
||||
if [ -n "$SELF_REDIRECT" ]; then
|
||||
if ! is_valid_https_url "$SELF_REDIRECT"; then
|
||||
|
|
@ -178,5 +185,9 @@ DEPLOY_TRIPLESTORE_DIR="$DEPLOY_ROOT/core/triplestore"
|
|||
DEPLOY_SQL_DIR="$DEPLOY_ROOT/core/sql"
|
||||
DEPLOY_INSTANCES_DIR="$DEPLOY_ROOT/instances"
|
||||
|
||||
DEPLOY_BACKUP_DIR="$DEPLOY_ROOT/backups"
|
||||
DEPLOY_BACKUP_INPROGRESS_DIR="$DEPLOY_BACKUP_DIR/inprogress"
|
||||
DEPLOY_BACKUP_FINAL_DIR="$DEPLOY_BACKUP_DIR/final"
|
||||
|
||||
|
||||
log_ok "Read and validated configuration file. "
|
||||
|
|
@ -41,7 +41,7 @@ function dockerized_mysql() {
|
|||
return $retval
|
||||
}
|
||||
|
||||
# 'dockerized_mysql' runs an sql command in the sql docker container interactively
|
||||
# 'dockerized_mysql_interactive' runs an sql command in the sql docker container interactively
|
||||
function dockerized_mysql_interactive() {
|
||||
pushd "$DEPLOY_SQL_DIR" > /dev/null
|
||||
docker exec -ti `docker-compose ps -q sql` mysql "$@"
|
||||
|
|
@ -50,6 +50,15 @@ function dockerized_mysql_interactive() {
|
|||
return $retval
|
||||
}
|
||||
|
||||
# 'dockerized_mysqldump' runs a mysqldump command
|
||||
function dockerized_mysqldump() {
|
||||
pushd "$DEPLOY_SQL_DIR" > /dev/null
|
||||
docker exec -i `docker-compose ps -q sql` mysqldump "$@"
|
||||
retval=$?
|
||||
popd > /dev/null
|
||||
return $retval
|
||||
}
|
||||
|
||||
###
|
||||
### Bookkeeping sql
|
||||
###
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue