summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-03-25 18:05:14 +0100
committerLibravatar GitHub <noreply@github.com>2024-03-25 17:05:14 +0000
commitb7b42e832ad711ebb5af5c03e1c8e8a471c6bde0 (patch)
tree2fbc4188fd3104f141abe590ac7b586d73772e74 /cmd
parent[bugfix] Avoid empty public/local timeline queries (#2784) (diff)
downloadgotosocial-b7b42e832ad711ebb5af5c03e1c8e8a471c6bde0.tar.xz
[feature] Add healthcheck endpoints `/livez` and `/readyz` (#2783)
* [feature] Add healthcheck endpoints `/livez` and `/readyz` * use select that returns no data
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gotosocial/action/server/server.go2
-rw-r--r--cmd/gotosocial/action/testrig/testrig.go2
2 files changed, 4 insertions, 0 deletions
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)