Add Hetzner Robot: dedicated servers and storage boxes, with shutting-down, locked and rescue-left-on alerts

Read every 15 minutes (Robot allows 200 requests an hour; read-only): each server's product, addresses, status, rescue system and paid-until, and the storage boxes. Adapter, sync service, hetzner_robot_state table, /api/hetzner-robot, Infrastructure → Hetzner Robot page, metrics and docs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-11-04 23:26:26 +01:00
1 parent 7618bf0f0a
commit 01acbaf831
31 files changed
+10105 -10

No files matched your search

+17 -2
View File
@@ -24,8 +24,8 @@ what the app actually creates.
| **File** | `DATABASE_PATH`, default `../data/homelab-manager.sqlite` (relative to `server/`; `/app/data/...` in Docker). The folder is created if missing. |
| **Foreign keys** | Switched on for every connection (`PRAGMA foreign_keys = ON`), so the `ON DELETE` rules below are enforced. |
| **Writes** | SQLite lets one writer in at a time and refuses a second at once ("database is locked"). While a transaction of the app is open, its other writes wait for it ([`server/src/db/writeGate.ts`](server/src/db/writeGate.ts)) rather than being refused — a refused write also leaves its connection unable to commit the next transaction. Reads are never held; a wait over 10 seconds is given up. A lock held by *another* process (a backup tool reading the file, a second copy of the app) is still refused as before. |
| **Migrations** | SQL files in [`server/drizzle/`](server/drizzle) (`0000` … `0083`), applied automatically when the server starts. Which ones have run is recorded in the table `__drizzle_migrations`. |
| **Tables** | 92 application tables, plus drizzle's own `__drizzle_migrations`. |
| **Migrations** | SQL files in [`server/drizzle/`](server/drizzle) (`0000` … `0084`), applied automatically when the server starts. Which ones have run is recorded in the table `__drizzle_migrations`. |
| **Tables** | 93 application tables, plus drizzle's own `__drizzle_migrations`. |
**Not in the database, but beside it in the data folder:** the backups of the database itself (`backups/homelab-manager-….sqlite`, taken daily and on request; see [BACKUP.md](BACKUP.md)), and, only while a restore is waiting or has just happened, `restore-pending.sqlite` / `restore-pending.json` and `restore-result.json`.
@@ -79,6 +79,7 @@ erDiagram
integrations ||--o| fragnet_state : "cascade"
integrations ||--o| arr_state : "cascade"
integrations ||--o| download_state : "cascade"
integrations ||--o| hetzner_robot_state : "cascade"
integrations ||--o| adguard_state : "cascade"
integrations ||--o| technitium_state : "cascade"
integrations ||--o| grafana_state : "cascade"
@@ -1068,6 +1069,20 @@ How a qBittorrent or SABnzbd (an integration of type `qbittorrent` or `sabnzbd`)
How the last read went is kept in `settings`, key `_internal:downloadsSync`.
#### `hetzner_robot_state`
How a Hetzner Robot account (an integration of type `hetznerrobot`) is right now, one row each, replaced at every read (every fifteen minutes). `integration_id` is the primary key and a foreign key with **cascade**. There is no history: what is stored is the last good read, plus, for each server, since when its rescue system has been on and since when it has not been "ready" — which only this app can know, and which is carried from read to read by server number.
| Column | Type | Notes |
|---|---|---|
| `integration_id` | integer PK | |
| `servers` | text NOT NULL, default `[]` | JSON: each dedicated server — number, name, addresses, product, data centre, traffic plan, status, cancelled, paid until, rescue system on (null when it could not be asked), `rescueSince`, `notReadySince`. |
| `storage_boxes` | text | JSON: each storage box — id, name, login, product, location, cancelled, locked, paid until, linked server. **Null when they could not be read.** |
| `skipped_detail` | integer NOT NULL, default 0 | How many servers were not asked about their rescue system (more than 25, to stay under Robot's request limit). |
| `updated_at` | text NOT NULL | ISO. |
How the last read went is kept in `settings`, key `_internal:hetznerRobotSync`.
#### `adguard_state`
How an AdGuard Home (an integration of type `adguard`) is right now, one row each, replaced at every read (every two minutes). `integration_id` is the primary key and a foreign key with **cascade**. No history: what is stored is the last good read, plus two clocks only this app can keep.