https://github.com/leen15/docker-s3-mysql-dump
https://github.com/leen15/docker-s3-mysql-dump
aws backup cron docker mysql s3
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/leen15/docker-s3-mysql-dump
- Owner: Leen15
- Created: 2016-08-25T13:22:50.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-10-19T07:24:27.000Z (over 7 years ago)
- Last Synced: 2025-03-14T18:21:30.556Z (over 1 year ago)
- Topics: aws, backup, cron, docker, mysql, s3
- Language: Shell
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mysql dump to S3
A docker image for backup all mysql databases and upload them to a S3 Bucket.
Image runs as a cron job by default every hour. Period may be changed by tuning `BACKUP_CRON_SCHEDULE` environment variable.
It also have a `BACKUP_PRIORITY` param for set the backup priority with ionice and nice values.
May also be run as a one time backup job by using `backup.sh` script as command.
Following environment variables should be set for mysql to work:
```
MYSQL_HOST=mysql
MYSQL_PASSWORD=password
```
Following environment variables should be set for backup to work:
```
BACKUP_S3_BUCKET= // no trailing slash at the end!
AWS_DEFAULT_REGION=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
```
Flowing environment variables can be set to change the functionality:
```
BACKUP_CRON_SCHEDULE=* * * * *
MYSQL_BACKUP_DIR=/var/backup/mysql
MYSQL_EXCLUDE_DBS=|sys|mysql
BACKUP_PRIORITY=
MYSQL_DUMP_PARAMS="--lock-tables=false --single-transaction --quick"
```
If you want to keep the archive files created, mount a volume on `MYSQL_BACKUP_DIR`.
If you want to store files on S3 under a subdirectory, just add it to the `BACKUP_S3_BUCKET` like `BACKUP_S3_BUCKET=bucket_name/subdirectory_for_storage`.