From b7b42e832ad711ebb5af5c03e1c8e8a471c6bde0 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 25 Mar 2024 18:05:14 +0100 Subject: [feature] Add healthcheck endpoints `/livez` and `/readyz` (#2783) * [feature] Add healthcheck endpoints `/livez` and `/readyz` * use select that returns no data --- cmd/gotosocial/action/server/server.go | 2 ++ cmd/gotosocial/action/testrig/testrig.go | 2 ++ 2 files changed, 4 insertions(+) (limited to 'cmd') diff --git a/cmd/gotosocial/action/server/server.go b/cmd/gotosocial/action/server/server.go index 420264e97..1886cd885 100644 --- a/cmd/gotosocial/action/server/server.go +++ b/cmd/gotosocial/action/server/server.go @@ -309,6 +309,7 @@ var Start action.GTSAction = func(ctx context.Context) error { authModule = api.NewAuth(dbService, processor, idp, routerSession, sessionName) // auth/oauth paths clientModule = api.NewClient(dbService, processor) // api client endpoints metricsModule = api.NewMetrics() // Metrics endpoints + healthModule = api.NewHealth(dbService.Ready) // Health check endpoints fileserverModule = api.NewFileserver(processor) // fileserver endpoints wellKnownModule = api.NewWellKnown(processor) // .well-known endpoints nodeInfoModule = api.NewNodeInfo(processor) // nodeinfo endpoint @@ -340,6 +341,7 @@ var Start action.GTSAction = func(ctx context.Context) error { authModule.Route(router, clLimit, clThrottle, gzip) clientModule.Route(router, clLimit, clThrottle, gzip) metricsModule.Route(router, clLimit, clThrottle, gzip) + healthModule.Route(router, clLimit, clThrottle) fileserverModule.Route(router, fsMainLimit, fsThrottle) fileserverModule.RouteEmojis(router, instanceAccount.ID, fsEmojiLimit, fsThrottle) wellKnownModule.Route(router, gzip, s2sLimit, s2sThrottle) diff --git a/cmd/gotosocial/action/testrig/testrig.go b/cmd/gotosocial/action/testrig/testrig.go index 3401734a0..0769b8878 100644 --- a/cmd/gotosocial/action/testrig/testrig.go +++ b/cmd/gotosocial/action/testrig/testrig.go @@ -224,6 +224,7 @@ var Start action.GTSAction = func(ctx context.Context) error { authModule = api.NewAuth(state.DB, processor, idp, routerSession, sessionName) // auth/oauth paths clientModule = api.NewClient(state.DB, processor) // api client endpoints metricsModule = api.NewMetrics() // Metrics endpoints + healthModule = api.NewHealth(state.DB.Ready) // Health check endpoints fileserverModule = api.NewFileserver(processor) // fileserver endpoints wellKnownModule = api.NewWellKnown(processor) // .well-known endpoints nodeInfoModule = api.NewNodeInfo(processor) // nodeinfo endpoint @@ -235,6 +236,7 @@ var Start action.GTSAction = func(ctx context.Context) error { authModule.Route(router) clientModule.Route(router) metricsModule.Route(router) + healthModule.Route(router) fileserverModule.Route(router) fileserverModule.RouteEmojis(router, instanceAccount.ID) wellKnownModule.Route(router) -- cgit v1.2.3