Add basic status page

This commit is contained in:
Alois 2026-07-29 21:52:32 +02:00
commit de54eb0b90
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
43 changed files with 6080 additions and 244 deletions

View file

@ -1,47 +1,86 @@
# Methanium Template
# Methanium Status
A pnpm React template with Vite, Tailwind CSS, Methanium UI, MTP, TanStack Router, and a base nix flake.
Live availability and incident reporting for Methanium and Tensamin services. The Rust backend checks configured URLs every five minutes, verifies HTTP/3 where requested, persists incident history, and pushes snapshots to the React status page over MTP/WebTransport.
## Development
```sh
nix develop
pnpm install
pnpm check
pnpm dev
```
## Configure MTP
`pnpm dev` generates a short-lived localhost certificate, uses it for the HTTPS frontend and WebTransport backend, and writes the matching WebTransport certificate hash. The public page is available on Vite's displayed HTTPS URL and the incident editor is available at `http://127.0.0.1:8091/edit` after the frontend has been built once.
1. Define the host's communication and data types in `apps/web/type-maps.yaml`.
2. Set the connection options in `apps/web/src/mtp-options.ts`.
The reusable provider and `useMTP` hook are in `packages/mtp/`.
## Nix
Build the static frontend:
For a manual backend configuration, copy `config.example.toml`, update the certificate paths, build the frontend, and run:
```sh
nix build
pnpm build
cargo run --manifest-path apps/backend/Cargo.toml -- ./config.toml
```
To serve it with nginx on NixOS, import the included module:
Set `VITE_MTP_URL` when the development MTP endpoint is not available at the frontend's own `/mtp` origin.
## Configuration
The backend accepts TOML or JSON. Categories contain a local logo and a list of services. Service names and URLs are not editable through the incident UI.
```toml
[[categories]]
id = "example"
name = "Example"
logo = "/path/to/example.svg"
[[categories.services]]
id = "example-home"
name = "Homepage"
url = "https://example.com"
check_http3 = true
```
HTTP 200 through 399 is operational. DNS, connection, and TLS failures are reported as offline; timeouts, HTTP error responses, and HTTP/3 failures have distinct labels. Every non-operational service state uses red on the public page.
The admin page is available at `/edit` on the separately configured admin address and port. It has intentionally no authentication, so the backend requires the admin address to be loopback. The NixOS module binds it to `127.0.0.1:8081` and does not open its firewall port by default. For remote use, prefer an SSH tunnel:
```sh
ssh -L 8081:127.0.0.1:8081 status-host
```
## NixOS
The included module serves the SPA with nginx on TCP 443 and MTP HTTP/3/WebTransport on UDP 443. Both use the same ACME certificate and origin.
```nix
{
inputs.methanium-template.url =
"git+https://git.methanium.net/methanium/template";
inputs.methanium-status.url =
"git+https://git.methanium.net/methanium/status";
outputs = {nixpkgs, methanium-template, ...}: {
outputs = { nixpkgs, methanium-status, ... }: {
nixosConfigurations.host = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
methanium-template.nixosModules.default
methanium-status.nixosModules.default
{
services.methanium-template = {
security.acme.acceptTerms = true;
security.acme.defaults.email = "admin@example.com";
services.methanium-status = {
enable = true;
hostName = "app.example.com";
hostName = "status.example.com";
openFirewall = true;
categories = [{
id = "example";
name = "Example";
logo = ./example.svg;
services = [{
id = "example-home";
name = "Homepage";
url = "https://example.com";
checkHttp3 = false;
}];
}];
};
}
];
@ -49,3 +88,9 @@ To serve it with nginx on NixOS, import the included module:
};
}
```
Use `acmeHost` to share an already configured NixOS ACME certificate. The service options also expose the check interval, timeout, public listener, admin listener, state directory, packages, firewall behavior, categories, logo paths, and services.
Contact: [contact@methanium.net](mailto:contact@methanium.net)
Security: [security@methanium.net](mailto:security@methanium.net)