Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,29 +118,22 @@ services:
labels:
# NOTE: the cron format starts with seconds, instead of minutes. https://pkg.go.dev/github.com/robfig/cron?utm_source=godoc
ofelia.enabled: "true"
# TODO: Update this?
# NOTE: Make sure to align this with the retention policies ./postgres/pgbackrest/pgbackrest.conf
# Incremental Backups every day (At 22:00)
ofelia.job-exec.incr.schedule: "0 0 22 * * *"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing incremental backups to avoid high storage usages, as we can't expire them before 3 months (COLDLINE).

We will still have WAL files for PITR, which will be slow but doable for now.

ofelia.job-exec.incr.command: sh -c "_ENV=${OFELIA_PROJECT_NAME?error} pgbackrest --stanza=main backup --type=incr"
ofelia.job-exec.incr.user: "postgres"
ofelia.job-exec.incr.no-overlap: 1
# Differential backup every week (At 02:30 on Monday)
ofelia.job-exec.diff.schedule: "0 30 2 * * 1"
ofelia.job-exec.diff.command: sh -c "_ENV=${OFELIA_PROJECT_NAME?error} pgbackrest --stanza=main backup --type=diff"
ofelia.job-exec.diff.user: "postgres"
ofelia.job-exec.diff.no-overlap: 1
# XXX: Make sure to align this with the retention policies ./postgres/pgbackrest/pgbackrest.conf
# Full backup every month (At 10:00 on day-of-month 1)
ofelia.job-exec.full.schedule: "0 0 10 1 * *"
ofelia.job-exec.full.command: sh -c "_ENV=${OFELIA_PROJECT_NAME?error} pgbackrest --stanza=main backup --type=full"
ofelia.job-exec.full.user: "postgres"
ofelia.job-exec.full.no-overlap: 1
# Differential backup every week (At 02:30 on Monday)
ofelia.job-exec.diff.schedule: "0 30 2 * * 1"
ofelia.job-exec.diff.command: sh -c "_ENV=${OFELIA_PROJECT_NAME?error} pgbackrest --stanza=main backup --type=diff"
ofelia.job-exec.diff.user: "postgres"
ofelia.job-exec.diff.no-overlap: 1
# Expire every day (At 01:30)
ofelia.job-exec.expire.schedule: "0 30 01 * * *"
ofelia.job-exec.expire.command: sh -c "_ENV=${OFELIA_PROJECT_NAME?error} pgbackrest --stanza=main expire"
ofelia.job-exec.expire.user: "postgres"
ofelia.job-exec.expire.no-overlap: 1
# TODO: validate?
secrets:
- pgbackrest_gc_service_account_key
profiles:
Expand Down
23 changes: 14 additions & 9 deletions postgres/pgbackrest/pgbackrest.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@
pg1-path=/var/lib/postgresql/data/

[global]
# NOTE: Make sure to align this with the backup schedule docker-compose.yaml
# RETENTIONS TODO: UPDATE THIS?
# Keep 4 last full backups
repo1-retention-full=4
# Keep 6 differential backups after the last full backup
repo1-retention-diff=6
# Keep 7 days of WAL archives using incremental archive retention
repo1-retention-archive-type=incr
repo1-retention-archive=7
repo1-block=y
repo1-bundle=y

# XXX: Make sure to align this with the backup schedule docker-compose.yaml

# Keep it for 4 months
repo1-retention-full-type=time
repo1-retention-full=120

# Keep 4 * 3 diff backups (3 months as retain by COLDLINE)
repo1-retention-diff=12

delta=y
start-fast=y

# Performance tuning
process-max=4
Expand Down