How do people usually backup their self-hosted docker services using postgres? I have been using docker-volume-backup [0] and just saving the postgres data directory, but I've found it requires a minute of downtime to backup properly.[0] https://github.com/offen/docker-volume-backup
poorlyknit|2 years ago
A bit more contrived than copying the volume but you don't need to shut down the server. There's probably some scripts out there for doing this in a structured way but I usually do it more or less manually/use a bash script.
[0]: https://www.postgresql.org/docs/current/app-pgdump.html
jhot|2 years ago
darnir|2 years ago
syntaxing|2 years ago
[1] https://github.com/BretFisher/docker-vackup
efrecon|2 years ago
andix|2 years ago
asmor|2 years ago
docker compose down && docker compose run backup && docker compose up -d
The restore procedure is the same, you restore the composefile through restic on the host and then `docker compose run backup restic restore latest --exclude "/data/self/*" --target /`
I find it's fast enough because restic is incremental, but if you can set this up on a filesystem with snapshots that would be a great option too.
Restic takes a bit of fiddling around too. I mount a prepared ssh config, a known hosts file and a private key.
mastax|2 years ago
antongribok|2 years ago