Browse Source

Added static filename to list of environment variable options

pull/101/head
Rob Harrison 7 years ago
parent
commit
58e8830f1c
  1. 1
      mysql-backup-s3/Dockerfile
  2. 1
      mysql-backup-s3/README.md
  3. 12
      mysql-backup-s3/backup.sh

1
mysql-backup-s3/Dockerfile

@ -17,6 +17,7 @@ ENV S3_REGION us-west-1
ENV S3_ENDPOINT **None**
ENV S3_S3V4 no
ENV S3_PREFIX 'backup'
ENV S3_FILENAME **None**
ENV MULTI_FILES no
ENV SCHEDULE **None**

1
mysql-backup-s3/README.md

@ -20,6 +20,7 @@ $ docker run -e S3_ACCESS_KEY_ID=key -e S3_SECRET_ACCESS_KEY=secret -e S3_BUCKET
- `S3_SECRET_ACCESS_KEY` your AWS secret key *required*
- `S3_BUCKET` your AWS S3 bucket path *required*
- `S3_PREFIX` path prefix in your bucket (default: 'backup')
- `S3_FILENAME` a consistent filename to overwrite with your backup. If not set will use a timestamp.
- `S3_REGION` the AWS S3 bucket region (default: us-west-1)
- `S3_ENDPOINT` the AWS Endpoint URL, for S3 Compliant APIs such as [minio](https://minio.io) (default: none)
- `S3_S3V4` set to `yes` to enable AWS Signature Version 4, required for [minio](https://minio.io) servers (default: no)

12
mysql-backup-s3/backup.sh

@ -76,7 +76,11 @@ if [ ! -z "$(echo $MULTI_FILES | grep -i -E "(yes|true|1)")" ]; then
mysqldump $MYSQL_HOST_OPTS $MYSQLDUMP_OPTIONS --databases $DB | gzip > $DUMP_FILE
if [ $? == 0 ]; then
S3_FILE="${DUMP_START_TIME}.${DB}.sql.gz"
if [ "${S3_FILENAME}" == "**None**" ]; then
S3_FILE="${DUMP_START_TIME}.${DB}.sql.gz"
else
S3_FILE="${S3_FILENAME}.${DB}.sql.gz"
fi
copy_s3 $DUMP_FILE $S3_FILE
else
@ -91,7 +95,11 @@ else
mysqldump $MYSQL_HOST_OPTS $MYSQLDUMP_OPTIONS $MYSQLDUMP_DATABASE | gzip > $DUMP_FILE
if [ $? == 0 ]; then
S3_FILE="${DUMP_START_TIME}.dump.sql.gz"
if [ "${S3_FILENAME}" == "**None**" ]; then
S3_FILE="${DUMP_START_TIME}.dump.sql.gz"
else
S3_FILE="${S3_FILENAME}.sql.gz"
fi
copy_s3 $DUMP_FILE $S3_FILE
else

Loading…
Cancel
Save