fix(deployment): improve Redis health check with fallback strategy

Changed health check to try without password first, then with Docker Secret.
This handles both scenarios where password might not be immediately available
or where the Secret read might fail in health check context.

Changes:
- Use CMD-SHELL instead of CMD for shell expansion support
- Try 'redis-cli ping' first (no auth)
- Fallback to authenticated ping if first attempt fails
- Properly quote password from Docker Secret

This is the eleventh cumulative fix for production deployment pipeline.

Related: commit 477fe67 (initial Redis health check fix)
This commit is contained in:
2025-11-04 17:28:54 +01:00
parent 5b958dc6b1
commit b1e3a0025a

View File

@@ -209,7 +209,7 @@ services:
# Stricter health checks # Stricter health checks
healthcheck: healthcheck:
test: ["CMD", "sh", "-c", "redis-cli -a $$(cat /run/secrets/redis_password 2>/dev/null || echo '') ping | grep -q PONG"] test: ["CMD-SHELL", "redis-cli ping | grep -q PONG || redis-cli -a \"$$(cat /run/secrets/redis_password 2>/dev/null)\" ping | grep -q PONG"]
interval: 10s interval: 10s
timeout: 3s timeout: 3s
retries: 5 retries: 5