home-hosted 0.9.7 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/AGENTS.md CHANGED
@@ -111,6 +111,10 @@ workspace config guard, so a busy default port turns config tests red for the wr
111
111
  - **A bounded read stays bounded.** `logs --lines 1e3` falls back to the default and `0x10` is not the
112
112
  "whole log" sentinel (`src/cli/logs.ts`); `--lines N` reads a tail, never the whole file
113
113
  (`test/cli/logs.test.ts`).
114
+ - **A metric with no reading is absent, never zero.** A scrape has no page to qualify a number, so an
115
+ alerted-on gauge published as `0` from an unsampled view is indistinguishable from a healthy one
116
+ and silences the rule that exists to catch it. Omit the series (`src/api/metrics.ts`), and never
117
+ suffix `_total` a value that a user action resets.
114
118
  - **Conventional commits** — changelogen derives the changelog and `scripts/check-release-version.mjs`
115
119
  the version bump. Below 1.0 the **minor is the breaking channel**: a fix is a patch, a minor means
116
120
  someone has to read the release notes and act — ask what the user has to do, not whether the commit
package/README.md CHANGED
@@ -241,13 +241,24 @@ default workspace.
241
241
  | `PUT`/`DELETE /api/notifications/destinations/:id/token`, `POST /api/notifications/destinations/:id/{test,detect-chats}`, `POST /api/notifications/test-webhook` | one destination's bot credential, and a test send | ✅ |
242
242
  | `GET`/`PATCH /api/settings/workspace` | server defaults, logs, notifications | ✅ |
243
243
  | `GET`/`PATCH /api/settings` | panel-wide: listener, authentication, TLS, host vitals, backups | ❌ |
244
- | `GET`/`POST /api/backups`, restore | archives | ❌ |
244
+ | `GET`/`POST /api/backups`, restore | archives; a create or restore body selects with `include` and/or `exclude` | ❌ |
245
245
  | `GET`/`PATCH /api/proxy`, `POST /api/proxy/{engine,start,stop,apply,revert}`, `PUT`/`DELETE /api/proxy/certificates/:id` | the reverse proxy: its engine, its route table, and its uploaded certificates | ❌ |
246
246
  | `GET /healthz` | no session needed — the one an external monitor wants (its per-server detail needs a credential) | ❌ |
247
- | `GET /api/metrics` | Prometheus text (needs a token or session, like every `/api` route) | ❌ |
247
+ | `GET /api/metrics` | Prometheus text (needs a token or session, like every `/api` route) — scrape it with a bearer token | ❌ |
248
248
 
249
249
  ✅ takes `?workspace=<id>`; ❌ is panel-wide. Omitting `?workspace` means `default` workspace is used.
250
250
 
251
+ **Scraping it.** Point your scraper at `/api/metrics` with the token from `home-hosted set-token
252
+ --generate` as `Authorization: Bearer …`, because it lives under `/api` like every other route.
253
+ `hh_host_cpu_used_percent` is the machine's own CPU share (0–100) — the figure to alert on.
254
+ `hh_host_load1_per_cpu` beside it is a **count of runnable tasks per core**, not a percentage:
255
+ `1.0` means one core's worth of work waiting, so it is fine on a busy box and not comparable with the
256
+ percentage above. A host gauge appears only once the host has been sampled, so a series that is
257
+ *absent* means "no reading", never "zero": do not let a dashboard fill that in. `hh_server_restarts_total`
258
+ counts the retry attempts spent on a server's **current** crash sequence and drops back to `0` when
259
+ someone starts it, so it is a state, not a counter to `rate()` — `hh_server_crashes_24h` is the one
260
+ that only grows within its window.
261
+
251
262
  `GET /openapi/spec.json` describes all of it, `/openapi/ui` is the browsable version, and every error
252
263
  comes back as one envelope (`{ message, code, detail }`) with a stable `code` a tool can branch on. The
253
264
  document declares its own `securitySchemes` (`bearerAuth`), every documented 2xx carries a schema, and
@@ -285,7 +296,7 @@ can be told what to be: *"Help me build a UI for home-hosted: nostalgic game the
285
296
  | 🔗 **Ordered startup** | `dependsOn` waits for a dependency to be *healthy* — not merely spawned. `stop-all`/`down` stop dependents before their dependencies; stopping one server names the dependents it leaves running. [SERVERS.md](./docs/SERVERS.md#field-reference) |
286
297
  | 📜 **Logs** | Live per-server stream, buffer plus rotated files on disk, search, filter to one stream, download, one click to clear. |
287
298
  | 📈 **Resources** | CPU and RSS of the whole process tree, with an optional memory ceiling that triggers a restart. |
288
- | 🌡️ **Host vitals** | Load, memory, swap, disk and CPU temperature, with thresholds that notify once and again on recovery. |
299
+ | 🌡️ **Host vitals** | CPU usage, memory, swap, disk and CPU temperature, plus the load average as a per-cpu count, with thresholds that notify once and again on recovery. |
289
300
  | 🤖 **Token API** | Scripts and agents drive it with `Authorization: Bearer` — no browser, no session. [↑](#-agents-scripts-and-tools) |
290
301
  | 🔔 **Notifications** | One list of **destinations** — Telegram chats and webhooks (ntfy, Discord, Slack, your own endpoint) — on crash, unhealthy, forced restart, recovery, host thresholds and DNS changes. The event toggles and throttle are set once, and each destination may inherit them or carry its own. [Setup here](./docs/NOTIFICATIONS.md). |
291
302
  | 🌐 **Dynamic DNS** | Keep hostnames pointed at your public IP — Cloudflare, Namecheap, Spaceship, Porkbun, GoDaddy, Gandi and more. [DDNS.md](./docs/DDNS.md) |
@@ -360,7 +371,7 @@ restarts itself), and how hand-edits are validated: [SERVERS.md](./docs/SERVERS.
360
371
  | `home-hosted stop <id>` | stop one server, nothing else (`--workspace <id>`) |
361
372
  | `home-hosted restart <id>` | restart one server, nothing else (`--workspace <id>`) — the same as the panel's per-server Restart |
362
373
  | `home-hosted logs` | read the panel's own console output — the file `up` redirects it into (`--lines`, `--follow`, `--json`) |
363
- | `home-hosted backup` | list, create or restore an archive without a browser, **and without the panel running** (`create --all --confirm`, `restore <name> --all --confirm`, `--password`, `--include`) — see [RESTORE_DEMO.md](./docs/RESTORE_DEMO.md), and `dump`/`load` hooks in [SERVERS.md](./docs/SERVERS.md) |
374
+ | `home-hosted backup` | list, create or restore an archive without a browser, **and without the panel running** (`create --all --exclude global:secrets --confirm`, `restore <name> --all --confirm`, `--password`, `--include`, `--exclude`) — see [RESTORE_DEMO.md](./docs/RESTORE_DEMO.md), and `dump`/`load` hooks in [SERVERS.md](./docs/SERVERS.md) |
364
375
  | `home-hosted set-password` | set the panel password without opening a browser; a running panel picks it up at once and signs every existing session out |
365
376
  | `home-hosted set-token` | set the API token scripts and agents use (`--generate`, `--clear`) |
366
377
  | `home-hosted migrate` | bring every config up to the schema this release understands (`--dry-run`, `--yes`) |
@@ -380,7 +391,7 @@ up -p/--port --host --open --no-autostart --foreground --print-co
380
391
  down (no flags)
381
392
  status --json
382
393
  logs --lines <n> --follow --json
383
- backup [list|create|restore] [<name>] (--include <ids> | --all) --password --confirm --json
394
+ backup [list|create|restore] [<name>] (--include <ids> | --all) [--exclude <ids>] --password --confirm --json
384
395
  start, stop <id> [-w/--workspace <id>] (both need the panel up)
385
396
  restart [<id>] [-w/--workspace <id>] (no id: the panel; with one: that server)
386
397
  init --dir --name --pm --no-install -y/--yes
@@ -449,11 +460,14 @@ Everything binds `127.0.0.1` until you say otherwise.
449
460
 
450
461
  - **A password is required to expose the panel.** Replace the default, then bind to `lan` — in the
451
462
  UI, in the config, or with `--host lan`. The same guard applies in all three places.
452
- - **Sessions** live in memory only; the cookie is `HttpOnly` and `SameSite=Strict`, and the login
453
- route locks out repeated failures per IP — see the `trustProxy` note below for when that is advisory.
463
+ - **Sessions** live in memory only; the cookie is `HttpOnly` and `SameSite=Strict`, and it is an
464
+ **idle** timeout — every request slides both the session and the cookie, so a panel in regular use
465
+ stays signed in and one left alone for the configured lifetime does not. The login route locks out
466
+ repeated failures per IP — see the `trustProxy` note below for when that is advisory.
454
467
  - **API tokens** for scripts and agents: `home-hosted set-token --generate` prints one once, and a
455
468
  request proves itself with `Authorization: Bearer …` — the same access as a signed-in browser,
456
- stored as a SHA-256 hash, revoked with `set-token --clear`.
469
+ stored as a SHA-256 hash, revoked with `set-token --clear`. Changing the panel password does
470
+ **not** revoke a token, so rotate it with `set-token --generate` if one may have leaked.
457
471
  - **Port conflicts** are named — `port 4010 is already in use (pid 4242)` — and can be resolved from
458
472
  a confirmation popover on that banner or card. The process is looked up again at that moment,
459
473
  never taken from the message, and anything the panel supervises is refused, not killed. A server
@@ -518,6 +532,22 @@ stores `intervalMs` — with a retention of its own (`Keep automatic`). The two
518
532
  room for its own. Both land in the same directory, and an automatic archive is named `auto-…` so you
519
533
  can tell them apart — a name you drop in by hand with that prefix is treated as one, so do not use it.
520
534
 
535
+ **What an automatic backup contains** is yours to choose: *What an automatic backup contains →
536
+ Choose…* offers the same two-level list as *Create backup…*, and writes the result into the schedule
537
+ as `scope`. Two modes, the same two the CLI has:
538
+
539
+ - **Only these** — the archive carries only what you tick. The command-line spelling is
540
+ `--include <ids>`.
541
+ - **Everything except** — the archive carries everything but what you tick, *including workspaces you
542
+ add later*. The command-line spelling is `--all --exclude <ids>`.
543
+
544
+ Leave it at **Everything** (no `scope` in the file) and the schedule keeps taking the whole default
545
+ scope — every workspace plus `includePaths` — which is exactly what a schedule written before this
546
+ existed means. That is also the only setting that follows a workspace you add tomorrow; a stored list
547
+ of ids does not, because it names today's ids. Ticking everything in the dialog is therefore saved as
548
+ no scope at all, not as the list it currently amounts to. An empty selection is refused: it cannot be
549
+ told apart from "everything" in the file, and it would capture nothing.
550
+
521
551
  <details>
522
552
  <summary><b>🔑 Restoring a secret</b></summary>
523
553