etienne-napoleone / goutte

💧 DigitalOcean snapshot automation
GNU General Public License v3.0
24 stars 1 forks source link

Enable more complex retention policies #16

Open MrMarlin opened 4 years ago

MrMarlin commented 4 years ago

It would be nice, to be able to set multiple retention "scope" like, keep:

etienne-napoleone commented 4 years ago

That could be nice to add indeed! As a workaround for now it is possible to achieve this by having multiple config files and running the goutte once per config.

MrMarlin commented 4 years ago

This was my first idea. But wouldn't my weekly config with retention=4 prune some of my weekly snapshots with retention=7, since there is no differentiation in the prefixes?

etienne-napoleone commented 4 years ago

Ah yes you're right, sorry it's been a while! I will see to refactor goutte to accept something like:

[droplets]
default_retention = 5

  [[droplets.by_name]]
  name = "server01"
  retention = 3

  [[droplets.by_name]]
  name = "server02"

  [[droplets.by_tag]]
  tag = "prod"
  retention = 20

[volumes]

  [[volumes.by_name]]
  # ...
MrMarlin commented 4 years ago

Oh I see I have described my idea a bit vaguely. I didn't mean different retentions for different volumens/droplets (this is also a really nice feature to have), but to have gaps between retentions of the same item.

For example I have a volume my_volume. For this volume I want multiple snapshots within the following timeframe:

So if I want to store a 10 month old snapshot, I don't have to keep 200 snapshots. At full retention this would only store 21 Snapshots (7+3+11)

Does that explanation make the idea a bit clearer? It's kinda hard to describe.

etienne-napoleone commented 4 years ago

Ah yes I see, totally makes sense!

One simple way to do it in conjuction with my change proposed above would be to update the snapshot naming to something like goutte-{??}-{droplet}-{date}-{hash}. ??? could be either the name of the config file or a name parameter from the config.

That would let you run:


Another way would be to completly change the internal logic, and define it in a cron style and jobs should check existing snapshots, compare it to the actual time and decide if it should start a snapshot. But that seems clunky as it's not a constantly running software.

MrMarlin commented 4 years ago

A yeah I see. So your first suggestion would work like a charm. Would really appreciate, if it was implemented. Thank you!

etienne-napoleone commented 3 years ago

Will be reworked in a new version 2