diff options
author | ttys3 <41882455+ttys3@users.noreply.github.com> | 2022-05-04 19:56:20 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-04 14:56:20 +0300 |
commit | e933f314268e41477c85e44a255667c02b19f231 (patch) | |
tree | 23a610cffe6e2c5ef01ca677c391f1f8b86fe824 /routers/web/web.go | |
parent | 3114cd30b817692556306ce6261ace2b58c54b76 (diff) | |
download | gitea-e933f314268e41477c85e44a255667c02b19f231.tar.gz gitea-e933f314268e41477c85e44a255667c02b19f231.zip |
Add health check endpoint (#18465)
* chore: add health check endpoint
docs: update document about health check
fix: fix up Sqlite3 ping. current ping will success even if the db file is missing
fix: do not expose privacy information in output field
* refactor: remove HealthChecker struct
* Added `/api/healthz` to install routes.
This was needed for using /api/healthz endpoint in Docker healthchecks,
otherwise, Docker would never become healthy if using healthz endpoint
and users would not be able to complete the installation of Gitea.
* Update modules/cache/cache.go
* fine tune
* Remove unnecessary test code. Now there are 2 routes for installation (and maybe more in future)
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Marcos de Oliveira <marcossantos@furb.br>
Diffstat (limited to 'routers/web/web.go')
-rw-r--r-- | routers/web/web.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/routers/web/web.go b/routers/web/web.go index 22b8e7cdf3..dcaad3d2bd 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -31,6 +31,7 @@ import ( "code.gitea.io/gitea/routers/web/events" "code.gitea.io/gitea/routers/web/explore" "code.gitea.io/gitea/routers/web/feed" + "code.gitea.io/gitea/routers/web/healthcheck" "code.gitea.io/gitea/routers/web/misc" "code.gitea.io/gitea/routers/web/org" "code.gitea.io/gitea/routers/web/repo" @@ -191,6 +192,8 @@ func Routes() *web.Route { rw.WriteHeader(http.StatusOK) }) + routes.Get("/api/healthz", healthcheck.Check) + // Removed: toolbox.Toolboxer middleware will provide debug information which seems unnecessary common = append(common, context.Contexter()) |