Some checks failed
Autonomous Repo Agent / autonomous-build (push) Has been cancelled
BlackRoad AI Agents / agent-response (push) Has been cancelled
🔍 BlackRoad CodeQL Security Analysis / CodeQL Analysis (javascript) (push) Has been cancelled
🔍 BlackRoad CodeQL Security Analysis / CodeQL Analysis (python) (push) Has been cancelled
CI / Test (push) Has been cancelled
Deploy to Cloudflare Pages / Deploy to Cloudflare Pages (push) Has been cancelled
Trinity Compliance Check / check-compliance (push) Has been cancelled
Synced from BlackRoad-OS-Inc/blackroad-operator/orgs/core/blackroad-os-web BlackRoad OS — Pave Tomorrow. RoadChain-SHA2048: 13032509284e1f6c RoadChain-Identity: alexa@sovereign RoadChain-Full: 13032509284e1f6ca60f7004aa28e90fdc0fdae165e934d79f9ee91ee80caa9c42b57ad6c0ed9c400d303a39716259ad59602b6bc19ba3ea0720412c7957b64908250e99db1c5debc19331e7d473bb26d0c501cf1f02155ec53315372f62c0a36ca9d67d033e42c4d9683c2220eda4b4f4487eff9e474726e279d738e8a613870d38f5197ee4504b40c95ce73a1df4eb837b18bfce046609b29fbb4a7bdb83501806d25bfaa79be4f46f31b9616511733690a6b2a6257084c264223462161aca13e0608a59f5a0cc55f9835d640a1dde518b15c019a4ba62e8513cbbd58fd436d9e401fa12a1a8c82908b4688359b829c90e76067668e4793638a8d33fb9a77c
60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
import { NextResponse } from 'next/server';
|
|
|
|
export const runtime = 'edge';
|
|
|
|
interface ServiceStatus {
|
|
name: string;
|
|
status: 'operational' | 'degraded' | 'down';
|
|
latency?: number;
|
|
}
|
|
|
|
export async function GET() {
|
|
// Check real services
|
|
const checks = [
|
|
{ name: 'Ollama (Cecilia)', url: 'http://192.168.4.96:11434/api/tags' },
|
|
{ name: 'Qdrant (Alice)', url: 'http://192.168.4.49:6333/collections' },
|
|
{ name: 'NATS (Octavia)', url: 'http://192.168.4.101:8222/varz' },
|
|
{ name: 'Gitea (Octavia)', url: 'http://192.168.4.101:3100/api/v1/repos/search?limit=1' },
|
|
{ name: 'Stats API', url: 'https://stats-blackroad.amundsonalexa.workers.dev/health' },
|
|
];
|
|
|
|
const services: ServiceStatus[] = await Promise.all(
|
|
checks.map(async (svc) => {
|
|
const start = Date.now();
|
|
try {
|
|
const res = await fetch(svc.url, { signal: AbortSignal.timeout(5000) });
|
|
return {
|
|
name: svc.name,
|
|
status: res.ok ? 'operational' as const : 'degraded' as const,
|
|
latency: Date.now() - start,
|
|
};
|
|
} catch {
|
|
return { name: svc.name, status: 'down' as const, latency: Date.now() - start };
|
|
}
|
|
})
|
|
);
|
|
|
|
const overallStatus = services.every((s) => s.status === 'operational')
|
|
? 'operational'
|
|
: services.some((s) => s.status === 'down')
|
|
? 'major_outage'
|
|
: 'partial_outage';
|
|
|
|
const response = {
|
|
status: overallStatus,
|
|
services,
|
|
timestamp: new Date().toISOString(),
|
|
page: {
|
|
name: 'BlackRoad OS',
|
|
url: 'https://status.blackroad.io',
|
|
},
|
|
};
|
|
|
|
return NextResponse.json(response, {
|
|
status: 200,
|
|
headers: {
|
|
'Cache-Control': 'public, s-maxage=60, stale-while-revalidate=30',
|
|
},
|
|
});
|
|
}
|