Add lightweight health check endpoint for load balancers to probe
What does this MR do and why?
This adds a small, fixed HTTP endpoint that just responds {"status":"ok"} when queried. This can be probed by load balancers and other check systems to see if Crafty is alive.
Screenshots or screen recordings
$ curl https://hostname.example.com:8443/api/v2/crafty/check
{"status":"ok"}
How to set up and validate locally
Pure local check
- install Crafty
curl https://hostname.example.com:8443/api/v2/crafty/check- Expect return string
{"status":"ok"}
Load balancer config
This was tested against HAProxy with a similar backend config snippet (minorly edited from the source server):
backend be_crafty_hostname
# testing crafty backend
http-check connect ssl
http-check send meth GET uri /api/v2/crafty/check
http-check expect status 200
http-check expect string '{"status":"ok"}'
default-server ssl check inter 15s check-ssl verify required
server hostname hostname.example.com:8443 ca-file /etc/haproxy/tls-be/hostname-crafty.crt
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
Have you checked this doesn't interfere/conflict/duplicate someone elses work? -
Have you fully tested your changes? -
Have you resolved any lint issues? -
Have you assigned a reviewer? -
Have you applied correct labels?
Edited by Andrew