Skip to content

Commit

Permalink
Release 1.23.0 - See CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tiredofit committed Jun 15, 2020
1 parent bf97c3a commit 955a08a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 11 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 1.23.0 2020-06-15 <dave at tiredofit dot ca>

### Added
- Add zstd compression support
- Add choice of compression level


## 1.22.0 2020-06-10 <dave at tiredofit dot ca>

### Added
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
### Set Environment Variables
ENV ENABLE_CRON=FALSE \
ENABLE_SMTP=FALSE \
ENABLE_ZABBIX=FALSE \
ENABLE_ZABBIX=TRUE \
ZABBIX_HOSTNAME=db-backup

### Dependencies
Expand All @@ -30,12 +30,13 @@ RUN set -ex && \
postgresql-client \
redis \
xz \
zstd \
&& \
\
apk add \
pixz@testing \
&& \
\
\
mkdir -p /usr/src/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 /usr/src/pbzip2 && \
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Currently backs up CouchDB, InfluxDB, MySQL, MongoDB, Postgres, Redis, Rethink s
* backup all databases
* choose to have an MD5 sum after backup for verification
* delete old backups after specific amount of time
* choose compression type (none, gz, bz, xz)
* choose compression type (none, gz, bz, xz, zstd)
* connect to any container running on the same system
* select how often to run a dump
* select when to start the first dump, whether time of day or relative to container start time
Expand Down Expand Up @@ -83,13 +83,16 @@ The following directories are used for configuration and can be mapped for persi

## Environment Variables

*If you are trying to backup a database that doesn't have a user or a password (you should!) make sure you set `CONTAINER_ENABLE_DOCKER_SECRETS=FALSE`*

Along with the Environment Variables from the [Base image](https://hub.docker.com/r/tiredofit/alpine), below is the complete list of available options that can be used to customize your installation.


| Parameter | Description |
|-----------|-------------|
| `BACKUP_LOCATION` | Backup to `FILESYSTEM` or `S3` compatible services like S3, Minio, Wasabi - Default `FILESYSTEM`
| `COMPRESSION` | Use either Gzip `GZ`, Bzip2 `BZ`, XZip `XZ`, or none `NONE` - Default `GZ`
| `COMPRESSION` | Use either Gzip `GZ`, Bzip2 `BZ`, XZip `XZ`, ZSTD `ZSTD` or none `NONE` - Default `GZ`
| `COMPRESSION_LEVEL` | Numberical value of what level of compression to use, most allow `1` to `9` except for `ZSTD` which allows for `1` to `19` - Default `3` |
| `DB_TYPE` | Type of DB Server to backup `couch` `influx` `mysql` `pgsql` `mongo` `redis` `rethink`
| `DB_HOST` | Server Hostname e.g. `mariadb`
| `DB_NAME` | Schema Name e.g. `database`
Expand All @@ -107,6 +110,7 @@ Along with the Environment Variables from the [Base image](https://hub.docker.co
| `PARALLEL_COMPRESSION` | Use multiple cores when compressing backups `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` |


**Backing Up to S3 Compatible Services**

If `BACKUP_LOCATION` = `S3` then the following options are used.
Expand Down
21 changes: 14 additions & 7 deletions install/etc/services.available/10-db-backup/run
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ fi
### Sanity Test
sanity_var DB_TYPE "Database Type"
sanity_var DB_HOST "Database Host"

file_env 'DB_USER'
file_env 'DB_PASS'

### Set Defaults
BACKUP_LOCATION=${BACKUP_LOCATION:-"FILESYSTEM"}
COMPRESSION=${COMPRESSION:-GZ}
COMPRESSION_LEVEL=${COMPRESSION_LEVEL:-"3"}
DB_DUMP_BEGIN=${DB_DUMP_BEGIN:-+0}
DB_DUMP_FREQ=${DB_DUMP_FREQ:-1440}
DB_DUMP_TARGET=${DB_DUMP_TARGET:-/backup}
Expand All @@ -43,7 +45,6 @@ if [ "BACKUP_TYPE" = "S3" ] || [ "BACKUP_TYPE" = "s3" ] || [ "BACKUP_TYPE" = "MI
sanity_var S3_PATH "S3 Path"
file_env 'S3_KEY_ID'
file_env 'S3_KEY_SECRET'

fi

if [ "$1" = "NOW" ]; then
Expand All @@ -53,13 +54,15 @@ fi

### Set Compression Options
if var_true $PARALLEL_COMPRESSION ; then
BZIP="pbzip2"
GZIP="pigz"
XZIP="pixz"
BZIP="pbzip2 -${COMPRESSION_LEVEL}"
GZIP="pigz -${COMPRESSION_LEVEL}"
XZIP="pixz -${COMPRESSION_LEVEL}"
ZSTD="zstd --rm -${COMPRESSION_LEVEL}"
else
BZIP="bzip2"
GZIP="gzip"
XZIP="xz"
BZIP="bzip2 -${COMPRESSION_LEVEL}"
GZIP="gzip -${COMPRESSION_LEVEL}"
XZIP="xz -${COMPRESSION_LEVEL} "
ZSTD="zstd --rm -${COMPRESSION_LEVEL}"
fi


Expand Down Expand Up @@ -288,6 +291,10 @@ function compression() {
$XZIP ${TMPDIR}/${TARGET}
TARGET=${TARGET}.xz
;;
"ZSTD" | "zstd" | "ZST" | "zst" )
$ZSTD ${TMPDIR}/${TARGET}
TARGET=${TARGET}.zst
;;
"NONE" | "none" | "FALSE" | "false")
;;
esac
Expand Down

0 comments on commit 955a08a

Please sign in to comment.