mysql-backup

by Helm

Helm chartv2.2.3App 0.3.0Apache-2.0

Take mysql backups from any mysql instance to AWS S3. Supports GCP CloudSQL

About this chart

Mysql Backup

Overview

This chart aims to backup target mysql instances into object storage.

It can read data from a mysql instance or through GCP cloud SQL proxy.

This charts curretnly supports only AWS S3 as object storage.

ParameterDescriptionDefault
mysql.portMySQL instance port3306
mysql.hostMySQL instance host127.0.0.1
mysql.databaseMysql databases name(s). Space-separated if more than one db, e.g. "db-1 db-2 db3". If null - will try to dump all databases by using mysqldump --all-databases flagnull
mysql.secret.nameMySQL credentials Secret namemysql-credentials
mysql.secret.keys.userMySQL user keys in credentials secretuser
mysql.secret.keys.passwordMySQL password keys in credentials secretpassword
s3.enabledEnable AWS s3 backupsfalse
s3.bucketAWS s3 bucket namenull
s3.filePrefixAWS s3 file prefix used for backupnull
s3.secret.nameAWS s3 credentials Secret namemysql-credentials
s3.secret.keys.accessKeyIdAWS s3 accessKeyId keys in credentials secretaccessKeyId
s3.secret.keys.secretAccessKeyAWS s3 secretAccessKey keys in credentials secretsecretAccessKey
s3.endpointUrlCustom s3 endpoint URLnull
gcs.enabledEnable GCP gcs backupsfalse
gcs.bucketGCP gcs bucket namenull
gcs.filePrefixGCP gcs file prefix used for backupmysqldump
backup.scheduleWhen to run the backup, cron format0 1 * * *
backup.image.repositoryImage used to perform the backupsoftonic/mysql-backup-s3
backup.image.tagTag used for the image0.1.5
backup.image.imagePullSecretImage pull secretnull
backup.resources.limits.memoryResources limits for memory for mysql-backups container1024Mi
backup.resources.limits.cpuResources limits for CPU for mysql-backups container1
backup.resources.requests.memoryResources requests for memory for mysql-backups container512Mi
backup.resources.requests.cpuResources requests for cpu for mysql-backups container200m
cloudsqlProxy.enabledCloud SQL deployment enabledfalse
cloudsqlProxy.cloudSQL.secret.nameCloud SQL secret namecloudsql-credentials
cloudsqlProxy.cloudSQL.secret.keys.serviceAccountCloud SQL Service account key for secretserviceAccount.json
cloudsqlProxy.cloudSQL.gcProjectGoogle Cloud Project from where to perform the backupnull
cloudsqlProxy.cloudSQL.instanceIdGoogle Cloud SQL instance ID from where to perform the backupnull
cloudsqlProxy.cloudSQL.regionGoogle Cloud Region where the SQL instance ID is located innull
cloudsqlProxy.cloudSQL.image.repositorycloudsql proxy imagegcr.io/cloudsql-docker/gce-proxy
cloudsqlProxy.cloudSQL.image.tagcloudsql proxy image tag1.13
cloudsqlProxy.resources.limits.memoryResources limits for memory for cloudsql-proxy container32Mi
cloudsqlProxy.resources.limits.cpuResources limits for CPU for cloudsql-proxy container1
cloudsqlProxy.resources.requests.memoryResources requests for memory for cloudsql-proxy container16Mi
cloudsqlProxy.resources.requests.cpuResources requests for cpu for cloudsql-proxy container10m

Usage

If we want to backup database example in mysql instance reachable at 10.0.0.2 everyday at 4am into AWS s3 buckets example-backup we can deploy this chart with values as below.

Note that secrets example-db-credentials and aws-credentials are already existing secrets.

mysql-backup:
  enabled: true
  mysql:
    host: 10.0.0.2
    database: example
    secret:
      name: example-db-credentials
      keys:
        user: db.backup.user
        password: db.backup.pass
  s3:
    enabled: true
    bucket: example-bucket
    filePrefix: my-prefix
    secret:
      name: aws-credentials
      keys:
        accessKeyId: accessKeyId
        secretAccessKey: secretAccessKey
  backup:
    schedule: 0 4 * * *

Deploy mysql-backup with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has mysql-backup on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartmysql-backup is pinned at v2.2.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply