th0th/mysql-s3-backup

By th0th

Updated 3 months ago

Image
0

45

mysql-s3-backup is a MySQL backup helper that:

  • Takes the dump of the MySQL database
  • Uploads it to AWS' object storage service S3
  • Reports to WebGazer (optional)

Usage

Environment variables
VariableRequiredDefault valueDescription
AWS_ACCESS_KEY_IDAccess key id for the AWS account
AWS_REGIONRegion for the AWS bucket
AWS_S3_ENDPOINTAWS S3 endpoint with bucket and path (e.g. "my-bucket/mysql-backup")
AWS_S3_STORAGE_CLASSSTANDARD_IAAWS S3 storage class (see https://aws.amazon.com/s3/storage-classes/ and https://rclone.org/s3/#s3-storage-class for options.
AWS_SECRET_ACCESS_KEYSecret access key for the AWS account
MYSQL_DBMySQL server database
MYSQL_HOSTmysqlMySQL server host
MYSQL_PASSWORDMySQL server password
MYSQL_PORT3306MySQL server port
MYSQL_USERrootMySQL server user
WEBGAZER_HEARTBEAT_URLWebGazer Heartbeat Monitor URL
Running
$ docker run \
  -e AWS_ACCESS_KEY_ID=<aws_access_key_id> \
  -e AWS_REGION=<aws_region> \
  -e AWS_S3_ENDPOINT=<aws_s3_endpoint> \
  -e AWS_S3_STORAGE_CLASS=<aws_s3_storage_class[STANDARD_IA]> \
  -e AWS_SECRET_ACCESS_KEY=<aws_secret_access_key> \
  -e MYSQL_DB=<database> \
  -e MYSQL_HOST=<mysql_hostname[mysql]> \
  -e MYSQL_PASSWORD=<mysql_password> \
  -e MYSQL_PORT=<mysql_port[3306]> \
  -e MYSQL_USER=<mysql_user[root]> \
  -e WEBGAZER_HEARTBEAT_URL=<webgazer_heartbeat_url> \
  th0th/mysql-s3-backup
Example
$ docker run \
  -e AWS_ACCESS_KEY_ID=g9XqNnqKmUk6xqwkStkN \
  -e AWS_REGION=eu-west-1 \
  -e AWS_S3_ENDPOINT=my-bucket/mysql-backup \
  -e AWS_S3_STORAGE_CLASS=GLACIER \
  -e AWS_SECRET_ACCESS_KEY=GLBZ8mQf27UL57YHbkLhXWtfJWVwtUBbQup6mFzw \
  -e MYSQL_DB=database \
  -e MYSQL_HOST=mysql \
  -e MYSQL_PASSWORD=mysql_password \
  -e MYSQL_PORT=3306 \
  -e MYSQL_USER=mysql_user \
  -e WEBGAZER_HEARTBEAT_URL=https://heartbeat.webgazer.io/1-8f713c75d659 \
  th0th/mysql-s3-backup

Shameless plug

I am an indie hacker, and I am running two services that might be useful for your business. Check them out :)

WebGazer

WebGazer

WebGazer is a monitoring service that checks your website, cron jobs, or scheduled tasks on a regular basis. It notifies you with instant alerts in case of a problem. That way, you have peace of mind about the status of your service without manually checking it.

PoeticMetric

PoeticMetric

PoeticMetric is a privacy-first, regulation-compliant, blazingly fast analytics tool.

No cookies or personal data collection. So you don't have to worry about cookie banners or GDPR, CCPA, and PECR compliance.

License

Copyright © 2022, Gokhan Sari. Released under the MIT License.

Docker Pull Command

docker pull th0th/mysql-s3-backup