Browse Source
Merge pull request #101 from robwithhair/master
Added static filename to list of environment variable options
pull/97/merge
Olivier Cuypers
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
12 additions and
2 deletions
-
mysql-backup-s3/Dockerfile
-
mysql-backup-s3/README.md
-
mysql-backup-s3/backup.sh
|
|
@ -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** |
|
|
|
|
|
|
|
|
|
@ -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) |
|
|
|
|
|
@ -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 |
|
|
|
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 |
|
|
|
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 |
|
|
|