restic / rest-server

Rest Server is a high performance HTTP server that implements restic's REST backend API.
BSD 2-Clause "Simplified" License
978 stars 143 forks source link

WIP: Add health endpoint #159

Open Enrico204 opened 3 years ago

Enrico204 commented 3 years ago

What is the purpose of this change? What does it change?

This pull request adds an endpoint named /health. It replies with:

This endpoint can be used to monitor the status of a rest-server daemon (for example in k8s / docker)

Was the change discussed in an issue or in the forum before?

Feature was requested and is being discussed here: https://github.com/restic/rest-server/issues/147

Checklist

Enrico204 commented 3 years ago

I added the external library https://github.com/itchio/ox . That library contains wrappers for many Windows syscall. I used some of them to get information about the repository path write permission for current user.

I had to call a Windows API directly, however I already made a pull request to the original library to add that wrapper.

I've tested the code on Windows and Linux.

Do I need to write some tests for this? If so, do you have any suggestion? Testing permissions and free space might be difficult...

SchoolGuy commented 1 month ago

I would like to give this PR a bump. kubelint is complaining about missing readiness probes for rest-server. And while of course workarounds can be found, I find this PR quite appealing as a proper solution.

Edit: As 80% of the work in this PR is done, I am willing to pick it up if the maintainers are signalling to get the functionality merged in the near future. I am in a quite fortunate situation that I could actually do this during my work time as we have a dedicated time budget for learning and OSS contributions.