From c8da217e875c2371a8d1d13a678e2a811d906922 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 11 Sep 2025 09:43:28 +0200 Subject: Docker healthcheck (#7945) * Docker healthcheck fix https://github.com/FreshRSS/FreshRSS/issues/7377 * Use echo for non-CLI error * curl_close is deprecated * Connection: close * Update cli/health.php Co-authored-by: Frans de Jonge --------- Co-authored-by: Frans de Jonge --- cli/health.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 cli/health.php (limited to 'cli/health.php') diff --git a/cli/health.php b/cli/health.php new file mode 100755 index 000000000..a001f43aa --- /dev/null +++ b/cli/health.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php + is_numeric($options['connect_timeout'] ?? null) ? (int)$options['connect_timeout'] : 3, + CURLOPT_TIMEOUT => is_numeric($options['timeout'] ?? null) ? (int)$options['timeout'] : 5, + CURLOPT_ENCODING => '', //Enable all encodings + CURLOPT_HTTPHEADER => [ + 'Connection: close', + ], + CURLOPT_RETURNTRANSFER => true, +]); +$content = curl_exec($ch); +$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + +if ($httpCode !== 200 || !is_string($content) || !str_contains($content, 'jsonVars') || !str_contains($content, '')) { + die(1); +} -- cgit v1.2.3