Backup and Restore MySQL databases to S3 (supports periodic backups)
MYSQLDUMP_OPTIONS
mysqldump options (default: --quote-names --quick --add-drop-table --add-locks --allow-keywords --disable-keys --extended-insert --single-transaction --create-options --comments --net_buffer_length=16384)MYSQLDUMP_DATABASE
list of databases you want to backup (default: --all-databases)MYSQL_HOST
the mysql host requiredMYSQL_PORT
the mysql port (default: 3306)MYSQL_USER
the mysql user requiredMYSQL_PASSWORD
the mysql password requiredS3_ACCESS_KEY_ID
your AWS access key requiredS3_SECRET_ACCESS_KEY
your AWS secret key requiredS3_BUCKET
your AWS S3 bucket path requiredS3_PREFIX
path prefix in your bucket (default: 'backup')S3_REGION
the AWS S3 bucket region (default: us-west-1)S3_ENDPOINT
the AWS Endpoint URL, for S3 Compliant APIs such as minio (default: none)S3_S3V4
set toyes
to enable AWS Signature Version 4, required for minio servers (default: no)SCHEDULE
backup schedule time, see explainatons below
You can alternatively mount docker secrets and configure their location using the following environment variables
S3_ACCESS_KEY_ID_FILE
your path to the AWS access key secret fileS3_SECRET_ACCESS_KEY_FILE
your path to the AWS secret key fileMYSQL_PASSWORD_FILE
your path to the mysql password secret file
backup
runs a one-off backup to the S3 bucketcron backup
runs scheduled backups to the S3 bucket as defined by theSCHEDULE
environment variablerestore
runs a one-off restore from the latest backup in the S3 bucketrestore backupfile.dump.sql.gz
runs a one-off restore from the specified backup in the S3 bucketrestore cron
runs scheduled restores from the latest backup in the S3 bucketrestore cron backupfile.dump.sql.gz
runs scheduled restores from the specified backup in the S3 bucket
You can additionally set the SCHEDULE
environment variable like -e SCHEDULE="@daily"
to run the backup automatically.
Learn more about valid values for the SCHEDULE
environment variable here.