Added a better Healthcheck logic #19
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Warning: This is just a proof of concept for now! It is not yet prod ready but I wanted to open up a discussion on this and ask people to TEST it. Maybe we could have, next to the Master Branch a Testing/Dev branch for these kind of things?
Hey!
The current health check, respectfully, kinda sucks. It only works in certain scenarios and doesn't really take into account the consent of the network. So I took the basic idea of the current Health check, see if our Relay is Working and if Tor considered it a Tor-Relay.
The Goal for me was to:
The new shiny version of the Health check does the following:
For now the logic is fairly simple. It only checks if the Relay is, consensus wise up and running. As I do not have a Guard Relay i was only able to test the Bare-Minimum myself.
If there are any errors they will be returned within the main function as Code 1, therefore the Health check logic of Docker will interpret this as "unhealthy". If everything runs nicely we get Code 0, and Docker knows that everything is A-Okay :-)
Current Caveats:
Currently I use a very, very insecure authentication method for the Control Port. My Excuse is, that by default I only use this within the Docker Container. The Control Port is bound to localhost (127.0.0.1), so using "password" is an excusable default. The Problem, and reason for this approach is: The Relay saves the Authentication method in the torrc file, hashed as S2K. So for this health check to even run we need to set a default.
But, again, I'm opening this PR because I want to put essentially everything here up for discussion.