feat: add healthcheck (#141)

* feat: add healtcheck app

Signed-off-by: rare-magma <rare-magma@posteo.eu>

* feat: add healthz endpoint

Signed-off-by: rare-magma <rare-magma@posteo.eu>

* ci: add healthcheck directive to dockerfile

Signed-off-by: rare-magma <rare-magma@posteo.eu>

---------

Signed-off-by: rare-magma <rare-magma@posteo.eu>
This commit is contained in:
Nuno 2024-07-03 20:40:40 +02:00 committed by GitHub
parent e409176642
commit 6a2ce509c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 129 additions and 11 deletions

View file

@ -8,6 +8,9 @@ import (
"os"
"github.com/gin-gonic/gin"
healthcheck "github.com/tavsec/gin-healthcheck"
"github.com/tavsec/gin-healthcheck/checks"
"github.com/tavsec/gin-healthcheck/config"
)
func main() {
@ -83,5 +86,9 @@ func main() {
r.GET("/proxy", routes.GetImage)
soPingCheck := checks.NewPingCheck("https://stackoverflow.com", "GET", 5000, nil, nil)
sePingCheck := checks.NewPingCheck("https://stackexchange.com", "GET", 5000, nil, nil)
healthcheck.New(r, config.DefaultConfig(), []checks.Check{soPingCheck, sePingCheck})
r.Run(fmt.Sprintf("%s:%s", host, port))
}