Based on https://github.com/talset/docker-mysql-backup-s3
container to backup and restore your mysql database's to using awscli. Could be use with docker or in k8s.
./restore path/inside-bucket/example.sql.gz
./backup
| Env var name | Description |
|---|---|
MYSQL_HOST | Host where MySQL is running. default localhost. example with k8s $(MYSQL_SERVICE_HOST) |
MYSQL_TCP_PORT | Port to connect to MySQL. default 3306. example with k8s $(MYSQL_SERVICE_PORT) |
MYSQL_USER | The username to connect with MySQL |
MYSQL_PWD | The password to connect with MySQL |
MYSQL_DATABASE | Database used |
FILENAME | Name to file in bucket storage. Default name backup_%Y-%m-%d_%H-%M-%S output example backup_2015-08-03_17-58-22 |
BACKUP_DIR | Internal pod directory to use when creating the backup, this directory can be mouted via a volume if necessary |
BACKUP_TIME | Time use crontab format to run a dump. default 0 5 * * * (5 am) |
AWS_ACCESS_KEY_ID | AWS access key ID (used to access to the S3 bucket) |
AWS_SECRET_ACCESS_KEY | AWS secret access key |
AWS_S3_BUCKET | AWS S3 bucket to store the PostgreSQL dumps |
AWS_DEFAULT_REGION | AWS region of the S3 bucket |
SCW_ACCESS_KEY | SCW access key (used to access to the Scaleway Object Storage bucket) |
SCW_SECRET_KEY | SCW secret key |
SCW_DEFAULT_ORGANIZATION_ID | SCW default organization ID |
SCW_DEFAULT_REGION | SCW region of the Object Storage bucket |
sudo docker build -t cycloid/mysql-dump .
sudo docker push cycloid/mysql-dump
Content type
Image
Digest
sha256:a6c451d89…
Size
499 MB
Last updated
11 months ago
docker pull cycloid/mysql-dump