Skip to content
This repository was archived by the owner on Sep 18, 2024. It is now read-only.

51systems/docker-mysql-backup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mysql Backup

Docker mysql backup image that periodically backs up a mysql database, compresses it, and uploads it using scp.

Environment variables

Name Description
CRON_SCHEDULE Cron schedule in crontab format
MYSQL_HOST Host where mysql is running
MYSQL_PORT Port to connect (3306 default)
MYSQL_USER Username to connect with
MYSQL_PASSWORD Password to connect with
MYSQL_DATABASE Name of mysql database to backup (optional)
UPLOAD_HOST Server to SCP the file to
UPLOAD_USER SSH Username
UPLOAD_TARGET Path to upload the backup to
UPLOAD_SSHKEY Private key to use when connecting to ssh

Testing

There is an included docker-compose file for testing. It mounts the public key in test/ssh/id_rsa.pub to an imaginary backup server, and then attempts to backup the database every minute.

Gotachas

When the backup server runs, it will change the permission of id_rsa.pub. You must chown it back to your current user and group prior to calling docker-compose again.

Because of this, I recommend using the following command to run the docker-compose file sudo chown <user>:<group> test/ssh/id_rsa.pub && docker-compose up --build

Replacing user and group with your username and linux group, respectively.

About

Backup Mysql with docker

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages