CNPG Backups using Barman
Resonate RFID Reader Management
uses Cloudnative Postgres (CNPG), which has
its own documentation on setting up database backups.
CNPG allows you to configure your cluster to automatically upload backups to one of various cloud storage providers, including AWS S3, Google Cloud Storage, and Azure Blob Storage. This can be set up to run at regular intervals, ensuring that you always have a recent backup available.
manifests/base/postgres.yml
(For application data, configuration of readers, etc.)
manifests/base/keycloak.yml
(For user and authentication data)
Add a backup section under the
spec
of the kind: Cluster objects in both files.
Also, create a secret with the relevant credentials for your chosen cloud provider, and reference this secret in the
barmanObjectStore
section of the backup configuration.
Set up a schedule for the backups by creating a
ScheduledBackup
object in those files, similar to the following:
--- # For backing up the application database
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: trifecta-backup
namespace: zebra-reader-management
spec:
cluster: trifecta-postgres
schedule: "0 0 2 * * *" # Daily at 2 AM
--- # For backing up the Keycloak database
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: keycloak-backup
namespace: zebra-reader-management
spec:
cluster: keycloak-db
schedule: "0 0 3 * * *" # Daily at 3 AM
After you have configured it according to your needs, apply the changes by running the install script again, or by applying the manifests directly using:
kubectl apply -k deploy