frekele / helicopterizer

Backup and Restore for Docker Container!
https://helicopterizer.frekele.org
MIT License
112 stars 20 forks source link

Using `BACKUP_NAME` with empty `BACKUP_PREFIX` doesn't work at all #16

Open firehist opened 8 years ago

firehist commented 8 years ago

testIt () {
  local backupPrefix=$1
  local backupName=$2
  local name=''

  if [ -n "$backupName" ]; then
    name="1"
  else
    name="2"
  fi
  echo "$name"
}

BACKUP_PREFIX=
BACKUP_NAME=jenkins

echo $(test $BACKUP_PREFIX $BACKUP_NAME)
# Ouput 2

BACKUP_PREFIX="beurk"
echo $(test $BACKUP_PREFIX $BACKUP_NAME)
# Output 1
luishdez commented 7 years ago

I've made that PR. The idea is if that you define $BACKUP_NAME it overrides everything else. So it will end $BACKUP_NAME.tar.gz (pretty useful if you use S3 versions) with life cycles. So it doesn't make to define $BACKUP_PREFIX and $BACKUP_NAME at the same time.

Maybe it's confusing and should warn that PREFIX shouldn't be defined …

Currently I'm using this in prod with no problem

docker run --rm \
--env-file .env-backup \
-v atlassian_db:/data/db:ro \
-v atlassian_jira:/data/jira:ro \
-v atlassian_confluence:/data/confluence:ro \
--name backup helicopterizer backup --tarball

Starting Helicopterizer ...
Cloud Provider is Amazon Simple Storage Service (S3)
STORAGE_PROVIDER=AWS
BACKUP_NAME=docker-atlassian
BACKUP_VERSION=
DATA_PATH=/data/
CRON_SCHEDULE=
GZIP_COMPRESSION=true
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_S3_BUCKET_NAME=
AWS_DEFAULT_REGION=us-east-1
AWS_S3_PATH=/
AWS_S3_OPTIONS=
Starting Tarball Backup to AWS ...
Starting compress: /data/ to /tmp/docker-atlassian.tar.gz