dumpscript

by Cloudscript Technology

Helm chartv1.11.0App v0.0.45-alpine-edgeMITVerified publisher

The DumpScript is a unified system for backup and restore of MySQL, PostgreSQL, MongoDB and ClickHouse databases to S3-compatible storage and Azure Blob Storage.

About this chart

Dumpscript Helm Chart

A Helm Chart for automating PostgreSQL, MySQL/MariaDB, MongoDB and ClickHouse database backups on Kubernetes, with automatic upload to S3-compatible storage (AWS S3, MinIO, DigitalOcean Spaces) or Azure Blob Storage.

Description

Dumpscript is a complete solution for automated database backups in Kubernetes environments. It creates independent CronJobs for each configured database, performing regular dumps and uploading them to S3-compatible storage or Azure Blob Storage.

Features

  • ✅ Multiple databases: Support for PostgreSQL, MySQL/MariaDB, MongoDB and ClickHouse (native server-side BACKUP)
  • ✅ Runtime configurable client versions: No need to rebuild images
  • ✅ Multiple backup schedules: Support for daily, weekly, monthly, and yearly backups per database
  • ✅ Independent jobs: Each database runs in a separate CronJob
  • ✅ Multiple storage backends: Native support for S3-compatible storage (AWS S3, MinIO, DigitalOcean Spaces) and Azure Blob Storage
  • ✅ Flexible authentication: Support for Kubernetes secrets or direct values
  • ✅ Custom scheduling: Individual cron expressions per backup type
  • ✅ Custom arguments: Database-specific dump options
  • ✅ AWS IAM Roles: Support for roles for authentication
  • ✅ Security: Credentials protected via Kubernetes Secrets
  • ✅ Slack notifications: Optional notifications for backup status
  • ✅ Alpine base image: Containerized execution on Alpine Linux

Installation

Prerequisites

  • Kubernetes 1.16+
  • Helm 3.0+
  • Access to Object Storage

Install the Chart

# Add the repository (if applicable)
helm repo add cloudscript https://charts.cloudscript.com.br
helm repo update

# Install the chart
helm install dumpscript cloudscript/dumpscript -f values.yaml

Configuration

Example values.yaml

# Image configuration
image:
  repository: ghcr.io/cloudscript-technology/dumpscript
  pullPolicy: IfNotPresent
  tag: "latest"

# Database configuration
databases:
  # PostgreSQL with direct credentials
  - type: postgresql
    version: "17"  # PostgreSQL client version
    periodicity:
      - type: daily
        retentionDays: 7
        schedule: "0 2 * * *"  # Every day at 2:00 AM
      - type: weekly
        retentionDays: 30
        schedule: "0 3 * * 0"  # Every Sunday at 3:00 AM
      - type: monthly
        retentionDays: 365
        schedule: "0 4 1 * *"  # First day of month at 4:00 AM
    connectionInfo:
      host: "postgres.example.com"
      username: "backup_user"
      password: "secret_password"
      database: "app_db"
      port: 5432
    objectStorage:
      region: "us-west-2"
      bucket: "my-company-backups"
      bucketPrefix: "postgres-dumps/"
    extraArgs: "--verbose --single-transaction"
    # Volume configuration for temporary storage
    extraVolumes:
      - name: temp-data
        emptyDir:
          sizeLimit: 20Gi
    extraVolumeMounts:
      - name: temp-data
        mountPath: /dumpscript
        readOnly: false

  # MariaDB with secrets (S3 backend)
  - type: mariadb
    version: "11.4"  # MariaDB client version
    periodicity:
      - type: daily
        retentionDays: 7
        schedule: "0 1 * * *"  # Every day at 1:00 AM
      - type: weekly
        retentionDays: 30
        schedule: "0 2 * * 0"  # Every Sunday at 2:00 AM
    connectionInfo:
      secretName: "mariadb-credentials"
    objectStorage:
      secretName: "s3-credentials"
    extraArgs: "--opt --single-transaction"
    # Volume configuration for temporary storage
    extraVolumes:
      - name: temp-data
        emptyDir:
          sizeLimit: 15Gi
    extraVolumeMounts:
      - name: temp-data
        mountPath: /dumpscript
        readOnly: false

  # MySQL with Azure Blob Storage backend
  - type: mysql
    version: "8.0"
    periodicity:
      - type: daily
        retentionDays: 7
        schedule: "0 3 * * *"  # Every day at 3:00 AM
    connectionInfo:
      host: "mysql.example.com"
      username: "backup_user"
      password: "secret_password"
      database: "app_db"
      port: 3306
    objectStorage:
      backend: "azure"
      azure:
        storageAccount: "mystorageaccount"
        storageKey: "mybase64encodedkey..."
        container: "db-backups"
        prefix: "mysql/production"
    extraArgs: "--single-transaction --routines"

# Slack notifications
notifications:
  slack:
    enabled: true
    webhookUrl: "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK"
    channel: "#backups"
    username: "Dumpscript Bot"
    notifyOnSuccess: false

# Service Account configuration
serviceAccount:
  create: true
  automount: true
  annotations:
    eks.amazonaws.com/role-arn: "arn:aws:iam::123456789012:role/BackupRole"
  name: ""
  namespace: ""

# Pod configuration
podAnnotations: {}
podLabels: {}

# Security context
podSecurityContext: {}
securityContext: {}

# Pod resources and configuration
resources:
  limits:
    cpu: 500m
    memory: 512Mi
  requests:
    cpu: 100m
    memory: 128Mi

# Network and scheduling configuration
nodeSelector: {}
tolerations: []
affinity: {}

MongoDB Configuration

databases:
  - type: mongodb
    periodicity:
      - type: daily
        retentionDays: 7
        schedule: "0 2 * * *"  # Daily at 2:00 AM
    connectionInfo:
      host: "mongo.example.com"
      username: "backup_user"
      password: "secure_password"
      database: "app_db"
      port: 27017
    objectStorage:
      region: "us-east-1"
      bucket: "my-db-backups"
      bucketPrefix: "mongodb/app"
    extraArgs: "--authenticationDatabase=admin"

MongoDB backup notes:

  • Uses mongodump to create a compressed archive (dump_restore.archive.gz).
  • Set extraArgs for cluster URIs (e.g., --uri="mongodb+srv://...").
  • For SCRAM auth, ensure --authenticationDatabase matches your setup (often admin).
  • Grant the backup user read on target DB; cluster-wide backups may require broader roles.

ClickHouse Configuration

ClickHouse is backed up with the engine's native BACKUP ... TO S3() / AzureBlobStorage() statement, sent by the job to the server over the HTTP interface (port 8123, or 8443 with TLS). The server writes a single tar archive straight to the bucket, so the job needs no client binary and no extraVolumes.

databases:
  - type: clickhouse
    periodicity:
      - type: weekly            # full backup (Sunday)
        retentionDays: 42
        schedule: "0 4 * * 0"
      - type: daily             # incremental against the newest weekly (Mon-Sat)
        retentionDays: 35
        schedule: "0 4 * * 1-6"
    connectionInfo:
      # Secret keys: host, username, password, database, port
      # database "" = full instance (databases + users/roles/grants/named collections)
      secretName: dumpscript-clickhouse-credentials
    objectStorage:
      backend: s3
      region: us-central1
      bucket: my-db-backups
      bucketPrefix: clickhouse/all
      secretName: dumpscript-gcs-credentials   # accessKeyId / secretAccessKey (static key or GCS HMAC)
      endpointUrl: https://storage.googleapis.com
    extraArgs: "allow_s3_native_copy=0"      # appended to BACKUP ... SETTINGS
    extraEnv:
      - name: CLICKHOUSE_BASE_BACKUP_PERIODICITY   # incremental: which periodicity holds the full backups
        value: "weekly"
      - name: CLICKHOUSE_CLUSTER              # host is a Service balancing several replicas
        value: "default"
      - name: CLICKHOUSE_ARCHIVE_FORMAT       # tar | tar.gz | tar.zst (default)
        value: "tar.zst"

Incremental backups (image >= v0.0.44): with CLICKHOUSE_BASE_BACKUP_PERIODICITY=weekly the weekly CronJob takes a full backup and the daily one sends SETTINGS base_backup = S3('<newest weekly>'), so each daily archive only carries what changed since the last full. A restore needs at most two archives. Keep the base retention >= incremental retention + one full interval (42 >= 35 + 7 above) and make sure no bucket lifecycle rule expires the base earlier. Without a base archive (first week) the daily run falls back to a full backup with a warning. Omit the variable for full backups only.

Several replicas behind one Service (image >= v0.0.45): system.backups is local to each server, so the status poll can land on a replica other than the one running the BACKUP ... ASYNC and the job fails with "Lost track" even though the backup succeeds. Set CLICKHOUSE_CLUSTER to the cluster name (SELECT DISTINCT cluster FROM system.clusters) to poll every replica via clusterAllReplicas(); it needs GRANT REMOTE ON *.*. Without an interserver secret in remote_servers, the remote replicas run the subquery as the cluster's configured user, which then also needs SELECT ON system.backups.

Server-side requirements:

  • ClickHouse >= 24.3 (tar archives as backup destination).
  • Backup user grants:
    GRANT BACKUP, SHOW ON *.* TO backup;
    GRANT SELECT ON system.backups TO backup;   -- job polls the ASYNC status
    GRANT READ, WRITE ON S3 TO backup;          -- < 25.7: GRANT S3 ON *.*   |  Azure: GRANT AZURE ON *.*
    GRANT REMOTE ON *.* TO backup;              -- only with CLICKHOUSE_CLUSTER (clusterAllReplicas)
    
  • Network egress from the ClickHouse pods to the storage endpoint, and from the dumpscript namespace to the ClickHouse HTTP port (NetworkPolicy).
  • The storage credentials travel inside the BACKUP statement (masked in system.backups/query_log). Temporary AWS credentials (IRSA, AWS_SESSION_TOKEN) are not supported by the S3 backup engine: use a static key / GCS HMAC key, or CLICKHOUSE_USE_SERVER_CREDENTIALS=true to let the server use its own S3 configuration.

Optional variables (via extraEnv): CLICKHOUSE_SECURE, CLICKHOUSE_CA_CERT, CLICKHOUSE_ARCHIVE_FORMAT, CLICKHOUSE_EXCLUDE_DATABASES, CLICKHOUSE_BACKUP_ACCESS_ENTITIES, CLICKHOUSE_BACKUP_TIMEOUT, CLICKHOUSE_BACKUP_POLL_INTERVAL, CLICKHOUSE_CLUSTER, CLICKHOUSE_USE_SERVER_CREDENTIALS — see the dumpscript README.

Restore is manual (any replica): RESTORE DATABASE <db> [AS <new>] FROM S3('<url of the .tar.zst>', '<key>', '<secret>'). From an incremental archive add SETTINGS use_same_s3_credentials_for_base_backup = 1 (the server reads the base recorded in the archive with the same key).

Database Version Support

PostgreSQL Versions

  • 14: PostgreSQL 14.x
  • 15: PostgreSQL 15.x
  • 16: PostgreSQL 16.x (default)
  • 17: PostgreSQL 17.x
  • 18: PostgreSQL 18.x

Version Availability by Alpine Base Image:

  • Alpine 3.20: PostgreSQL versions 14, 15, 16
  • Alpine 3.21: PostgreSQL versions 15, 16, 17
  • Alpine edge (pinned digest): PostgreSQL versions 16, 17, 18

Note: To use PostgreSQL 18, set image.tag to a *-alpine-edge tag (e.g. v0.0.39-alpine-edge). The client version should match your PostgreSQL server version to avoid compatibility issues.

MySQL/MariaDB Versions

  • 5.7: MySQL 5.7
  • 8.0: MySQL 8.0
  • 10.11: MariaDB 10.11 (default)
  • 11.4: MariaDB 11.4

Important: The client version should match your database server version to avoid compatibility issues.

MongoDB Tools

  • MongoDB backups use mongodump/mongorestore from MongoDB Database Tools.
  • Tools are installed at runtime (no version pinning).

ClickHouse

  • No client: native BACKUP executed by the server over HTTP. Server must be >= 24.3.
  • version is informational only (exposed as CLICKHOUSE_VERSION).

Multiple Backup Schedules

Each database can have multiple backup schedules with different retention policies:

databases:
  - type: postgresql
    version: "17"
    periodicity:
      - type: daily
        retentionDays: 7
        schedule: "0 2 * * *"  # Daily at 2:00 AM
      - type: weekly
        retentionDays: 30
        schedule: "0 3 * * 0"  # Weekly on Sunday at 3:00 AM
      - type: monthly
        retentionDays: 365
        schedule: "0 4 1 * *"  # Monthly on 1st at 4:00 AM
      - type: yearly
        retentionDays: 2555  # 7 years
        schedule: "0 5 1 1 *"  # Yearly on January 1st at 5:00 AM

Kubernetes Secrets

Secret for Database Credentials

apiVersion: v1
kind: Secret
metadata:
  name: mysql-credentials
  namespace: default
type: Opaque
data:
  host: bXlzcWwuZXhhbXBsZS5jb20=              # mysql.example.com
  username: YmFja3VwX3VzZXI=                  # backup_user
  password: c3VwZXJfc2VjcmV0X3Bhc3N3b3Jk        # super_secret_password
  database: YXBwX2Ri                          # app_db
  port: MzMwNg==                              # 3306
apiVersion: v1
kind: Secret
metadata:
  name: postgres-credentials
  namespace: default
type: Opaque
data:
  host: cG9zdGdyZXMuZXhhbXBsZS5jb20=          # postgres.example.com
  username: YmFja3VwX3VzZXI=                  # backup_user
  password: c3VwZXJfc2VjcmV0X3Bhc3N3b3Jk        # super_secret_password
  database: YXBwX2Ri                          # app_db
  port: NTQzMg==                              # 5432

Secret for Object Storage Credentials

apiVersion: v1
kind: Secret
metadata:
  name: s3-credentials
  namespace: default
type: Opaque
data:
  region: dXMtd2VzdC0y                        # us-west-2
  bucket: bXktY29tcGFueS1iYWNrdXBz            # my-company-backups
  bucketPrefix: ZGF0YWJhc2UtZHVtcHMv            # database-dumps/
  # Optional: direct credentials (not recommended)
  # accessKeyId: QUtJQUlPU0ZPRE5ON0VYQU1QTEU=
  # secretAccessKey: d0phbExyWGVOdC9LN21ESVkvYk1FeFJZSEs0WUs1TUVRc1pKVHU=

Secret for Production with IAM Role

apiVersion: v1
kind: Secret
metadata:
  name: production-s3-credentials
  namespace: default
type: Opaque
data:
  region: dXMtZWFzdC0x                        # us-east-1
  bucket: cHJvZHVjdGlvbi1kYi1iYWNrdXBz        # production-db-backups
  bucketPrefix: cG9

Deploy dumpscript with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has dumpscript 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 chartdumpscript is pinned at v1.11.0 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