nautical-backup icon indicating copy to clipboard operation
nautical-backup copied to clipboard

(Enhancement) Add built-in retention for backups

Open StanMar-bit opened this issue 10 months ago • 5 comments

Hi @Minituff,

First off, thank you for your fantastic work on Nautical—it’s an awesome tool and I use it for backing up my entire stack!

I have a feature suggestion that I believe could benefit many users: an option to automatically delete older backups created by Nautical. This cleanup mechanism would help manage disk space and prevent the accumulation of outdated backups. I propose that this feature be configurable via an environment variable, allowing users to set their preferred retention policy.

Although I'm still gaining experience with Python, I'd be happy to contribute to this feature's development and learn along the way. Please let me know if this aligns with your vision for Nautical or if you have any thoughts on the approach.

Thanks again for all your hard work on this awesome project!

StanMar-bit avatar Feb 08 '25 21:02 StanMar-bit

Hey, yeah I've thought about this a little before.

There are a few things to consider:

  • Nautical allows you to customize your backup folder format, so this may make it difficult to find old folders due to this .

  • Also what happens if you change the folder format when you have backups already? Nautical might night be able to see them?

  • Maybe we can use some type of database to store the folder names and the dates?

Minituff avatar Feb 08 '25 21:02 Minituff

Thanks for your prompt response! Oh that's cool to hear, that you were thinking about it as well :)

  • Oh yeah that could be an issue.. Maybe we could somehow extract the current backup folder format from the environment variable? Or where you thinking of a situation when the backup folder format is changed in between backups?

  • This is also tricky, but maybe also then an issue for the admin, isn't it kind of expected when changing directory configuration, that the auto built-in retention might not work anymore? To maybe prevent the implementation of the feature getting too complicated? But it would be cool if it's fully foolproofed.

  • That's a good idea. Maybe some kind of history file with the dates and paths of the backups, kind of like a db but seems less complicated to me haha. But maybe a db is more practical and standardized.

StanMar-bit avatar Feb 08 '25 23:02 StanMar-bit

Hey @StanMar-bit, I saw you created a fork and are working on the retention.

How is that going? I'd love to get it incorporated it's working well. Do you need any help?

Minituff avatar Mar 07 '25 21:03 Minituff

Hey @StanMar-bit, I saw you created a fork and are working on the retention.

How is that going? I'd love to get it incorporated it's working well. Do you need any help?

Hey @Minituff , yeah, I gave it a shot! I tried adding a new script, but I ran into dependency errors when running the forked dev Docker image, which prevented me from properly testing the solution. I also tinkered with the image’s dependencies a bit, but those commits can probably be ignored, haha.

I don’t have much experience working with custom Docker images, so that might have contributed to the issue. Plus, most of the code was written with ChatGPT’s help, so I’m not sure about the quality.

I ended up putting my efforts on developing the feature on hold until I have time to figure out why I was getting these errors.

But I’d definitely appreciate any help with developing the retention feature!

By the way, I really love the app—it kind of saved my ass tonight, haha. I was tinkering with the configuration of my homelab’s SSO and messed things up, but luckily, the backups helped me restore my config

StanMar-bit avatar Mar 07 '25 22:03 StanMar-bit

Hey @StanMar-bit, I saw you created a fork and are working on the retention.

How is that going? I'd love to get it incorporated it's working well. Do you need any help?

Hey @Minituff , yeah, I gave it a shot! I tried adding a new script, but I ran into dependency errors when running the forked dev Docker image, which prevented me from properly testing the solution. I also tinkered with the image’s dependencies a bit, but those commits can probably be ignored, haha.

I don’t have much experience working with custom Docker images, so that might have contributed to the issue. Plus, most of the code was written with ChatGPT’s help, so I’m not sure about the quality.

I ended up putting my efforts on developing the feature on hold until I have time to figure out why I was getting these errors.

But I’d definitely appreciate any help with developing the retention feature!

By the way, I really love the app—it kind of saved my ass tonight, haha. I was tinkering with the configuration of my homelab’s SSO and messed things up, but luckily, the backups helped me restore my config

Oh, I just realized I never actually pushed the commits where I tinkered with the dependencies to the fork. So those changes shouldn’t be an issue after all.

StanMar-bit avatar Mar 07 '25 23:03 StanMar-bit

Just started using nautical-backup and it's awesome so far! A retention policy is the only thing that really feels missing, adding that would make nautical-backup pretty much perfect for my needs.

Might this still be in the works? Seems like this thread has stalled out. I can certainly write a post exec script to handle this for my specific setup but a first-class feature would be fantastic.

globalnamespace avatar Nov 17 '25 19:11 globalnamespace