pellepelster / solidblocks

Solidblocks is a library of reusable components for infrastructure operation, automation and developer experience
https://pellepelster.github.io/solidblocks/
MIT License
25 stars 5 forks source link

Restore a specific backup, not just last one #30

Closed flobaader closed 8 months ago

flobaader commented 8 months ago

Hi there,

I have a question about the backup feature mentioned in the docs. It says we can restore a backup by deleting the data directory. But, how do we see all the backups we have and choose a specific one to restore?

For example, if we make a mistake in the database and then make another backup, we would want to go back to the backup before the mistake, not the very last one. Is there a way to do this right now? If not, could this be something you can add? It would be really helpful.

Thanks for looking into this!

pellepelster commented 8 months ago

You are right, the point-in-time recovery is currently a little bit under-documented.

The docker image with the postgresql instance will react on the environment variable DB_RESTORE_PITR. If this is set it will be used as content for the --target of pgBackrest (https://pgbackrest.org/command.html#command-restore) which will then restore up to this point. You can get infos about available backups from the backup-info.sh within the container (https://pellepelster.github.io/solidblocks/rds/usage/index.html).

You are right this needs to be wired together and better documented in the Hetzner postgres module, I will see what I can do.

pellepelster commented 8 months ago

v0.2.4 now has the option to specify a a time for PITR, see also https://pellepelster.github.io/solidblocks/hetzner/rds/#input%5c_restore%5c_pitr