Make nginx healthcheck deterministic (was flapping to unhealthy)
All checks were successful
Build and Push Docker Images / build-and-push (push) Successful in 8s

BusyBox wget --spider on nginx:alpine flaps and 'localhost' may resolve
to IPv6 first, marking the container unhealthy while it serves fine.
Use an explicit 127.0.0.1 fetch-and-discard with more retries.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
dlawler489 2026-06-20 08:24:14 +10:00
parent 46ae6ff5fe
commit f0ee1289e1

View file

@ -18,12 +18,15 @@ services:
networks:
- etsy-network
- traefik_default
# Use an explicit IPv4 fetch-and-discard; BusyBox wget --spider flaps on
# nginx:alpine and 'localhost' can resolve to IPv6 first, causing false
# "unhealthy" even though nginx is serving fine.
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost/"]
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1/ || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
retries: 5
start_period: 20s
# Etsy Finance Tracker API Server (from GitHub Container Registry)
etsy-tracker: