From d08b6a2143a1acf244e7965c6f82093dc948152e Mon Sep 17 00:00:00 2001 From: Esmael Caliman Filho <¨esmael.filho@dnxbrasil.com¨> Date: Sat, 23 Mar 2024 00:06:28 -0300 Subject: [PATCH 1/3] feat(health): Add path /heath to be able to use with containers in ECS/EKS --- handler/handler.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/handler/handler.go b/handler/handler.go index 01e0faa2..6a886918 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -35,7 +35,10 @@ func (h *Handler) write(w http.ResponseWriter, status int, body []byte) { func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { resp, err := h.ProxyClient.Do(r) - if err != nil { + if r.URL.Path == "/health" { + w.WriteHeader(http.StatusOK) + return + } else if err != nil { errorMsg := "unable to proxy request" log.WithError(err).Error(errorMsg) h.write(w, http.StatusBadGateway, []byte(fmt.Sprintf("%v - %v", errorMsg, err.Error()))) From 52ca8e3de56b6efe33d015c720f765254b55669e Mon Sep 17 00:00:00 2001 From: Esmael Caliman Filho <¨esmael.filho@dnxbrasil.com¨> Date: Sat, 23 Mar 2024 00:20:21 -0300 Subject: [PATCH 2/3] fix(readme): Remove information to access the dashboard because dont work --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 5f21dc1e..64c53a73 100644 --- a/README.md +++ b/README.md @@ -160,8 +160,6 @@ OpenSearch --host host.docker.internal:4443 \ --sign-host eu-west-1.es.amazonaws.com ``` - - Access dashboard via http://localhost:8080/_dashboards/app/home#/tutorial_directory ## Reference From 3c3d8f199d7214d4eb5af77d7257160061a5abec Mon Sep 17 00:00:00 2001 From: Esmael Caliman Filho <¨esmael.filho@dnxbrasil.com¨> Date: Sat, 23 Mar 2024 00:23:31 -0300 Subject: [PATCH 3/3] feat(readme): Add healthcheck session --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 64c53a73..110a4259 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,9 @@ OpenSearch --host host.docker.internal:4443 \ --sign-host eu-west-1.es.amazonaws.com ``` +## Healthcheck + +To use healthcheck on ECS or EKS, simply make a call to `localhost:8080/health` which will return the HTTP Status OK. ## Reference