mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 13:23:12 +01:00
1.7 - Manual Backup Support (type backup-now inside container)
This commit is contained in:
@@ -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>
|
||||
|
||||
* Add Parallel Compression mode (Default TRUE
|
||||
|
||||
23
Dockerfile
23
Dockerfile
@@ -28,22 +28,23 @@ LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
|
||||
redis \
|
||||
xz \
|
||||
; \
|
||||
\
|
||||
apk add \
|
||||
influxdb@testing \
|
||||
pixz@testing \
|
||||
; \
|
||||
\
|
||||
cd /usr/src ; \
|
||||
mkdir -p pbzip2 ; \
|
||||
curl -ssL https://launchpad.net/pbzip2/1.1/1.1.13/+download/pbzip2-1.1.13.tar.gz | tar xvfz - --strip=1 -C /usr/src/pbzip2 ; \
|
||||
cd pbzip2 ; \
|
||||
make ; \
|
||||
make install ; \
|
||||
\
|
||||
# Cleanup
|
||||
rm -rf /usr/src/* ; \
|
||||
apk del .db-backup-build-deps ; \
|
||||
rm -rf /tmp/* /var/cache/apk/*
|
||||
cd /usr/src ; \
|
||||
mkdir -p pbzip2 ; \
|
||||
curl -ssL https://launchpad.net/pbzip2/1.1/1.1.13/+download/pbzip2-1.1.13.tar.gz | tar xvfz - --strip=1 -C /usr/src/pbzip2 ; \
|
||||
cd pbzip2 ; \
|
||||
make ; \
|
||||
make install ; \
|
||||
\
|
||||
# Cleanup
|
||||
rm -rf /usr/src/* ; \
|
||||
apk del .db-backup-build-deps ; \
|
||||
rm -rf /tmp/* /var/cache/apk/*
|
||||
|
||||
### S6 Setup
|
||||
ADD install /
|
||||
|
||||
@@ -16,7 +16,7 @@ Currently backs up CouchDB, InfluxDB, MySQL, MongoDB Postgres, Redis, Rethink se
|
||||
* select how often to run a dump
|
||||
* 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)
|
||||
@@ -69,7 +69,7 @@ The following directories are used for configuration and can be mapped for persi
|
||||
|
||||
| Directory | Description |
|
||||
|-----------|-------------|
|
||||
| `/backups` | Backups |
|
||||
| `/backup` | Backups |
|
||||
|
||||
|
||||
## Environment Variables
|
||||
@@ -99,6 +99,9 @@ Along with the Environment Variables from the [Base image](https://hub.docker.co
|
||||
|
||||
|
||||
## Maintenance
|
||||
|
||||
Manual Backups can be perforemd by entering the container and typing `backup-now`
|
||||
|
||||
#### Shell Access
|
||||
|
||||
For debugging and maintenance purposes you may want access the containers shell.
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
|
||||
date >/dev/null
|
||||
|
||||
if [ $1 != "NOW" ]; then
|
||||
sleep 10
|
||||
fi
|
||||
|
||||
### Set Debug Mode
|
||||
sleep 10
|
||||
if [ "$DEBUG_MODE" = "TRUE" ] || [ "$DEBUG_MODE" = "true" ]; then
|
||||
set -x
|
||||
fi
|
||||
@@ -34,8 +37,12 @@ MD5=${MD5:-TRUE}
|
||||
SPLIT_DB=${SPLIT_DB:-FALSE}
|
||||
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
|
||||
BZIP="pbzip2"
|
||||
GZIP="pigz"
|
||||
@@ -225,7 +232,6 @@ echo '** [db-backup] Initialized at at '$(date)
|
||||
current_time=$(date +"%s")
|
||||
today=$(date +"%Y%m%d")
|
||||
|
||||
|
||||
if [[ $DB_DUMP_BEGIN =~ ^\+(.*)$ ]]; then
|
||||
waittime=$(( ${BASH_REMATCH[1]} * 60 ))
|
||||
else
|
||||
@@ -285,7 +291,11 @@ echo '** [db-backup] Initialized at at '$(date)
|
||||
fi
|
||||
|
||||
### Go back to Sleep until next Backup time
|
||||
sleep $(($DB_DUMP_FREQ*60))
|
||||
if [ "$MANUAL" = "TRUE" ]; then
|
||||
exit 1;
|
||||
else
|
||||
sleep $(($DB_DUMP_FREQ*60))
|
||||
fi
|
||||
|
||||
done
|
||||
fi
|
||||
4
install/usr/local/bin/backup-now
Executable file
4
install/usr/local/bin/backup-now
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
echo '** Performing Manual Backup'
|
||||
/etc/s6/services/10-db-backup/run NOW
|
||||
Reference in New Issue
Block a user