Replace the static "All systems normal" indicator in the Footer with a dynamic SystemStatus component backed by an internal API route and a server-side fetch of Uptime Kuma's public status/heartbeat endpoints. The light is rendered on first paint (correct without JS) and refreshed every minute, pausing when the tab is hidden. - src/lib/status.ts: fetches and reduces Uptime Kuma data to one state (up/degraded/down/maintenance/unknown), with in-process caching and stale detection - src/pages/api/status.ts: exposes a small snapshot to the browser, avoiding CORS issues and the ~200 KB heartbeat payload - src/components/SystemStatus.astro: renders the light server-side and keeps it current client-side - README.md: documents the feature and optional environment variables (STATUS_PAGE_URL, STATUS_PAGE_SLUG, STATUS_WATCH_GROUPS, STATUS_CACHE_TTL_SECONDS, STATUS_TIMEOUT_SECONDS, STATUS_STALE_AFTER_SECONDS) - Tests for the summarization logic covering outage, degraded, and maintenance scenarios
77 lines
3.2 KiB
Markdown
77 lines
3.2 KiB
Markdown
# Spaghet.io
|
|
|
|
Welcome to my personal website! This site showcases my projects, blog posts, and professional experience. It's built with Astro and hosted using a modern deployment pipeline.
|
|
|
|
## Deployment Pipeline
|
|
|
|
My website follows a robust deployment workflow:
|
|
|
|
1. **Development**: I develop content and code locally using Gitea as my Git hosting solution
|
|
2. **Auto-push**: Changes are automatically pushed from Gitea to GitHub via configured webhooks
|
|
3. **Hosting**: The site is hosted on self-hosted infrastructure, which provides a scalable and secure hosting environment
|
|
4. **Delivery**: NGINX reverse proxy handles routing and serves content with optimal performance
|
|
|
|
This pipeline ensures that my website is always up-to-date with the latest changes while leveraging modern hosting technologies.
|
|
|
|
## Site Components
|
|
|
|
This website is built using Astro with the following key components:
|
|
|
|
- **Blog**: Articles about technology, development, and personal insights
|
|
- **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
|
|
|
|
- **Framework**: Astro (Static site generation)
|
|
- **Styling**: Tailwind CSS
|
|
- **TypeScript**: Type-safe development
|
|
- **Deployment**: Gitea → GitHub → Self-hosted infrastructure → NGINX reverse proxy
|
|
|
|
## Getting Started
|
|
|
|
To run this site locally:
|
|
|
|
```bash
|
|
# Install dependencies
|
|
npm install
|
|
|
|
# Start development server
|
|
npm run dev
|
|
```
|
|
|
|
For more information about the Astro framework and its features, please refer to the [Astro documentation](https://docs.astro.build/).
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License - see the LICENSE file for details.
|