mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	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>
This commit is contained in:
		@@ -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())
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user