Skip to content

Commit 8149af1

Browse files
committed
fix
1 parent 67b457d commit 8149af1

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,6 @@ ENV GITEA_CUSTOM=/data/gitea
7676

7777
VOLUME ["/data"]
7878

79+
# HINT: HEALTH-CHECK-ENDPOINT: don't use HEALTHCHECK, search this hint keyword for more information
7980
ENTRYPOINT ["/usr/bin/entrypoint"]
8081
CMD ["/usr/bin/s6-svscan", "/etc/s6"]

Dockerfile.rootless

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,6 @@ ENV HOME="/var/lib/gitea/git"
7777
VOLUME ["/var/lib/gitea", "/etc/gitea"]
7878
WORKDIR /var/lib/gitea
7979

80+
# HINT: HEALTH-CHECK-ENDPOINT: don't use HEALTHCHECK, search this hint keyword for more information
8081
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/usr/local/bin/docker-entrypoint.sh"]
8182
CMD []

routers/web/healthcheck/check.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ type componentStatus struct {
6464
}
6565

6666
// Check is the health check API handler
67+
//
68+
// HINT: HEALTH-CHECK-ENDPOINT: there is no clear definition about what "health" means.
69+
// In most cases, end users don't need to check such endpoint, because even if database is down,
70+
// Gitea will reover after database is up again. Sysop should monitor database and cache status directly.
71+
//
72+
// And keep in mind: this health check should NEVER be used as a "restart" trigger, for exmaple: Docker's "HEALTHCHECK".
73+
// * If Gitea is upgrading and migrating database, there will be a long time before this endpoint starts to return "pass" status.
74+
// In this case, if the checker restarts Gitea just because it doesn't get "pass" status in short time,
75+
// the instance will just be restarted again and again before the migation finsihes and the sitution just goes worse.
6776
func Check(w http.ResponseWriter, r *http.Request) {
6877
rsp := response{
6978
Status: pass,

0 commit comments

Comments
 (0)