fix(deployment): complete Redis health check fix - update entrypoint script variable syntax
Previous fix (5f7ebd9) only updated health check line but missed entrypoint script. The entrypoint script was still using $$REDIS_PASSWORD (Docker Compose escaping) instead of $REDIS_PASSWORD (shell variable syntax). Changes: - Line 180: export REDIS_PASSWORD=$(cat ...) - now uses single $ - Line 182: if [ -n "$REDIS_PASSWORD" ] - now uses single $ - Line 190: --requirepass "$REDIS_PASSWORD" - now uses single $ Technical explanation: The command: block is a multi-line shell script passed to /bin/sh -c. Within this shell script context, we use normal shell variable syntax with single $ for variable references. The export statement makes REDIS_PASSWORD available to both the Redis process and the health check command. This completes the fix for: "container application-redis-1 is unhealthy" Related:5f7ebd9(health check fix),b1e3a00(fallback strategy)
This commit is contained in:
@@ -177,9 +177,9 @@ services:
|
||||
command:
|
||||
- |
|
||||
# Read password from Docker Secret (as root) and export for health check
|
||||
export REDIS_PASSWORD=$$(cat /run/secrets/redis_password 2>/dev/null || echo '')
|
||||
export REDIS_PASSWORD=$(cat /run/secrets/redis_password 2>/dev/null || echo '')
|
||||
# Start Redis with all settings as command line arguments (no config file to avoid conflicts)
|
||||
if [ -n "$$REDIS_PASSWORD" ]; then
|
||||
if [ -n "$REDIS_PASSWORD" ]; then
|
||||
exec redis-server \
|
||||
--bind 0.0.0.0 \
|
||||
--dir /data \
|
||||
@@ -187,7 +187,7 @@ services:
|
||||
--save 300 10 \
|
||||
--save 60 10000 \
|
||||
--appendonly yes \
|
||||
--requirepass "$$REDIS_PASSWORD"
|
||||
--requirepass "$REDIS_PASSWORD"
|
||||
else
|
||||
exec redis-server \
|
||||
--bind 0.0.0.0 \
|
||||
|
||||
Reference in New Issue
Block a user