mirror of
https://github.com/tiredofit/docker-db-backup.git
synced 2025-12-21 13:23:12 +01:00
Sync with Private Repo
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
## 1.5 - 2017-01-28 - <dave at tiredofit dot ca>
|
||||
## 1.6 - 2018-02-26 - <dave at tiredofit dot ca>
|
||||
|
||||
* Add Parallel Compression mode (Default TRUE
|
||||
|
||||
## 1.5 - 2018-01-28 - <dave at tiredofit dot ca>
|
||||
|
||||
* Add Zabbix Checks
|
||||
|
||||
|
||||
48
Dockerfile
48
Dockerfile
@@ -1,4 +1,4 @@
|
||||
FROM tiredofit/alpine:edge
|
||||
FROM registry.selfdesign.org/docker/alpine:edge
|
||||
LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
|
||||
|
||||
### Set Environment Variables
|
||||
@@ -6,26 +6,44 @@ LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
|
||||
ENABLE_SMTP=FALSE
|
||||
|
||||
### Dependencies
|
||||
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
|
||||
apk update && \
|
||||
apk add \
|
||||
RUN set -ex ; \
|
||||
echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories ; \
|
||||
apk update ; \
|
||||
apk upgrade ; \
|
||||
apk add --virtual .db-backup-build-deps \
|
||||
build-base \
|
||||
bzip2-dev \
|
||||
git \
|
||||
xz-dev \
|
||||
; \
|
||||
\
|
||||
apk add --virtual .db-backup-run-deps \
|
||||
bzip2 \
|
||||
influxdb@testing \
|
||||
mongodb-tools \
|
||||
mysql-client \
|
||||
mariadb-client \
|
||||
openssl \
|
||||
pigz \
|
||||
postgresql \
|
||||
postgresql-client \
|
||||
openssl \
|
||||
redis \
|
||||
xz \
|
||||
&& \
|
||||
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
; \
|
||||
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/*
|
||||
|
||||
### S6 Setup
|
||||
ADD install /
|
||||
|
||||
### Entrypoint Configuration
|
||||
ENTRYPOINT ["/init"]
|
||||
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
# tiredofit/db-backup
|
||||
|
||||
[](https://hub.docker.com/r/tiredofit/db-backup)
|
||||
[](https://hub.docker.com/r/tiredofit/db-backup)
|
||||
[](https://hub.docker.com/r/tiredofit/db-backup)
|
||||
[](https://microbadger.com/images/tiredofit/db-backup)
|
||||
[](https://microbadger.com/images/tiredofit/db-backup)
|
||||
# Introduction
|
||||
|
||||
This will build a container for backing up multiple type of DB Servers
|
||||
@@ -99,7 +94,8 @@ Along with the Environment Variables from the [Base image](https://hub.docker.co
|
||||
| `DB_CLEANUP_TIME` | Value in minutes to delete old backups (only fired when dump freqency fires). 1440 would delete anything above 1 day old. You don't need to set this variable if you want to hold onto everything.
|
||||
| `COMPRESSION` | Use either Gzip `GZ`, Bzip2 `BZ`, XZip `XZ`, or none `NONE` - Default `GZ`
|
||||
| `MD5` | Generate MD5 Sum in Directory, `TRUE` or `FALSE` - Default `TRUE`
|
||||
| `SPLIT_DB` | If using root as username and multiple DBs on system, set to TRUE to create Seperate DB Backups instead of all in one. - Default `FALSE`
|
||||
| `SPLIT_DB` | If using root as username and multiple DBs on system, set to TRUE to create Seperate DB Backups instead of all in one. - Default `FALSE` |
|
||||
| `PARALLEL_COMPRESSION` | Use multiple cores when compressing backups `TRUE` or `FALSE` - Default `TRUE` |
|
||||
|
||||
|
||||
## Maintenance
|
||||
|
||||
@@ -21,6 +21,7 @@ fi
|
||||
|
||||
### Set Defaults
|
||||
COMPRESSION=${COMPRESSION:-GZ}
|
||||
PARALLEL_COMPRESSION=${PARALLEL_COMPRESSION:-TRUE}
|
||||
DB_DUMP_FREQ=${DB_DUMP_FREQ:-1440}
|
||||
DB_DUMP_BEGIN=${DB_DUMP_BEGIN:-+0}
|
||||
DB_DUMP_TARGET=${DB_DUMP_TARGET:-/backup}
|
||||
@@ -33,6 +34,19 @@ MD5=${MD5:-TRUE}
|
||||
SPLIT_DB=${SPLIT_DB:-FALSE}
|
||||
TMPDIR=/tmp/backups
|
||||
|
||||
### Set Compression Options
|
||||
|
||||
if [ "$PARALLEL_COMPRESSION" = "TRUE " ]; then
|
||||
BZIP="pbzip2"
|
||||
GZIP="pigz"
|
||||
XZIP="pixz"
|
||||
else
|
||||
BZIP="bzip2"
|
||||
GZIP="gzip"
|
||||
XZIP=="xz"
|
||||
fi
|
||||
|
||||
|
||||
### Set the Database Type
|
||||
case "$DBTYPE" in
|
||||
"couch" | "couchdb" | "COUCH" | "COUCHDB" )
|
||||
@@ -174,15 +188,15 @@ function backup_rethink() {
|
||||
function compression() {
|
||||
case "$COMPRESSION" in
|
||||
"GZ" | "gz" | "gzip" | "GZIP")
|
||||
gzip ${TMPDIR}/${TARGET}
|
||||
$GZIP ${TMPDIR}/${TARGET}
|
||||
TARGET=${TARGET}.gz
|
||||
;;
|
||||
"BZ" | "bz" | "bzip2" | "BZIP2" | "bzip" | "BZIP" | "bz2" | "BZ2")
|
||||
bzip2 ${TMPDIR}/${TARGET}
|
||||
$BZIP ${TMPDIR}/${TARGET}
|
||||
TARGET=${TARGET}.bz2
|
||||
;;
|
||||
"XZ" | "xz" | "XZIP" | "xzip" )
|
||||
xz ${TMPDIR}/${TARGET}
|
||||
$XZIP ${TMPDIR}/${TARGET}
|
||||
TARGET=${TARGET}.xz
|
||||
;;
|
||||
"NONE" | "none" | "FALSE" | "false")
|
||||
|
||||
Reference in New Issue
Block a user