From 878d77bd668eda80fe2e525e25b5fbc930fc5f23 Mon Sep 17 00:00:00 2001 From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Date: Fri, 6 Nov 2026 12:37:36 +0100 Subject: [PATCH] fix(database): make the Redis health check ping with the password The check was [CMD-SHELL, redis-cli, ping], so Docker ran only redis-cli and it always passed. redis-cli also exits 0 on NOAUTH and LOADING. The check now pings with the server password and requires PONG. With a custom redis.conf that sets its own requirepass, it requires PONG or NOAUTH. Co-Authored-By: Claude Opus 5.5 --- app/Actions/Database/StartRedis.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.php index 115de5e3ea..a58ec72b46 100644 --- a/app/Actions/Database/StartRedis.php +++ b/app/Actions/Database/StartRedis.php @@ -108,8 +108,7 @@ class StartRedis 'labels' => defaultDatabaseLabels($this->database)->toArray(), 'healthcheck' => $this->database->healthCheckConfiguration([ 'CMD-SHELL', - 'redis-cli', - 'ping', + $this->healthCheckCommand(), ]), 'mem_limit' => $this->database->limits_memory, 'memswap_limit' => $this->database->limits_memory_swap, @@ -340,6 +339,20 @@ class StartRedis return $keepsUnquotedPassword ? $this->resolvedRedisPassword : escapeshellarg($this->resolvedRedisPassword); } + /** + * The healthcheck pings with the server password and requires PONG, because redis-cli exits 0 on + * error replies (NOAUTH, LOADING). A custom redis.conf with its own requirepass has a password that + * Coolify does not know, so that check only requires that the server replies. + */ + private function healthCheckCommand(): string + { + if (str_contains((string) $this->database->redis_conf, 'requirepass')) { + return "redis-cli ping | grep -qE 'PONG|NOAUTH'"; + } + + return 'redis-cli -a '.$this->requirePassArgument().' --no-auth-warning ping | grep -q PONG'; + } + private function add_custom_redis() { if (is_null($this->database->redis_conf) || empty($this->database->redis_conf)) {