33 lines
1.3 KiB
PHP
33 lines
1.3 KiB
PHP
<?php
|
|
header("Content-Type: application/json");
|
|
|
|
// Check nginx location /api/sovereign/
|
|
$nginx_sov = @shell_exec("grep -A 15 'location /api/sovereign' /etc/nginx/sites-available/*.conf /etc/nginx/sites-enabled/*.conf 2>/dev/null | head -30");
|
|
|
|
// Check cascade service
|
|
$svc = @shell_exec("systemctl status weval-sovereign-cascade 2>&1 | head -15");
|
|
|
|
// Test both HTTPS and direct with timing
|
|
$t0 = microtime(true);
|
|
$direct = @file_get_contents("http://127.0.0.1:4000/v1/chat/completions", false, stream_context_create([
|
|
"http"=>["method"=>"POST","header"=>"Content-Type: application/json\r\n",
|
|
"content"=>json_encode(["model"=>"fast","messages"=>[["role"=>"user","content"=>"hi"]],"max_tokens"=>10]),
|
|
"timeout"=>10]
|
|
]));
|
|
$direct_ms = round((microtime(true)-$t0)*1000);
|
|
|
|
// Check recent nginx errors
|
|
$nginx_err = @shell_exec("tail -30 /var/log/nginx/error.log 2>/dev/null | grep -iE 'sovereign|503|upstream' | head -10");
|
|
|
|
// FPM status
|
|
$fpm = @shell_exec("systemctl is-active php8.4-fpm 2>&1");
|
|
|
|
echo json_encode([
|
|
"nginx_sovereign_config" => trim($nginx_sov),
|
|
"cascade_service" => trim($svc),
|
|
"direct_cascade_ms" => $direct_ms,
|
|
"direct_test_ok" => $direct ? "OK: " . substr($direct, 0, 100) : "FAIL",
|
|
"nginx_errors" => trim($nginx_err),
|
|
"fpm_status" => trim($fpm),
|
|
], JSON_PRETTY_PRINT);
|