Sign inSign up

intlfcstone/mysql-azcopy

By intlfcstone

•Updated over 7 years ago

mysqldump a database and push it to Microsoft Azure Blob Storage on a schedule you define

Image
0

2.0K

intlfcstone/mysql-azcopy repository overview

⁠mysql-azcopy

===========================================

mysql-azcopy is a container which uses mysqldump to backup a database and schedules a go-cron task which uses azcopy to upload the backup to Azure Blob Storage

At some point in the future, it will do more, and cooler, things

⁠The nitty-gritty

mysql-azcopy needs to know the IP/hostname, mysql user, mysql password, mysql port, azure storage account name, azure blob container name, azure destination key, azure directory, and go-cron container schedule.

This can be done through environment variables:

  • FILE_PREFIX <-- Defaults to 'backup' - used in naming the file
  • MYSQL_USER
  • MYSQL_PASS
  • MYSQL_HOST <-- Defaults to 'mysql'
  • MYSQL_PORT <-- Defaults to '3306'
  • MYSQL_DB_NAME <-- Name of the database you would like to back up
  • AZURE_DST_KEY <-- Access key for your Azure Blob Storage Account
  • AZURE_STORAGE_ACCT_NAME <-- Name of your Azure Blob Storage Account
  • AZURE_BLOB_CONTAINER <-- Name of container holding your blobs
  • AZURE_BLOB_DIRECTORY <-- Directory name to store files in inside of your blob container
⁠Example

This command

sudo docker run -e FILE_PREFIX=production \
    -e MYSQL_USER=db_user \
    -e MYSQL_PASS=sekret_password \
    -e MYSQL_HOST=192.168.89.153 \
    -e MYSQL_PORT=3306 \
    -e MYSQL_DB_NAME=wordpress_site \
    -e AZURE_DST_KEY=AZURE_ACCT_KEY \
    -e AZURE_STORAGE_ACCT_NAME=mystorage \
    -e AZURE_BLOB_CONTAINER=mysql-backups \
    -e CRON_SCHEDULE="@every 5m30s" \
    -e AZURE_BLOB_DIRECTORY=wordpressbackups \
    intlfcstone/mysql-azcopy:v0.0.1

Connects to a MySQL database located at 192.168.89.153 authenticating with the credentials db_user/sekret_password and dumps the database wordpress_site to a file called production-wordpress_site_2018-10-01-at-09_19PM.sql (example date) which is then gzipped and pushed to the directory wordpressbackups, inside the container mysql-backups, inside the storage account mystorage, authenticating to Azure blob storage with AZURE_ACCT_KEY.

The backup process script in this example will run every 5 minutes and 30 seconds.

You can specify any frequency which go-cron⁠ can parse (@daily, @hourly, etc).

Tag summary

Content type

Image

Digest

Size

130.9 MB

Last updated

over 7 years ago

docker pull intlfcstone/mysql-azcopy