diff --git a/README.md b/README.md index cac28c6..49e5c65 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,34 @@ This website is built using Astro with the following key components: - **Projects**: Showcasing my various projects and contributions - **Work Experience**: Professional background and career history - **Legal**: Privacy policy and terms of service +- **System status**: The footer light is powered by Uptime Kuma (see below) + +## System Status Footer + +The "All systems normal" light in the footer reflects the public Uptime Kuma +status page at [uptime.spaghet.io/status/public](https://uptime.spaghet.io/status/public). + +- `src/lib/status.ts` fetches Uptime Kuma's public status-page and heartbeat + APIs server-side, reduces them to one state (`up`, `degraded`, `down`, + `maintenance`, `unknown`) and caches the result in-process. +- `src/pages/api/status.ts` exposes that small snapshot to the browser. Uptime + Kuma sends no CORS headers outside dev mode and its heartbeat payload is + ~200 KB, so the browser never talks to it directly. +- `src/components/SystemStatus.astro` renders the light server-side (correct on + first paint and with JS disabled) and then refreshes it every minute, pausing + while the tab is hidden. + +Optional environment variables (all have working defaults): + +| Variable | Default | Purpose | +| --- | --- | --- | +| `STATUS_PAGE_URL` | `https://uptime.spaghet.io` | Uptime Kuma origin | +| `STATUS_PAGE_SLUG` | `public` | Status page slug | +| `STATUS_WATCH_GROUPS` | *(all groups)* | Comma-separated group names that drive the light, e.g. `"Critical Services,Database Services"` | +| `STATUS_CACHE_TTL_SECONDS` | `60` | Server-side cache lifetime | +| `STATUS_TIMEOUT_SECONDS` | `4` | Upstream request timeout | +| `STATUS_STALE_AFTER_SECONDS` | `900` | Treat the light as unknown once beats stop arriving | + ## Technologies Used diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 44e08bf..0a136db 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,7 +1,12 @@ --- import { SITE, SOCIALS } from "@consts" import Container from "@components/Container.astro" -// Remove unused storage import +import SystemStatus from "@components/SystemStatus.astro" +import { getSystemStatus } from "@lib/status" + +// Rendered server-side so the light is correct in the first paint (and with JS +// off); SystemStatus then keeps it current from /api/status. +const statusSnapshot = await getSystemStatus() ---