fix: Valkey health check uses absolute path to valkey-cli
Some checks failed
BotServer CI/CD / build (push) Has been cancelled

- Use BOTSERVER_STACK_PATH/bin/cache/bin/valkey-cli instead of relying on PATH
- Remove bash /dev/tcp fallback (unreliable in restricted environments)
- Falls back to redis-cli and nc if valkey-cli unavailable
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-01 18:11:26 -03:00
parent 68ef554132
commit ba7f1ba5eb

View file

@ -119,7 +119,11 @@ pub fn vault_health_check() -> bool {
/// Check if Valkey/Redis cache is healthy /// Check if Valkey/Redis cache is healthy
pub fn cache_health_check() -> bool { pub fn cache_health_check() -> bool {
if let Ok(output) = SafeCommand::new("valkey-cli") let stack_path =
std::env::var("BOTSERVER_STACK_PATH").unwrap_or_else(|_| "./botserver-stack".to_string());
let valkey_cli = format!("{}/bin/cache/bin/valkey-cli", stack_path);
if let Ok(output) = SafeCommand::new(&valkey_cli)
.and_then(|c| c.args(&["-h", "127.0.0.1", "-p", "6379", "ping"])) .and_then(|c| c.args(&["-h", "127.0.0.1", "-p", "6379", "ping"]))
.and_then(|c| c.execute()) .and_then(|c| c.execute())
{ {
@ -146,28 +150,11 @@ pub fn cache_health_check() -> bool {
match SafeCommand::new("nc") match SafeCommand::new("nc")
.and_then(|c| c.args(&["-z", "-w", "1", "127.0.0.1", "6379"])) .and_then(|c| c.args(&["-z", "-w", "1", "127.0.0.1", "6379"]))
.and_then(|c| c.execute()) .and_then(|c| c.execute())
{
Ok(output) => output.status.success(),
Err(_) => {
match SafeCommand::new("bash")
.and_then(|c| c.arg("-c"))
.and_then(|c| {
c.arg(
"exec 3<>/dev/tcp/127.0.0.1/6379 2>/dev/null && \
echo -e 'PING\r\n' >&3 && \
read -t 1 response <&3 && \
[[ \"$response\" == *PONG* ]] && \
exec 3>&-",
)
})
.and_then(|c| c.execute())
{ {
Ok(output) => output.status.success(), Ok(output) => output.status.success(),
Err(_) => false, Err(_) => false,
} }
} }
}
}
/// Check if Qdrant vector database is healthy /// Check if Qdrant vector database is healthy
pub fn vector_db_health_check() -> bool { pub fn vector_db_health_check() -> bool {