repos
/ status-rust master

status-rust

mirror archived upstream

Single-binary self-hosted uptime monitoring and status pages on Rust axum: HTTP probes, Lighthouse audits, SEO crawler, and PDF reports.

axumdockerrustself-hostedsqlitestatus-pageuptime-monitoringvite

2.3 KB · 60 lines · MySQL Raw History
 1-- A "property" is a tracked URL: the unit of monitoring. The original Django
 2-- schema had per-user properties; the rust port collapses to single-operator
 3-- so user_id is gone, but the rest of the columns line up 1:1 (preserving
 4-- UUIDs lets prior public status URLs keep working after migration).
 5CREATE TABLE properties (
 6    id                          BLOB PRIMARY KEY,
 7    url                         TEXT NOT NULL,
 8    is_public                   INTEGER NOT NULL DEFAULT 0,
 9    is_protected                INTEGER NOT NULL DEFAULT 0,
10
11    last_run_at                 INTEGER,
12    next_run_at                 INTEGER,
13
14    last_run_at_crawler         INTEGER,
15    next_run_at_crawler         INTEGER,
16    crawler_insights            TEXT,
17    crawl_state                 TEXT NOT NULL DEFAULT 'idle',
18    crawl_started_at            INTEGER,
19    last_crawl_success_at       INTEGER,
20    last_crawl_error            TEXT,
21    last_crawl_duration_ms      INTEGER,
22    last_crawl_pages_count      INTEGER,
23
24    lighthouse_scores           TEXT,
25    lighthouse_details          TEXT,
26    last_lighthouse_run_at      INTEGER,
27    last_lighthouse_success_at  INTEGER,
28    last_lighthouse_error       TEXT,
29    last_lighthouse_duration_ms INTEGER,
30    next_lighthouse_run_at      INTEGER,
31    lighthouse_state            TEXT NOT NULL DEFAULT 'idle',
32    lighthouse_started_at       INTEGER,
33
34    -- alert state machine: "up" or "down". Transitions only fire alerts.
35    alert_state                 TEXT NOT NULL DEFAULT 'up',
36    last_alert_sent             INTEGER,
37
38    created_at                  INTEGER NOT NULL,
39    updated_at                  INTEGER NOT NULL
40);
41CREATE INDEX properties_url ON properties(url);
42
43-- Result of a single HTTP check. Cleaned up after 3 days by the scheduler.
44CREATE TABLE checks (
45    id           INTEGER PRIMARY KEY AUTOINCREMENT,
46    property_id  BLOB NOT NULL REFERENCES properties(id) ON DELETE CASCADE,
47    status_code  INTEGER NOT NULL,
48    response_ms  INTEGER NOT NULL DEFAULT 0,
49    headers      TEXT NOT NULL DEFAULT '{}',
50    created_at   INTEGER NOT NULL
51);
52CREATE INDEX checks_created_at         ON checks(created_at);
53CREATE INDEX checks_property_created   ON checks(property_id, created_at DESC);
54
55-- Key-value table for one-off settings (schema version, etc.).
56CREATE TABLE meta (
57    key   TEXT PRIMARY KEY,
58    value TEXT NOT NULL
59);