Skip to content

Commit

Permalink
Add compression level selection
Browse files Browse the repository at this point in the history
  • Loading branch information
staser committed Sep 24, 2023
1 parent be691b0 commit c70e19e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ PG_URI=postgres://mongo-host:5432/db-name
GPG_KEYSERVER=keyserver.ubuntu.com # your hpks keyserver
GPG_KEYID=<key_id> # recipient key, backup will be encrypted if added
COMPRESS=pigz # Available: pigz, xz, bzip2, lrzip, brotli, zstd
COMPRESS_LEVEL=7 # Compression level of desired compression program
```

Or see `docker-compose.yml` file to run this container with Docker.
Expand Down
11 changes: 6 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ get_date () {
: ${GPG_KEYSERVER:='keyserver.ubuntu.com'}
: ${GPG_KEYID:=''}
: ${COMPRESS:='pigz'}
: ${COMPRESS_LEVEL:='9'}
: ${MAINTENANCE_DB:='postgres'}
START_DATE=`date +%Y-%m-%d_%H-%M-%S`

Expand All @@ -30,27 +31,27 @@ mc mb backup/${S3_BUCK} --insecure || true

case $COMPRESS in
'pigz' )
COMPRESS_CMD='pigz -9'
COMPRESS_CMD='pigz -'${COMPRESS_LEVEL}
COMPRESS_POSTFIX='.gz'
;;
'xz' )
COMPRESS_CMD='xz'
COMPRESS_CMD='xz -'${COMPRESS_LEVEL}
COMPRESS_POSTFIX='.xz'
;;
'bzip2' )
COMPRESS_CMD='bzip2 -9'
COMPRESS_CMD='bzip2 -'${COMPRESS_LEVEL}
COMPRESS_POSTFIX='.bz2'
;;
'lrzip' )
COMPRESS_CMD='lrzip -l -L5'
COMPRESS_POSTFIX='.lrz'
;;
'brotli' )
COMPRESS_CMD='brotli -9'
COMPRESS_CMD='brotli -'${COMPRESS_LEVEL}
COMPRESS_POSTFIX='.br'
;;
'zstd' )
COMPRESS_CMD='zstd -9'
COMPRESS_CMD='zstd -'${COMPRESS_LEVEL}
COMPRESS_POSTFIX='.zst'
;;
* )
Expand Down

0 comments on commit c70e19e

Please sign in to comment.