EnterpriseOn-premisesBackup and restore

Backup and restore

Configure, manage, and restore PostgreSQL database backups for IBM Bob on-premises to protect application data and support recovery scenarios.

IBM Bob on-premises uses a ConfigMap-based backup configuration model that separates backup operations from the Bob custom resource (CR). Backup jobs are automatically scheduled and managed through Kubernetes CronJobs, with configurable retention policies and storage settings.

PostgreSQL backups create a restorable copy of the IBM Bob and Keycloak databases. These backups can be used to recover data after an outage, migrate data between clusters, or restore a previous known-good database state.

IBM Bob supports both automated scheduled backups and manual backup execution.

Key features

Automated scheduling

Backups are executed automatically using Kubernetes CronJobs. Backup schedules are defined using standard cron expressions, allowing you to configure backup frequency based on operational and recovery requirements.

Automatic retention management

Backup retention is managed automatically to help control storage consumption. After each successful backup, older backups that exceed the configured retention limit are removed. By default, the system retains the seven most recent backups per cluster.

Multi-cluster backup support

A single backup configuration can manage backups for multiple PostgreSQL clusters. The operator creates and maintains dedicated backup resources for each configured cluster, enabling centralized backup management across the deployment.

PostgreSQL image auto-detection

The backup system can automatically detect and use the PostgreSQL container image from running database clusters. This eliminates the need to manually specify the image version and helps ensure compatibility between backup jobs and the target database environment.

ConfigMap-based configuration

Backup settings are stored in a dedicated ConfigMap, separate from the Bob custom resource (CR). This separation simplifies operational management and allows backup schedules, storage settings, and retention policies to be modified independently of the application deployment configuration.

Automatic compression

Database dumps are automatically compressed using gzip before being stored. Compression reduces storage requirements and helps optimize backup retention within the available storage capacity.

Backup metadata tracking

Each backup includes a metadata file containing details such as the backup timestamp, database name, host, port, and backup size. This information helps you validate backup integrity, track backup history, and identify the correct backup for restoration.

What is included in a backup

Database backups capture all PostgreSQL database objects and data required to reconstruct a database environment.

Backups include:

  • PostgreSQL databases (if configured):
    • Bob database (bob) — the primary application database, including user accounts and authentication information, projects and conversations, code analysis results, and application-specific configuration and settings.
    • Keycloak database (app) — the Keycloak database used for authentication and identity management, including user credentials and profile information, OAuth and OpenID Connect (OIDC) configurations, realm settings, and client and identity provider configurations.
  • Database schema — all objects required to recreate the database structure, including tables, indexes, and constraints; stored procedures and functions; views and triggers; and sequences and custom types.
  • Database data — the backup process uses pg_dump to create a complete PostgreSQL database dump, capturing all data stored in database tables, all rows and records, and binary large objects (BLOBs) if present.

What is not included in a backup

PostgreSQL backups do not capture Kubernetes resources or application configuration.

The following items must be managed separately:

  • ConfigMaps
  • Secrets
  • Deployments and Services
  • Ingress resources
  • Application logs
  • Model data and embeddings
  • Non-database persistent volumes

Backup architecture

IBM Bob uses Kubernetes-native resources to create and manage database backups.

ComponentPurpose
Bob custom resourceEnables or suspends backup operations
Backup ConfigMapDefines schedules, storage, retention, and target databases
CronJobsExecute scheduled backups
Persistent volume claimsStore backup files
Backup scriptsCreate backups and manage retention

The backup process follows this workflow:

Bob CR (enabled: true) → ConfigMap Discovery → Controller Reconciliation → CronJob Execution
  1. The controller discovers the ConfigMap with the bob.ibm.com/backup-config: "true" label.
  2. The controller creates CronJobs and PVCs for each configured cluster.
  3. CronJobs execute on schedule, running pg_dump to create compressed SQL dumps.
  4. The backup script manages retention, automatically deleting old backups.
  5. Each backup includes a metadata file with timestamp, size, and database info.

When backups are enabled, the operator automatically discovers the backup configuration, creates the required resources, and schedules backup jobs according to the configured frequency.

Backup file structure

Backup files are stored on dedicated persistent volume claims (PVCs). Each configured PostgreSQL cluster has its own directory containing the backup files and associated metadata.

/backups/
├── bob-db/
│   ├── backup_bob_20260902_020000.sql.gz
│   └── backup_bob_20260902_020000.sql.gz.meta
└── bob-keycloak-db/
    ├── backup_app_20260902_020000.sql.gz
    └── backup_app_20260902_020000.sql.gz.meta

The backup process generates the following files for each backup:

  • .sql.gz — compressed SQL dump (plain text format, gzip compressed)
  • .sql.gz.meta — metadata file with timestamp, database name, size, host, and port

Recovery capabilities

IBM Bob supports multiple recovery scenarios to help you restore data, recover from failures, and migrate databases between environments:

  • Full database restore — restore an entire PostgreSQL database from a backup file.
  • Point-in-time recovery — restore a database to a specific backup instance by selecting the required backup file based on its timestamp.
  • Cross-cluster migration — restore a backup to a different PostgreSQL cluster, enabling database migration between environments.
How is this topic?