Add /api/health endpoint where applicable

This commit is contained in:
Till Faelligen 2020-10-03 15:24:37 +02:00
parent 1f686c07b2
commit 924db7c341
8 changed files with 18 additions and 0 deletions

View file

@ -29,6 +29,7 @@ func main() {
intAPI := appservice.NewInternalAPI(base, userAPI, rsAPI)
appservice.AddInternalRoutes(base.InternalAPIMux, intAPI)
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.AppServiceAPI.Database)
base.SetupAndServeHTTP(
base.Cfg.AppServiceAPI.InternalAPI.Listen,

View file

@ -28,6 +28,7 @@ func main() {
intAPI.SetUserAPI(base.UserAPIClient())
keyserver.AddInternalRoutes(base.InternalAPIMux, intAPI)
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.KeyServer.Database)
base.SetupAndServeHTTP(
base.Cfg.KeyServer.InternalAPI.Listen,

View file

@ -28,6 +28,7 @@ func main() {
client := base.CreateClient()
mediaapi.AddPublicRoutes(base.PublicMediaAPIMux, &base.Cfg.MediaAPI, userAPI, client)
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.MediaAPI.Database)
base.SetupAndServeHTTP(
base.Cfg.MediaAPI.InternalAPI.Listen,

View file

@ -145,6 +145,17 @@ func main() {
base.PublicMediaAPIMux,
)
setup.AddHealthCheck(base.InternalAPIMux,
base.Cfg.AppServiceAPI.Database,
base.Cfg.FederationSender.Database,
base.Cfg.KeyServer.Database,
base.Cfg.MediaAPI.Database,
base.Cfg.ServerKeyAPI.Database,
base.Cfg.SyncAPI.Database,
base.Cfg.UserAPI.AccountDatabase,
base.Cfg.UserAPI.DeviceDatabase,
)
// Expose the matrix APIs directly rather than putting them under a /api path.
go func() {
base.SetupAndServeHTTP(

View file

@ -31,6 +31,7 @@ func main() {
rsAPI := roomserver.NewInternalAPI(base, keyRing)
rsAPI.SetFederationSenderAPI(fsAPI)
roomserver.AddInternalRoutes(base.InternalAPIMux, rsAPI)
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.RoomServer.Database)
base.SetupAndServeHTTP(
base.Cfg.RoomServer.InternalAPI.Listen,

View file

@ -28,6 +28,7 @@ func main() {
intAPI := serverkeyapi.NewInternalAPI(&base.Cfg.ServerKeyAPI, federation, base.Caches)
serverkeyapi.AddInternalRoutes(base.InternalAPIMux, intAPI, base.Caches)
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.ServerKeyAPI.Database)
base.SetupAndServeHTTP(
base.Cfg.ServerKeyAPI.InternalAPI.Listen,

View file

@ -34,6 +34,7 @@ func main() {
base.KeyServerHTTPClient(),
federation, &cfg.SyncAPI,
)
setup.AddHealthCheck(base.InternalAPIMux, base.Cfg.SyncAPI.Database)
base.SetupAndServeHTTP(
base.Cfg.SyncAPI.InternalAPI.Listen,

View file

@ -29,6 +29,7 @@ func main() {
userAPI := userapi.NewInternalAPI(accountDB, &cfg.UserAPI, cfg.Derived.ApplicationServices, base.KeyServerHTTPClient())
userapi.AddInternalRoutes(base.InternalAPIMux, userAPI)
setup.AddHealthCheck(base.InternalAPIMux, cfg.UserAPI.AccountDatabase, cfg.UserAPI.DeviceDatabase)
base.SetupAndServeHTTP(
base.Cfg.UserAPI.InternalAPI.Listen,