Manage backup retention¶
Charmed PostgreSQL backups can be managed via a retention policy. This retention can be set by the user in the form of a configuration parameter in the charm s3-integrator via the config option experimental-delete-older-than-days .
This guide will teach you how to set this configuration and how it works in managing existing backups.
Caution
This is an experimental parameter; use it with caution.
Configure S3-integrator charm¶
Deploy and run the s3-integrator charm:
juju deploy s3-integrator
juju run s3-integrator/leader sync-s3-credentials access-key=<access-key-here> secret-key=<secret-key-here>
Then, use juju config to add the desired retention time in days:
juju config s3-integrator experimental-delete-older-than-days=<number-of-days>
To pass these configurations to a Charmed PostgreSQL application, integrate the two applications:
juju integrate s3-integrator postgresql
juju integrate s3-integrator postgresql-k8s
To remove this option at any time, the configuration can be erased from the charm:
juju config s3-integrator --reset experimental-delete-older-than-days
This configuration will be enforced in every Charmed PostgreSQL application that is related to the configured S3-integrator charm
Backups older than retention time will only expire once a newer backup is created
The retention is not enforced automatically once a backup is older than the set amount of days. This behaviour prevents complete backup deletion if there has been no newer backups created in the charm.
See the s3-integrator charm on Charmhub for a list of all its configuration parameters.