Sync with Private Repo

This commit is contained in:
Dave Conroy
2018-04-22 13:21:08 -07:00
parent 9792cdc8f3
commit b36151a1d3
4 changed files with 60 additions and 28 deletions

View File

@@ -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 * Add Zabbix Checks

View File

@@ -1,4 +1,4 @@
FROM tiredofit/alpine:edge FROM registry.selfdesign.org/docker/alpine:edge
LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)" LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
### Set Environment Variables ### Set Environment Variables
@@ -6,26 +6,44 @@ LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
ENABLE_SMTP=FALSE ENABLE_SMTP=FALSE
### Dependencies ### Dependencies
RUN echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \ RUN set -ex ; \
apk update && \ echo "@testing http://nl.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories ; \
apk add \ 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 \ bzip2 \
influxdb@testing \
mongodb-tools \ mongodb-tools \
mysql-client \ mariadb-client \
postgresql \
postgresql-client \
openssl \ openssl \
pigz \
postgresql \
postgresql-client \
redis \ redis \
xz \ xz \
&& \ ; \
apk add \
rm -rf /var/cache/apk/* 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 ### S6 Setup
ADD install / ADD install /
### Entrypoint Configuration
ENTRYPOINT ["/init"]

View File

@@ -1,10 +1,5 @@
# tiredofit/db-backup # tiredofit/db-backup
[![Build Status](https://img.shields.io/docker/build/tiredofit/db-backup.svg)](https://hub.docker.com/r/tiredofit/db-backup)
[![Docker Pulls](https://img.shields.io/docker/pulls/tiredofit/db-backup.svg)](https://hub.docker.com/r/tiredofit/db-backup)
[![Docker Stars](https://img.shields.io/docker/stars/tiredofit/db-backup.svg)](https://hub.docker.com/r/tiredofit/db-backup)
[![Docker Layers](https://images.microbadger.com/badges/image/tiredofit/db-backup.svg)](https://microbadger.com/images/tiredofit/db-backup)
[![Image Size](https://img.shields.io/microbadger/image-size/tiredofit/db-backup.svg)](https://microbadger.com/images/tiredofit/db-backup)
# Introduction # Introduction
This will build a container for backing up multiple type of DB Servers 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. | `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` | `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` | `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 ## Maintenance

View File

@@ -21,6 +21,7 @@ fi
### Set Defaults ### Set Defaults
COMPRESSION=${COMPRESSION:-GZ} COMPRESSION=${COMPRESSION:-GZ}
PARALLEL_COMPRESSION=${PARALLEL_COMPRESSION:-TRUE}
DB_DUMP_FREQ=${DB_DUMP_FREQ:-1440} DB_DUMP_FREQ=${DB_DUMP_FREQ:-1440}
DB_DUMP_BEGIN=${DB_DUMP_BEGIN:-+0} DB_DUMP_BEGIN=${DB_DUMP_BEGIN:-+0}
DB_DUMP_TARGET=${DB_DUMP_TARGET:-/backup} DB_DUMP_TARGET=${DB_DUMP_TARGET:-/backup}
@@ -33,6 +34,19 @@ MD5=${MD5:-TRUE}
SPLIT_DB=${SPLIT_DB:-FALSE} SPLIT_DB=${SPLIT_DB:-FALSE}
TMPDIR=/tmp/backups 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 ### Set the Database Type
case "$DBTYPE" in case "$DBTYPE" in
"couch" | "couchdb" | "COUCH" | "COUCHDB" ) "couch" | "couchdb" | "COUCH" | "COUCHDB" )
@@ -174,15 +188,15 @@ function backup_rethink() {
function compression() { function compression() {
case "$COMPRESSION" in case "$COMPRESSION" in
"GZ" | "gz" | "gzip" | "GZIP") "GZ" | "gz" | "gzip" | "GZIP")
gzip ${TMPDIR}/${TARGET} $GZIP ${TMPDIR}/${TARGET}
TARGET=${TARGET}.gz TARGET=${TARGET}.gz
;; ;;
"BZ" | "bz" | "bzip2" | "BZIP2" | "bzip" | "BZIP" | "bz2" | "BZ2") "BZ" | "bz" | "bzip2" | "BZIP2" | "bzip" | "BZIP" | "bz2" | "BZ2")
bzip2 ${TMPDIR}/${TARGET} $BZIP ${TMPDIR}/${TARGET}
TARGET=${TARGET}.bz2 TARGET=${TARGET}.bz2
;; ;;
"XZ" | "xz" | "XZIP" | "xzip" ) "XZ" | "xz" | "XZIP" | "xzip" )
xz ${TMPDIR}/${TARGET} $XZIP ${TMPDIR}/${TARGET}
TARGET=${TARGET}.xz TARGET=${TARGET}.xz
;; ;;
"NONE" | "none" | "FALSE" | "false") "NONE" | "none" | "FALSE" | "false")