Add API endpoint and UI button to compact repo#468
Add API endpoint and UI button to compact repo#468Forceu wants to merge 3 commits intoRavinou:feat/compactfrom
Conversation
|
@Ravinou The PR is ready for review now. Please note that I changed the gear icon to a pencil in the repo overview, as I think with two buttons it looks better. In case you prefer the old gear icon, let me know and I will revert it back. |
…, added DISABLE_COMPACT_APPEND_ONLY env, replaced gear with pencil icon
|
Thanks, I will study this later (no more time today :D ). Note that :
We have to manage the competing compacts well. As for the modification date, this will modify the last backup date. After that, it's indicated everywhere that it's a date of last “modification” in borgwarehouse, and compacting is still a manual action. So I don't see any problem with that, I'll add it to the documentation. Finally, I'll have to do some tests with the borgbackup CLI and read their documentation to be sure of the different types of return from this command. It's a big feature. I've created the feat/compact branch. |
I can give that a try. I have never used bats or vitest (and don't have a lot of experience with TS either), but I guess I can look through the existing scripts
I assume during a compacting action, the repository is locked and no other action can be performed. I will test that later on. However it would be nice to have an indication once compaction is done, if an async call was made.
The only problem would be if someone was running a cronjob fairly regularly to compact the repos with the API call. But a note in the documentation should be sufficient I assume. |
|
@Ravinou Are the tests sufficient or shall I change anything? :) |
|
I haven't forgotten you. This summer's vacation, coming up in a few weeks, should help me find some time to move forward. Thank you for your patience 🙏 |
|
Hope you had a good holiday! Is there anything I can do to help with this PR? I'm excited to see it in action and reclaim some much-needed storage space. |
This PR adds a button and an API endpoint to compact a repo and will close #222
The new api endpoint is
POST /api/v1/repositories/[id]/compact. By default the call only initiates compacting and returns 200, if the parameterawaitis set totrue, it will only return after compacting and an additional storage calculation is done.Compacting can be disabled on append-only repos with the env
DISABLE_COMPACT_APPEND_ONLY.One drawback with compacting is however, that after the process is finished, it registers as a change. This means, a notification might not be send, if a future backup is not made and the notification period was exceeded. I think it is the same with borgbase and there is not really a way around it (other than saving the last date before compacting).
No tests or documentation were created / altered in this PR.