1.7 - Manual Backup Support (type backup-now inside container)

This commit is contained in:
Dave Conroy
2018-06-06 07:19:28 -07:00
parent c8ce1fa3d6
commit 7df0a8200e
5 changed files with 39 additions and 17 deletions

View File

@@ -1,3 +1,7 @@
## 1.7 - 2018-06-06 - <dave at tiredofit dot ca>
* Added ability for Manual Backup (enter container and type `backup-now`)
## 1.6 - 2018-02-26 - <dave at tiredofit dot ca> ## 1.6 - 2018-02-26 - <dave at tiredofit dot ca>
* Add Parallel Compression mode (Default TRUE * Add Parallel Compression mode (Default TRUE

View File

@@ -28,6 +28,7 @@ LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
redis \ redis \
xz \ xz \
; \ ; \
\
apk add \ apk add \
influxdb@testing \ influxdb@testing \
pixz@testing \ pixz@testing \

View File

@@ -16,7 +16,7 @@ Currently backs up CouchDB, InfluxDB, MySQL, MongoDB Postgres, Redis, Rethink se
* select how often to run a dump * select how often to run a dump
* select when to start the first dump, whether time of day or relative to container start time * select when to start the first dump, whether time of day or relative to container start time
This Container uses Alpine:Edge as a base. This Container uses a [customized version of](https://hub.docker.com/r/tiredofit/alpine) alpine:edge as a base.
[Changelog](CHANGELOG.md) [Changelog](CHANGELOG.md)
@@ -69,7 +69,7 @@ The following directories are used for configuration and can be mapped for persi
| Directory | Description | | Directory | Description |
|-----------|-------------| |-----------|-------------|
| `/backups` | Backups | | `/backup` | Backups |
## Environment Variables ## Environment Variables
@@ -99,6 +99,9 @@ Along with the Environment Variables from the [Base image](https://hub.docker.co
## Maintenance ## Maintenance
Manual Backups can be perforemd by entering the container and typing `backup-now`
#### Shell Access #### Shell Access
For debugging and maintenance purposes you may want access the containers shell. For debugging and maintenance purposes you may want access the containers shell.

View File

@@ -2,8 +2,11 @@
date >/dev/null date >/dev/null
if [ $1 != "NOW" ]; then
sleep 10
fi
### Set Debug Mode ### Set Debug Mode
sleep 10
if [ "$DEBUG_MODE" = "TRUE" ] || [ "$DEBUG_MODE" = "true" ]; then if [ "$DEBUG_MODE" = "TRUE" ] || [ "$DEBUG_MODE" = "true" ]; then
set -x set -x
fi fi
@@ -34,8 +37,12 @@ MD5=${MD5:-TRUE}
SPLIT_DB=${SPLIT_DB:-FALSE} SPLIT_DB=${SPLIT_DB:-FALSE}
TMPDIR=/tmp/backups TMPDIR=/tmp/backups
### Set Compression Options if [ $1 = "NOW" ]; then
DB_DUMP_BEGIN=+0
MANUAL=TRUE
fi
### Set Compression Options
if [ "$PARALLEL_COMPRESSION" = "TRUE " ]; then if [ "$PARALLEL_COMPRESSION" = "TRUE " ]; then
BZIP="pbzip2" BZIP="pbzip2"
GZIP="pigz" GZIP="pigz"
@@ -225,7 +232,6 @@ echo '** [db-backup] Initialized at at '$(date)
current_time=$(date +"%s") current_time=$(date +"%s")
today=$(date +"%Y%m%d") today=$(date +"%Y%m%d")
if [[ $DB_DUMP_BEGIN =~ ^\+(.*)$ ]]; then if [[ $DB_DUMP_BEGIN =~ ^\+(.*)$ ]]; then
waittime=$(( ${BASH_REMATCH[1]} * 60 )) waittime=$(( ${BASH_REMATCH[1]} * 60 ))
else else
@@ -285,7 +291,11 @@ echo '** [db-backup] Initialized at at '$(date)
fi fi
### Go back to Sleep until next Backup time ### Go back to Sleep until next Backup time
if [ "$MANUAL" = "TRUE" ]; then
exit 1;
else
sleep $(($DB_DUMP_FREQ*60)) sleep $(($DB_DUMP_FREQ*60))
fi
done done
fi fi

View File

@@ -0,0 +1,4 @@
#!/usr/bin/with-contenv bash
echo '** Performing Manual Backup'
/etc/s6/services/10-db-backup/run NOW