flexready
About#
A common occurence when writing services is the need to determine the health of some or all of the attached resources your service might be using.
Using flexready this can be done easily by configuring an endpoint to serve the result of a set of a CheckerFunc functions which you provide.
Install#
go get github.com/go-flexible/flexreadyConfiguration#
The readiness server can be configured through the environment to match setup in the infrastructure.
FLEX_READYSRV_ADDRdefault:0.0.0.0:3674FLEX_READYSRV_LIVENESS_PATHdefault:/liveFLEX_READYSRV_READINESS_PATHdefault:/ready
Example#
// Prepare your readyserver.readysrv := flexready.New(flexready.Checks{ "redis": func() error { return redisCheck(nil) }, "cockroachdb": func() error { return cockroachCheck(nil) },}, flexready.WithAddress(":9999"))
// Run it, or better yet, let `flex` run it for you!_ = readysrv.Run(context.Background())
// Liveness endpoint: http://localhost:9999/live// Readiness endpoint: http://localhost:9999/ready