mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-16 07:13:29 +00:00
fix(docker): a boot storm cannot flip the healthcheck to unhealthy
/api/health gives the database two seconds and answers 503 past that. With three retries, a pool saturated for a minute after the start period could mark the container unhealthy and take it out of the proxy's routing. The compose healthcheck and the image's HEALTHCHECK now allow five misses (two and a half minutes) and end wget after four seconds, inside Docker's five, so a stalled request is one clean miss. A test holds both to these bounds and to each other.
This commit is contained in:
1 parent
59c3c38379
commit
d8fcf814b2
4 files changed
+129
-5
No files matched your search
+5
-2
@@ -320,8 +320,11 @@ ENV HOSTNAME="0.0.0.0"
|
||||
|
||||
# Start period: the entrypoint migrates before the server listens, and a
|
||||
# migration waiting out a held lock retries for up to about eight minutes.
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10m --retries=3 \
|
||||
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:3000/api/health || exit 1
|
||||
# Five retries: a pool saturated for a minute during a boot storm makes the
|
||||
# probe's 2 s database check miss once or twice without marking the container
|
||||
# unhealthy (docker-compose.yml explains the numbers).
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10m --retries=5 \
|
||||
CMD wget --no-verbose --tries=1 --timeout=4 --spider http://127.0.0.1:3000/api/health || exit 1
|
||||
|
||||
ENTRYPOINT ["./docker-entrypoint.sh"]
|
||||
CMD ["node", "server.js"]
|
||||
Reference in new issue
Block a user