From dd6e999812e87c35f24951208e1b7901c8d30f9a Mon Sep 17 00:00:00 2001 From: ruflin Date: Thu, 14 Nov 2019 09:00:41 +0100 Subject: [PATCH 1/2] Add health endpoint Adding the `/health` endpoint which can be used for Docker / K8s deployment. There are two common calls: * `/health` for liveliness * `/health?ready=true` for a ready check Currently both are implemented the same way as as soon as the service is live, it is also ready. This might change in the future. --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index 6778b50a6..a6b18553e 100644 --- a/main.go +++ b/main.go @@ -104,7 +104,12 @@ func getRouter(config Config, packagesBasePath string) *mux.Router { router.HandleFunc("/search", searchHandler(packagesBasePath, searchCacheTime)) router.HandleFunc("/categories", categoriesHandler(packagesBasePath, categoriesCacheTime)) + router.HandleFunc("/health", healthHandler) router.PathPrefix("/").HandlerFunc(catchAll(config.PublicDir, catchAllCacheTime)) return router } + +// healthHandler is used for Docker/K8s deployments. It returns 200 if the service is live +// In addition ?ready=true can be used for a ready request. Currently both are identical. +func healthHandler(w http.ResponseWriter, r *http.Request) {} From 40317085b15969f60ec9e51508164e1303f48a54 Mon Sep 17 00:00:00 2001 From: ruflin Date: Mon, 18 Nov 2019 08:37:32 +0100 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec56adbfb..14fcb0176 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Add healthcheck to docker file. [#115](https://github.com/elastic/integrations-registry/pull/115) * Make caching headers configurable per endpoint. [#116](https://github.com/elastic/integrations-registry/pull/116) * Add readme entry to package endpoint. [#128](https://github.com/elastic/integrations-registry/pull/128) +* Add `/health` and `/health?ready=1` endpoint for healthcheck. [#151](https://github.com/elastic/integrations-registry/pull/151) ## [0.1.0]