Backups

This explains the basics about how backups work with the Drupal Operator. For more advanced details, see the advanced section on Importing DB & files, and backups.

Note

To make backup of files, using the operator, you need to use a volume type of ReadWriteMany. If you can not use that kind of a volume, we recommend you use Velero or a sidecar to do the backups.

What gets backed up?

There are two main things you usually want to back up:

  1. Database – all Drupal content, configuration, and users.
  2. Files – uploaded files, public assets, and other content stored on disk.

The Drupal Operator can:

  • Run automatic backups on a schedule (CronJobs).
  • Import an existing DB dump or files archive when setting up a site.

This page focuses on automatic backups.

Enabling automatic backups

In the spec of your Drupal resource, you can enable:

  • Database backups: backup_db: true
  • Files backups: backup_files: true

Example:

apiVersion: ozzi.io/v1alpha2
kind: Drupal
metadata:
  name: example-drupal
  namespace: drupal-demo
spec:
  # ... other settings ...
  backup_db: true
  backup_files: true

When these are enabled, the operator creates Kubernetes CronJobs that run backup jobs on a schedule.

Backup schedules

There are two schedule settings:

  • backup_db_cron_schedule – when to run DB backups Default: "0 3 * * *" (once per day at 03:00)

  • backup_files_cron_schedule – when to run files backups Default: "0 5 * * *" (once per day at 05:00)

You can change these to any valid cron expression. For example, to run DB backups every 6 hours:

spec:
  backup_db: true
  backup_db_cron_schedule: "0 */6 * * *"

Where do backups go?

The exact backup destination is defined in the job templates and usually depends on:

  • A Kubernetes Secret with backup credentials:
  • drupal_backup_secret (default name: backup-secret)
  • Environment variables or scripts that send the backup to:
  • S3-compatible storage
  • Object storage
  • Another backup system

In other words:

  • The operator schedules and runs the backup jobs.
  • The job containers/scripts decide where and how the backup is stored.

Ask your platform team or check your cluster’s templates to see:

  • Which bucket or storage service is used.
  • How long backups are kept.

Checking backup CronJobs

After you enable backups and apply your Drupal resource, list CronJobs:

kubectl get cronjobs -n drupal-demo

You should see (names will include your Drupal site name):

  • <name>-auto-db-backup
  • <name>-auto-files-backup

To see when they last ran and if they succeeded:

kubectl describe cronjob <name>-auto-db-backup -n drupal-demo
kubectl get jobs -n drupal-demo

Basic recommendations

  • Enable both DB and files backups for any important site.
  • Verify that backups are actually stored in your backup system and can be restored (test restore in a separate environment).
  • Coordinate with your platform/ops team so backup destinations, retention policies, and credentials are managed securely.

For information on how imports and backups work internally, see: