nunojsferreira / docker-mysql-backup-azure

With this image you are able to backup mysql-databases inside docker container to Azure storage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docker-mysql-backup-azure

container to backup your mysql database's to Microsoft Azure Storare.

Container startup explained

  • You can run this container in 2 modes:
    • ONE_SHOOT - the container will backup your db and stop
    • CONTINUOUS - the container will start and use a cronjob to schedule a backup window and will run until you stop it.
  • Mysql will acess to the host where is database you want to backup
  • Mysql will dump the database to this container and compress it using gzip
  • Using azure-cli the file will be uploaded to Azure Storage

Environment variables

  • $DB_PASSWORD - The password to connect with Mysql
  • $DB_USER - The username to connect with Mysql
  • $DB_NAME - Database name
  • $CONTAINER - Container name in azure
  • $AZURE_STORAGE_ACCOUNT - Name of Azure Storare Account
  • $AZURE_STORAGE_ACCESS_KEY - Acess Key for Storage Account
  • $MYSQL_PORT - Port to connect with Mysql. default 3306
  • $MYSQL_HOST - Host where mysql is running
  • $FILENAME - Name to file in Azure Storage. Default name default-date +"%Y-%m-%d_%H-%M" output example default-2015-08-03_17-58
  • $ONE_SHOOT - If true the container make the backup and exit, else the container still running and schedule a job in crontab. default false a backup window.
  • $BACKUP_WINDOW - What time should backup run. you should use crontab format, so see [documentation](http://www.freebsd.org/cgi/man.cgi?crontab(5). default value every day at 6 am.
  • $DEBUG - If true will give you the value of all variables in terminal. default to false
  • $NO_PASSWORD - Connect to Mysql-Host without password, default to false

Example of running

docker run -rm --name mysql-backup \
-e "DB_PASSWORD=backup" \
-e "DB_USER=backup" \
-e "DB_NAME=backup" \
-e "ONE_SHOOT=true" \
-e "FILENAME=backup"
-e "AZURE_STORAGE_ACCOUNT=teste-azure"
-e "AZURE_STORAGE_ACCESS_KEY=ashdgashdgasdsa--dadcdsfsd/sdfd--"
-e "CONTAINER=sql-backup" \
-e "MYSQL_HOST=test.mysql.com" \
fernandoneto/docker-mysql-backup-azure:latest

This will upload to Azure Storare a file named default-2015-08-04_09-47.sql.gz and after that the container will stop.

Building image

docker build -t fernandoneto/docker-mysql-backup-azure .

About

With this image you are able to backup mysql-databases inside docker container to Azure storage


Languages

Language:Shell 100.0%