backup-zen

by rezachalak

Helm chartv0.1.4App 1.0.0

BackupZen is a solution for backing up and uploading various database types, leveraging the power of K8s cronjobs.

About this chart

Backup-Zen

Backup-Zen is a Database Backup Solution Using Helm

Github Repo

Installation

Web Site

Documentation

Bug Reports

Main features

  • Deploy on K8s using Helm
  • Specify the type of database: MySQL, PostgreSQL, and MongoDB
  • Set backup strategy: oneByOne or adminUser
  • Determine whether to deploy on Object Storage (S3 and MinIO are supported) or not
  • Give Notifications on MSTeams for Fail/Success backup and upload
  • Retention period: days and weeks to keep, and specify the desired day of the week for performing backups

Getting Started

Prerequisites

  • A kubernetes cluster
  • Read access to database
  • Helm and kubectl installed and configured

Using Helm

Helm must be installed to use the charts. Please refer to Helm's documentation to get started.

Once Helm has been set up correctly, add the repo as follows:

helm repo add bzen https://rezachalak.github.io/backup-zen/

If you had already added this repo earlier, run helm repo update to retrieve the latest versions of the packages. You can then run helm search repo bzen to see the charts.

To install the backup-zen chart:

helm install my-backup-zen bzen/backup-zen

To uninstall the chart:

helm delete my-backup-zen  

Installation

  1. Add Backup-Zen chart repository.
helm repo add bzen https://rezachalak.github.io/backup-zen/
  1. Update local Backup-Zen chart information from chart repository.
helm repo update
  1. Install Backup-Zen chart.
  • With Helm 2, the following command will create the backup-zen namespace and install the Backup-Zen chart together.
helm install bzen/backup-zen --name bzen --namespace backup-zen
  • With Helm 3, the following commands will create the backup-zen namespace first, then install the Backup-Zen chart.
kubectl create namespace backup-zen
helm install bzen bzen/backup-zen --namespace backup-zen

Uninstallation

With Helm 2 to uninstall Backup-Zen.

helm delete bzen --purge

With Helm 3 to uninstall Backup-Zen.

helm uninstall bzen -n backup-zen
kubectl delete namespace backup-zen

Values

The values.yaml contains items used to tweak a deployment of this chart.

General Settings

Backup Type

Select one of these two types:

oneByOne: preparing databaseName, username and password for each database as an array in oneByOne.creds must be provided:

credsSecretName is the name of the secret where the database credentials are stored (can be used instead of oneByOne.creds)

credsSecretName: mycreds-secret

This secret must contain: creds.json

 creds.json: 
[
    {
    "database_name": "",
    "username": "",
    "password": "" 
    }
    ,...
]

Or in values.yaml:

  creds:
    - database_name: db1
      username: user1
      password: password1
    - database_name: db2
      username: user2
      password: password2

adminUser: admin user credentials in adminUser.username and adminUser.password must be provided

KeyTypeDefaultDescription
databaseTypestring"MongoDB"Available db Types: PostgreSQL, MySQL & MongoDB
hostnamestring"mydb.rds.amazonaws.com"Database Host Address
portstring"54325"Database Port
credentialTypestring"oneByOne"Select one of these two types: oneByOne OR adminUser
global.namespacestring"maintenance"
global.createNamespacestring"true"
global.rotationstring"true"
global.rotation_config.dayOfWeekToKeepstring"5"Which day to take the weekly backup from (1-7 = Monday-Sunday)
global.rotation_config.daysToKeepstring"7"Number of days to keep daily backups
global.rotation_config.weeksToKeepstring"5"How many weeks to keep weekly backups
global.teamsNotificationstring"false"
global.succeededTeamsURLstring"https://myorg.webhook.office.com/webhookb1/blob-blob-blob"
global.failedTeamsURLstring"https://myorg.webhook.office.com/webhookb2/blob-blob-blob"

Credentials Settings

KeyTypeDefaultDescription
adminUser.usernamestring""
adminUser.passwordstring""
oneByOne.credsSecretNamestring""the secret where the database credentials are stored (can be used instead of oneByOne.creds
oneByOne.credslist(map)[{"database_name": "db1", "username": "u1", "password": "p1"}]

Cronjob Scheduling Settings

KeyTypeDefaultDescription
cronjob.pullPolicystring"Always"
cronjob.imagePullSecretslist(string)"[]"
cronjob.restartPolicystring"Never"
cronjob.resources.requests.cpustring"1"
cronjob.resources.requests.memorystring"1Gi"
cronjob.resources.limits.cpustring"2"
cronjob.resources.limits.memorystring"2Gi"
cronjob.schedulestring"0 0 * * *"
cronjob.failedJobsHistoryLimitstring""
cronjob.successfulJobsHistoryLimitstring""
cronjob.storage.createPVCstring""
cronjob.storage.PVCNamestring""
cronjob.storage.storageClassstring""
cronjob.storage.accessModestring""
cronjob.storage.PVCSizestring""

Upload To objectStorage Settings

KeyTypeDefaultDescription
backupUpload.activestring"false"
backupUpload.objectStorageTypestring"AWS_S3"Supported objectStorages are: MinIO and AWS_S3
backupUpload.objectStorageSecretNamestring""the name of the secret where the credentials of object storage is stored.
backupUpload.AWS_S3.AWS_ACCESS_KEY_IDstring""
backupUpload.AWS_S3.AWS_DEFAULT_REGIONstring"us-west-1"
backupUpload.AWS_S3.AWS_SECRET_ACCESS_KEYstring""
backupUpload.AWS_S3.BUCKET_NAMEstring"backupzen-s3"
backupUpload.MINIO.MINIO_ACCESS_KEY_IDstring""
backupUpload.MINIO.MINIO_URLstring"http://localhost:9000"
backupUpload.MINIO.MINIO_SECRET_ACCESS_KEYstring""
backupUpload.MINIO.BUCKET_NAMEstring""
backupUpload.MINIO.Ostring"backupzen-minio"

Please see link for more information.

Deploy backup-zen with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has backup-zen 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 chartbackup-zen is pinned at v0.1.4 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