75 lines
2.0 KiB
Markdown
75 lines
2.0 KiB
Markdown
|
|
# status
|
||
|
|
|
||
|
|
A lightweight HTTP status checker that sources its target list from Nginx Proxy Manager and serves results as JSON and a terminal-aesthetic HTML page.
|
||
|
|
|
||
|
|
Designed to run as a standalone public status page on its own subdomain — if your main site is down, the status page is still reachable independently.
|
||
|
|
|
||
|
|
## How it works
|
||
|
|
|
||
|
|
1. On startup (and every 10 minutes), fetches all enabled proxy hosts from the NPM API
|
||
|
|
2. Filters to domains matching `NPM_INCLUDE_PATTERNS`
|
||
|
|
3. HTTP-checks each host every 60 seconds
|
||
|
|
4. Serves current results at `/` (HTML) and `/api/status` (JSON)
|
||
|
|
|
||
|
|
The HTML page auto-refreshes every 60 seconds.
|
||
|
|
|
||
|
|
## Running locally
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cp .env.example .env
|
||
|
|
# fill in NPM_EMAIL and NPM_SECRET
|
||
|
|
npm install
|
||
|
|
npm run dev
|
||
|
|
```
|
||
|
|
|
||
|
|
## Environment variables
|
||
|
|
|
||
|
|
| Variable | Default | Description |
|
||
|
|
|---|---|---|
|
||
|
|
| `PORT` | `3035` | Port to listen on |
|
||
|
|
| `NPM_BASE_URL` | `http://localhost:81` | Base URL of your Nginx Proxy Manager instance |
|
||
|
|
| `NPM_EMAIL` | — | NPM account email |
|
||
|
|
| `NPM_SECRET` | — | NPM account password |
|
||
|
|
| `NPM_INCLUDE_PATTERNS` | `\.example\.com$` | Comma-separated regex patterns; only domains matching at least one are checked |
|
||
|
|
|
||
|
|
## Docker
|
||
|
|
|
||
|
|
```bash
|
||
|
|
docker compose up -d
|
||
|
|
```
|
||
|
|
|
||
|
|
Uses the image from `IMAGE` in `.env`. For a local build:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
docker build -t status:local .
|
||
|
|
IMAGE=status:local docker compose up -d
|
||
|
|
```
|
||
|
|
|
||
|
|
## CI/CD
|
||
|
|
|
||
|
|
Gitea Actions workflow at `.gitea/workflows/build.yml`. Builds and pushes to the Gitea container registry on every push to `main`. Requires a `TKNTKN` secret (PAT with `packages:write`) in the repo settings.
|
||
|
|
|
||
|
|
## API
|
||
|
|
|
||
|
|
```
|
||
|
|
GET /api/status
|
||
|
|
```
|
||
|
|
|
||
|
|
```json
|
||
|
|
{
|
||
|
|
"lastRefreshed": "2026-07-07T19:35:43Z",
|
||
|
|
"hosts": [
|
||
|
|
{
|
||
|
|
"name": "example.com",
|
||
|
|
"url": "https://example.com",
|
||
|
|
"status": "up",
|
||
|
|
"statusCode": 200,
|
||
|
|
"latencyMs": 182,
|
||
|
|
"checkedAt": "2026-07-07T19:35:43Z"
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
`status` is `"up"` for any response (including 4xx — the server is reachable), `"down"` for connection errors and 5xx, `"unknown"` before the first check completes.
|