enhancement: add readyz and healthz check handler

This commit is contained in:
Florian Schade
2024-10-14 08:39:42 +02:00
committed by Christian Richter
parent c82a7c560e
commit 0671039474
49 changed files with 511 additions and 199 deletions
+9 -3
View File
@@ -14,6 +14,8 @@ import (
"github.com/libregraph/idm/pkg/ldbbolt"
"github.com/libregraph/idm/server"
"github.com/oklog/run"
"github.com/urfave/cli/v2"
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
pkgcrypto "github.com/owncloud/ocis/v2/ocis-pkg/crypto"
"github.com/owncloud/ocis/v2/ocis-pkg/handlers"
@@ -24,7 +26,6 @@ import (
"github.com/owncloud/ocis/v2/services/idm/pkg/config"
"github.com/owncloud/ocis/v2/services/idm/pkg/config/parser"
"github.com/owncloud/ocis/v2/services/idm/pkg/logging"
"github.com/urfave/cli/v2"
)
// Server is the entrypoint for the server command.
@@ -94,6 +95,11 @@ func Server(cfg *config.Config) *cli.Command {
}
{
checkHandler := handlers.NewCheckHandler(
handlers.NewCheckHandlerConfiguration().
WithLogger(logger),
)
server := debug.NewService(
debug.Logger(logger),
debug.Name(cfg.Service.Name),
@@ -102,8 +108,8 @@ func Server(cfg *config.Config) *cli.Command {
debug.Token(cfg.Debug.Token),
debug.Pprof(cfg.Debug.Pprof),
debug.Zpages(cfg.Debug.Zpages),
debug.Health(handlers.Health),
debug.Ready(handlers.Ready),
debug.Health(checkHandler),
debug.Ready(checkHandler),
)
gr.Add(server.ListenAndServe, func(_ error) {