Dockerized local and offline backing up of PostgreSQL with rotation, compression
github.com
github.com
[1] https://www.postgresql.org/docs/current/continuous-archiving...
I just had a quick skim of those docs, looks like lots of paragraphs going over all of all the things that can go wrong and how to prevent them. Good. If it takes a week to read all that and set up then it takes a week. I'll take a pass on the "docker container that just does it for me" thanks.
I've not read that page from end to end, only scanned through it, but it seems perfectly good for covering the concept, with one caveat that it might not include a detail I'd put in there. Unless I missed it in my scan the page may be missing a point that seems obvious but relatively green admins might miss until they run it of backup space (or start getting larger bills for the auto-growing cloud storage they are backing up to!): your WAL based backups will grow infinitely, and restore time will grow likewise, if you don't occasionally restart your backup sequence with a fresh full backup.
It is, yes. It does contain a lot of information, but the fact that it's one big wall of text makes my ADHD go do something else. Even a table of contents, or some better-structured headlines would help.
I just finished a setup where I run PostgreSQL as a quadlet on CoreOS, and in order to manage backups I use systemd Require so the postgres container depends on a pgbackrest container that just runs a relatively simple script to check if storage is empty or not, and restores the backup from S3 if storage is empty.
And another container runs as a oneshot timer that takes full and incremental backups to S3.
Instead of this [1] I use a much simpler while ! pg_isready loop.
1. https://gist.github.com/efrecon/86456960e2110b287632fd7f42c1...
An immutable OS like CoreOS for example isn't much different than a regular distro. You can still do a lot of manual work on it if you want. I try to avoid doing manual work on it because I want to be strict IaC, but I can for example test doing a major release upgrade in staging, manually over SSH, and work out the kinks, before I put it into practice using containers and scripts in production.
Though I see very little reason to automate the hell out of a major release upgrade, better do it safely and slowly with SOP's.
I use pg_isready. Unfortunately I won't link my project because I try to keep this HN account separate from my true identity.
It does everything, uses pg_dump under the hood, and adds the output as files for Borg.
Borg then takes care of encryption, incremental and also bit rot. Best solution ever in my book.
Also you can directly restore the db with Borgmatic.
https://torsion.org/borgmatic/docs/how-to/backup-your-databa...