diff --git a/CHANGELOG.md b/CHANGELOG.md index aaf97f3..9310efd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -## 1.5 - 2017-01-28 - +## 1.6 - 2018-02-26 - + +* Add Parallel Compression mode (Default TRUE + +## 1.5 - 2018-01-28 - * Add Zabbix Checks diff --git a/Dockerfile b/Dockerfile index 4e2fba0..3223d94 100644 --- a/Dockerfile +++ b/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 \ - postgresql \ - postgresql-client \ + mariadb-client \ openssl \ + pigz \ + postgresql \ + postgresql-client \ redis \ - xz \ - && \ - - rm -rf /var/cache/apk/* - + 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/* ### S6 Setup - ADD install / - -### Entrypoint Configuration - ENTRYPOINT ["/init"] - + ADD install / diff --git a/README.md b/README.md index 97fcc83..14c23c9 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,5 @@ # 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 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 diff --git a/install/etc/s6/services/10-db-backup/run b/install/etc/s6/services/10-db-backup/run index 05178c4..8c2e654 100755 --- a/install/etc/s6/services/10-db-backup/run +++ b/install/etc/s6/services/10-db-backup/run @@ -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")