root: keep last 30 backups

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-11-08 17:46:25 +01:00
parent 99ef94b7aa
commit 9ca15983a2
2 changed files with 11 additions and 2 deletions

View File

@ -383,6 +383,7 @@ DBBACKUP_CONNECTOR_MAPPING = {
"django_prometheus.db.backends.postgresql": "dbbackup.db.postgresql.PgDumpConnector", "django_prometheus.db.backends.postgresql": "dbbackup.db.postgresql.PgDumpConnector",
} }
DBBACKUP_TMP_DIR = gettempdir() if DEBUG else "/tmp" # nosec DBBACKUP_TMP_DIR = gettempdir() if DEBUG else "/tmp" # nosec
DBBACKUP_CLEANUP_KEEP = 30
if CONFIG.y("postgresql.s3_backup.bucket", "") != "": if CONFIG.y("postgresql.s3_backup.bucket", "") != "":
DBBACKUP_STORAGE = "storages.backends.s3boto3.S3Boto3Storage" DBBACKUP_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
DBBACKUP_STORAGE_OPTIONS = { DBBACKUP_STORAGE_OPTIONS = {

View File

@ -29,9 +29,17 @@ Currently, it is only supported to restore backups into the same version they ha
Instead, install the version the backup was taken with, restore the backup and then upgrade. Instead, install the version the backup was taken with, restore the backup and then upgrade.
::: :::
Run this command in your authentik installation directory Run this command in your authentik installation directory.
The filename can be found by either looking into the `./backups` directory or using S3. To see all available backups, run
```
docker-compose run --rm worker listbackups
# Or for kubernetes
kubectl exec -it deployment/authentik-worker -c authentik -- ak listbackups
```
Then, to restore, run
``` ```
docker-compose run --rm worker restore -i default-2020-10-03-115557.psql docker-compose run --rm worker restore -i default-2020-10-03-115557.psql