hcloud-snapshot-as-backup
hcloud-snapshot-as-backup copied to clipboard
[Feature] More flexible schedule with rotate-backups
Request
Currently it's only possible to use a cron schedule for defining when snapshots are created. This is nice until you realise that you may require a more complex schedule.
As an example, I would also like to keep X
weekly snapshots, keep Y
monthly snapshots and Z
yearly snapshots (ofcourse without manual intervention).
Possible implementation
Something that can be used to create a more flexible schedule is rotate-backups. This works quite well for things like database backups, so I assume it can be used for this as well.
@ToshY Although this may come too late: I had similar requirements and ended up writing my own script. It can be found here: https://github.com/undecaf/hetzner-snap-and-rotate
Maybe it can help!
Hey @undecaf 👋
It's never too late. I will check it out. Thanks for letting me know.
As an example, I would also like to keep
X
weekly snapshots, keepY
monthly snapshots andZ
yearly snapshots (ofcourse without manual intervention).
This is already possible with the script by using custom labels and starting the container multiple times. For example, I have one container running for daily backups, one for weekly and one for monthly. With the custom label and cron, the containers only take care of their snapshots and create snapshots exactly as you described.