diff --git a/services/activitylog/pkg/server/debug/server.go b/services/activitylog/pkg/server/debug/server.go index 09218a407b..20a332f786 100644 --- a/services/activitylog/pkg/server/debug/server.go +++ b/services/activitylog/pkg/server/debug/server.go @@ -14,13 +14,15 @@ func Server(opts ...Option) (*http.Server, error) { healthHandler := handlers.NewCheckHandler( handlers.NewCheckHandlerConfiguration(). - WithLogger(options.Logger), + WithLogger(options.Logger). + WithCheck("http reachability", handlers.NewHTTPCheck(options.Config.HTTP.Addr)), ) readyHandler := handlers.NewCheckHandler( handlers.NewCheckHandlerConfiguration(). WithLogger(options.Logger). - WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Events.Cluster)), + WithCheck("nats reachability", handlers.NewNatsCheck(options.Config.Events.Cluster)). + WithInheritedChecksFrom(healthHandler.Conf), ) return debug.NewService( diff --git a/services/web/pkg/server/debug/server.go b/services/web/pkg/server/debug/server.go index f5c6bd5a9b..77810811d1 100644 --- a/services/web/pkg/server/debug/server.go +++ b/services/web/pkg/server/debug/server.go @@ -1,14 +1,10 @@ package debug import ( - "context" - "fmt" - "net" - "net/http" - "github.com/owncloud/ocis/v2/ocis-pkg/handlers" "github.com/owncloud/ocis/v2/ocis-pkg/service/debug" "github.com/owncloud/ocis/v2/ocis-pkg/version" + "net/http" ) // Server initializes the debug service and server. @@ -17,20 +13,7 @@ func Server(opts ...Option) (*http.Server, error) { checkHandler := handlers.NewCheckHandler( handlers.NewCheckHandlerConfiguration(). - WithLogger(options.Logger).WithCheck("web reachability", func(ctx context.Context) error { - conn, err := net.Dial("tcp", options.Config.HTTP.Addr) - defer func(conn net.Conn) { - err := conn.Close() - if err != nil { - return - } - }(conn) - if err != nil { - return fmt.Errorf("could not connect to web server: %v", err) - } - - return nil - }), + WithLogger(options.Logger).WithCheck("web reachability", handlers.NewHTTPCheck(options.Config.HTTP.Addr)), ) return debug.NewService(