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 .
This guide will teach you how to set this configuration and how it works in managing existing backups.
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>
Juju 2.9 users
Remember that juju run <action name> becomes juju run-action <action name> --wait for Juju 2.9.
Then, use experimental-delete-older-than-days to configure the desired retention time in days.
This is an experimental parameter; use it with caution.
See experimental-delete-older-than-days for more details.
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
Juju 2.9 users
Remember that juju integrate becomes juju relate for Juju 2.9.
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.