home-hosted 0.9.3 → 0.9.4
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 +27 -21
- package/README.md +107 -50
- package/dist/cli.js +1016 -150
- package/dist/cli.js.map +1 -1
- package/docs/DDNS.md +6 -8
- package/docs/NOTIFICATIONS.md +6 -0
- package/docs/REVERSE_PROXY.md +23 -12
- package/docs/SERVERS.md +50 -2
- package/docs/UI_CREATION.md +7 -7
- package/package.json +1 -1
- package/uis/stock/dist/assets/de-DI7SS5ZM.js +1 -0
- package/uis/stock/dist/assets/es-DDPUYXdi.js +1 -0
- package/uis/stock/dist/assets/fr-Dpyr2qTp.js +1 -0
- package/uis/stock/dist/assets/index-BtE1z5wU.css +2 -0
- package/uis/stock/dist/assets/{index-DVmJrO-t.js → index-JBfH8bkX.js} +10 -8
- package/uis/stock/dist/assets/ja-CTGEGJ4n.js +1 -0
- package/uis/stock/dist/assets/ko-BSVsEsYY.js +1 -0
- package/uis/stock/dist/assets/ru-DvSoJlxX.js +1 -0
- package/uis/stock/dist/assets/vi-BTIQb_8V.js +1 -0
- package/uis/stock/dist/assets/zh-CN-D2-g9feN.js +1 -0
- package/uis/stock/dist/index.html +2 -2
- package/uis/stock/dist/ui.json +3 -3
- package/uis/stock/dist/assets/de-BVk31frd.js +0 -1
- package/uis/stock/dist/assets/es-BLevhZGM.js +0 -1
- package/uis/stock/dist/assets/fr-S3YXRHdG.js +0 -1
- package/uis/stock/dist/assets/index-GxTN2fYn.css +0 -2
- package/uis/stock/dist/assets/ja-BOB-E8_K.js +0 -1
- package/uis/stock/dist/assets/ko-Dc88YLt7.js +0 -1
- package/uis/stock/dist/assets/ru-BBxCT8MK.js +0 -1
- package/uis/stock/dist/assets/vi-CxubJ_Mw.js +0 -1
- package/uis/stock/dist/assets/zh-CN-BIvisZnl.js +0 -1
package/AGENTS.md
CHANGED
|
@@ -8,14 +8,18 @@ State lives only in `$HHOSTED_HOME/.hh` (default `~/.home-hosted/.hh`). Global f
|
|
|
8
8
|
level: `settings.json` (listener, auth, TLS policy, host vitals, backups, reverse proxy),
|
|
9
9
|
`workspaces.json`, `.control-secrets.json` (0600: password hash, API token hash), `.tls/`, `.backups/`,
|
|
10
10
|
`.ui/`, `.logs/` (the panel console), `.proxy/` (the engine, its generated config and nanny state), and
|
|
11
|
-
`run.json` (the live daemon's pid/url/token, 0600).
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
and
|
|
18
|
-
|
|
11
|
+
`run.json` (the live daemon's pid/url/token, 0600).
|
|
12
|
+
|
|
13
|
+
Every workspace owns `.hh/<id>/`: `settings.json` (server defaults, log retention, notifications,
|
|
14
|
+
DDNS), `servers.config.json`, `.secrets.json` (0600: Telegram bot tokens, one per destination, plus
|
|
15
|
+
DDNS credentials sealed with AES-256-GCM under `HHOSTED_DDNS_SECRET` — only DDNS is sealed, because it
|
|
16
|
+
is the one thing replayed to a third party), `.logs/` (per server, `<id>.log` plus `<id>.log.1` when it
|
|
17
|
+
rotates), and `.state/` (nanny state, its 0600 spawn spec until read, `<id>.run.json` — the last
|
|
18
|
+
detached child, which is how an orphan is found, and `ddns.json`).
|
|
19
|
+
|
|
20
|
+
A home still on the 0.6.x layout is **refused** by `ensureLayout()`, which names the file and tells the
|
|
21
|
+
person to install the latest 0.7.x; 0.8.0 does not relocate it. **The package ships no servers**: never
|
|
22
|
+
commit a config, a seed entry, or a path that names one.
|
|
19
23
|
|
|
20
24
|
## Docs
|
|
21
25
|
|
|
@@ -38,7 +42,7 @@ Where knowledge lives, and when to reach for each:
|
|
|
38
42
|
| [`.agentDocs/GOTCHAS.md`](.agentDocs/GOTCHAS.md) | the traps this codebase already paid for, with causes |
|
|
39
43
|
| [`.agentDocs/COMPATIBILITY.md`](.agentDocs/COMPATIBILITY.md) | config and UI compatibility, migrations |
|
|
40
44
|
| [`.agentDocs/RELEASING.md`](.agentDocs/RELEASING.md) | how a release is cut, and which version to dispatch |
|
|
41
|
-
| [`docs/SERVERS.md`](docs/SERVERS.md) | entries, port conflicts, persistent entries |
|
|
45
|
+
| [`docs/SERVERS.md`](docs/SERVERS.md) | entries, presets, port conflicts, persistent entries |
|
|
42
46
|
| [`docs/NOTIFICATIONS.md`](docs/NOTIFICATIONS.md) | notification destinations: Telegram, webhooks, shared defaults |
|
|
43
47
|
| [`docs/DDNS.md`](docs/DDNS.md) | dynamic-DNS providers and hostnames |
|
|
44
48
|
| [`docs/REVERSE_PROXY.md`](docs/REVERSE_PROXY.md) | the Caddy engine, routes, certificates |
|
|
@@ -116,10 +120,12 @@ workspace config guard, so a busy default port turns config tests red for the wr
|
|
|
116
120
|
These prevent defects if broken. The *why* for the non-obvious ones is in
|
|
117
121
|
[`.agentDocs/GOTCHAS.md`](.agentDocs/GOTCHAS.md).
|
|
118
122
|
|
|
119
|
-
- **
|
|
120
|
-
|
|
121
|
-
the only import form — UIs use `@shared/*` (and `@server` for types only). A test fails
|
|
122
|
-
file
|
|
123
|
+
- **A server gets only its own fields; UIs are clients.** No blessed ids and no `dataDir`-style
|
|
124
|
+
globals: an entry is `command`/`args`/`env`/`dataEnvs`/`envFile`/`bootstrap`, and `#src/*` inside
|
|
125
|
+
`src/` is the only import form — UIs use `@shared/*` (and `@server` for types only). A test fails
|
|
126
|
+
if a core file names a particular server. Integrations the panel owns as infrastructure (the proxy
|
|
127
|
+
engine, docker's container lookup, notification providers, DDNS) are not server entries and are
|
|
128
|
+
expected in `src/`.
|
|
123
129
|
- **UIs are external clients.** Nothing in `src/**` may know a UI's markup or files;
|
|
124
130
|
`$HHOSTED_HOME/.hh/.ui` overrides the packaged UI at runtime.
|
|
125
131
|
- **`src/shared` has exactly one declaration per member** — neither a UI nor `src/**` may re-declare
|
|
@@ -132,7 +138,7 @@ These prevent defects if broken. The *why* for the non-obvious ones is in
|
|
|
132
138
|
`README.md` are exempt — neither is in the built asset).
|
|
133
139
|
`src/shared/**` is a UI build input, so a runtime contract needs the bump too — the hook does not
|
|
134
140
|
inspect that commit. **`tag` and `unix` are build provenance**, stamped into `dist/ui.json` by
|
|
135
|
-
`build-uis.mjs`; never committed to `public/ui.json`.
|
|
141
|
+
`build-uis.mjs`; never committed to `uis/<name>/public/ui.json`.
|
|
136
142
|
- **Paths.** `dataRoot` is state, under `dataRoot/.hh`; `projectDir` is the base for relative entry
|
|
137
143
|
paths. `{…}` and `${ENV}` expand in config — the full list is the table in
|
|
138
144
|
[`docs/SERVERS.md`](docs/SERVERS.md), which is what to keep in step. No package-relative state.
|
|
@@ -153,8 +159,9 @@ These prevent defects if broken. The *why* for the non-obvious ones is in
|
|
|
153
159
|
per-workspace service through `PanelService.requireWorkspace(id)`, never a module global.
|
|
154
160
|
- **A restore writes only where a config says** — archive allowlist, `origin` matching first, symlinks
|
|
155
161
|
never recreated.
|
|
156
|
-
- **A port is only ever freed
|
|
157
|
-
|
|
162
|
+
- **A port is only ever freed from a fresh lookup, never a quoted pid.** `free-port` re-lists the
|
|
163
|
+
listeners and refuses any in `supervisedPids()` instead of killing it; a docker-published port has
|
|
164
|
+
no pid this user may see, so the container docker reports publishing *that* port is stopped instead.
|
|
158
165
|
- **A live pid is not the running panel.** Pids are recycled and a zombie still answers signal 0, so `up`/`status`/`down` decide
|
|
159
166
|
with `runtimeIsAlive`/`runtimeLiveness` (pid **plus** `run.json`'s own `startedAt`), never
|
|
160
167
|
`isProcessAlive` alone. Only `'gone'` deletes a record; `'unknown'` counts as alive, and `'recycled'`
|
|
@@ -206,8 +213,8 @@ These prevent defects if broken. The *why* for the non-obvious ones is in
|
|
|
206
213
|
|
|
207
214
|
**Prune verbose, keep correctness** — code, comments, docs alike.
|
|
208
215
|
|
|
209
|
-
- Code: a comment only for non-obvious *intent*, never to restate the line, and never long.
|
|
210
|
-
|
|
216
|
+
- Code: a comment only for non-obvious *intent*, never to restate the line, and never long. An
|
|
217
|
+
argument for the change belongs in the commit message.
|
|
211
218
|
- Docs: one idea per sentence. Cut anything that would not change what a reader does.
|
|
212
219
|
- Delete history `git log` already holds — keep the *rule* that came out of it, not the story.
|
|
213
220
|
- **Never drop a caveat to save a line.** Concise means no filler, not fewer facts.
|
|
@@ -218,9 +225,8 @@ These prevent defects if broken. The *why* for the non-obvious ones is in
|
|
|
218
225
|
|
|
219
226
|
- **Concise first read**, depth behind collapsible `<details>` spoilers, and **visuals for skimmers** —
|
|
220
227
|
the media in `docs/media/` is regenerated by `pnpm run media`.
|
|
221
|
-
- **Docs ship with the change.** A
|
|
222
|
-
|
|
223
|
-
stale code.
|
|
228
|
+
- **Docs ship with the change.** A user-visible change updates the docs that describe it in the *same
|
|
229
|
+
commit*. A stale doc is a bug like stale code.
|
|
224
230
|
|
|
225
231
|
## Where to extend
|
|
226
232
|
|
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ command or a `docker compose` stack.
|
|
|
59
59
|
│ gateway │ │ files │ │ bot │
|
|
60
60
|
│ :4000 │ │ :4010 │ │ ... │
|
|
61
61
|
└────┬────┘ └─────────┘ └─────────┘
|
|
62
|
-
│ compose up
|
|
62
|
+
│ compose up
|
|
63
63
|
▼
|
|
64
64
|
┌────────────┬────────────┬────────────┐
|
|
65
65
|
│ gateway │ postgres │ redis │ restarts ↻
|
|
@@ -75,8 +75,8 @@ command or a `docker compose` stack.
|
|
|
75
75
|
| ❌ **"Move it to the new box"** | One archive: config **and** data, restored on a blank host |
|
|
76
76
|
| ✅ **home-hosted** | Declare it once, watch it forever, one command to stop it all |
|
|
77
77
|
|
|
78
|
-
It ships with **
|
|
79
|
-
|
|
78
|
+
It ships with **no servers configured**: what you run is a command, some arguments, and the
|
|
79
|
+
environment you give it. A preset can fill that in for you, and you can change every field after:
|
|
80
80
|
|
|
81
81
|
```json
|
|
82
82
|
{ "id": "gateway", "command": "node", "args": ["server.js"], "port": 4000, "autostart": true }
|
|
@@ -84,7 +84,7 @@ some arguments, and the environment you give it:
|
|
|
84
84
|
|
|
85
85
|
<sub>Manage them from the panel, `home-hosted start|stop <id>` from a shell, `home-hosted status --json`,
|
|
86
86
|
or `GET /api/state`; `GET /healthz` is the same status line for your own monitor, no session needed —
|
|
87
|
-
`503` when
|
|
87
|
+
`503` when a server has crashed or a running one is failing its health check.</sub>
|
|
88
88
|
|
|
89
89
|
---
|
|
90
90
|
|
|
@@ -154,6 +154,8 @@ state/.hh/* # secrets, logs, TLS keys and archives s
|
|
|
154
154
|
!state/.hh/settings.json # …but the workspace definitions are committed
|
|
155
155
|
!state/.hh/workspaces.json
|
|
156
156
|
state/.hh/*/*
|
|
157
|
+
!state/.hh/*/ # git will not descend into an excluded directory,
|
|
158
|
+
# so the directories must be un-ignored first
|
|
157
159
|
!state/.hh/*/settings.json
|
|
158
160
|
!state/.hh/*/servers.config.json
|
|
159
161
|
data/ # per-server data directories, declared through dataEnvs
|
|
@@ -210,7 +212,7 @@ home-hosted set-token --generate
|
|
|
210
212
|
curl -H "Authorization: Bearer hh_9uA2…" http://127.0.0.1:3999/api/state
|
|
211
213
|
curl -H "Authorization: Bearer hh_9uA2…" -X POST 'http://127.0.0.1:3999/api/servers/omniroute/restart?workspace=default'
|
|
212
214
|
curl -N -H "Authorization: Bearer hh_9uA2…" 'http://127.0.0.1:3999/api/servers/omniroute/stream?workspace=default' # SSE
|
|
213
|
-
home-hosted status --json # machine-readable: pid, url,
|
|
215
|
+
home-hosted status --json # machine-readable: running, liveness, degraded, pid, url, paths
|
|
214
216
|
```
|
|
215
217
|
|
|
216
218
|
A token has the same authority as a signed-in browser and outlives restarts; `set-token --clear`
|
|
@@ -225,13 +227,13 @@ default workspace.
|
|
|
225
227
|
| `GET /api/state` | the full snapshot: global settings, every workspace with its servers, host vitals | ❌ |
|
|
226
228
|
| `GET`/`POST /api/workspaces`, `PATCH`/`DELETE /api/workspaces/:id` | the registry: list, create, rename, remove | ❌ |
|
|
227
229
|
| `GET /api/events` | SSE: the live state, plus logs (`?logs=0`, `?serverId=…`; a `server` payload carries its `workspaceId`) | ❌ |
|
|
228
|
-
| `GET`/`POST /api/servers`, `POST /api/servers/
|
|
229
|
-
| `GET`/`PATCH`/`DELETE /api/servers/:id` | one entry | ✅ |
|
|
230
|
+
| `GET`/`POST /api/servers`, `POST /api/servers/start-all`, `POST /api/servers/stop-all` | that workspace's entries, and its lifecycle for all of them | ✅ |
|
|
231
|
+
| `GET`/`PATCH`/`DELETE /api/servers/:id`, `PUT /api/servers/:id` | one entry — `PUT` creates or replaces it, so a re-run converges | ✅ |
|
|
230
232
|
| `POST /api/servers/:id/{start,stop,restart}`, `POST /api/servers/:id/free-port` | one entry's lifecycle, and freeing its port | ✅ |
|
|
231
233
|
| `GET /api/servers/:id/logs`, `GET /api/servers/:id/stream` | that entry's buffered lines, and its SSE | ✅ |
|
|
232
234
|
| `GET /api/logs` | persisted history and files | ✅ |
|
|
233
235
|
| `GET`/`PUT /api/ddns`, `/api/ddns/credentials/:id`, `/api/ddns/check` | that workspace's Dynamic DNS policy, credentials and a check | ✅ |
|
|
234
|
-
| `PUT`/`DELETE /api/notifications/token`, `POST /api/notifications/{test,detect-chats}` |
|
|
236
|
+
| `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 | ✅ |
|
|
235
237
|
| `GET`/`PATCH /api/settings/workspace` | server defaults, logs, notifications | ✅ |
|
|
236
238
|
| `GET`/`PATCH /api/settings` | panel-wide: listener, authentication, TLS, host vitals, backups | ❌ |
|
|
237
239
|
| `GET`/`POST /api/backups`, restore | archives | ❌ |
|
|
@@ -242,7 +244,10 @@ default workspace.
|
|
|
242
244
|
✅ takes `?workspace=<id>`; ❌ is panel-wide. Omitting `?workspace` means `default` workspace is used.
|
|
243
245
|
|
|
244
246
|
`GET /openapi/spec.json` describes all of it, `/openapi/ui` is the browsable version, and every error
|
|
245
|
-
comes back as one envelope (`{ message, code, detail }`) with a stable `code` a tool can branch on.
|
|
247
|
+
comes back as one envelope (`{ message, code, detail }`) with a stable `code` a tool can branch on. The
|
|
248
|
+
document declares its own `securitySchemes` (`bearerAuth`), every documented 2xx carries a schema, and
|
|
249
|
+
each operation is tagged — so `openapi-typescript`, `openapi-generator` or a docs renderer can generate
|
|
250
|
+
a working client without hand-written glue.
|
|
246
251
|
|
|
247
252
|
</details>
|
|
248
253
|
|
|
@@ -268,10 +273,10 @@ can be told what to be: *"Help me build a UI for home-hosted: nostalgic game the
|
|
|
268
273
|
| | |
|
|
269
274
|
| --- | --- |
|
|
270
275
|
| 🗂 **Workspaces** | One panel, many scopes: pick a workspace in the header and it owns its servers, secrets, logs and settings. Create, rename and delete them there. Panel-wide things — listener, auth, host vitals, backups, TLS, UI — stay in **Global settings**. |
|
|
271
|
-
| 🚦 **Lifecycle** | Start, stop, restart from the panel or the API; `autostart` entries come up with it. |
|
|
276
|
+
| 🚦 **Lifecycle** | Start, stop, restart from the panel or the API; `autostart` entries come up with it. A process left behind by a renamed or removed entry is listed on **Servers** with a stop button, instead of running invisible. |
|
|
272
277
|
| 📝 **Hand edits welcome** | Change a workspace's `servers.config.json` in an editor, a `git checkout` or a config tool: the panel notices within seconds, no restart. A file it cannot read is reported in the panel, and the running servers are left alone. |
|
|
273
278
|
| ♻️ **Auto-restart** | Exponential backoff on crash, with the counter reset once a process stays up. The budget is remembered across a restart of the panel. |
|
|
274
|
-
| 🩺 **Health that acts** | TCP or HTTP probes per server: warn on the card, force a restart after a timeout, check ports before starting — and [follow or replace](./docs/SERVERS.md#when-a-program-restarts-itself) a program that restarts itself. |
|
|
279
|
+
| 🩺 **Health that acts** | TCP or HTTP probes per server: warn on the card, force a restart after a timeout (bounded by the same retry budget as a crash, so a permanently sick entry stops instead of restarting forever), check ports before starting — and [follow or replace](./docs/SERVERS.md#when-a-program-restarts-itself) a program that restarts itself. |
|
|
275
280
|
| 🔗 **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) |
|
|
276
281
|
| 📜 **Logs** | Live per-server stream, buffer plus rotated files on disk, search, filter to one stream, download, one click to clear. |
|
|
277
282
|
| 📈 **Resources** | CPU and RSS of the whole process tree, with an optional memory ceiling that triggers a restart. |
|
|
@@ -284,7 +289,7 @@ can be told what to be: *"Help me build a UI for home-hosted: nostalgic game the
|
|
|
284
289
|
| 🌍 **Nine languages** | English, Vietnamese, Chinese, Japanese, Spanish, Korean, Russian, French, German — picked on the login page or in **Global settings → Language**, kept per browser. |
|
|
285
290
|
| 🎨 **BYOU — Bring Your Own UI** | Upload a static build, `ui-update` to follow its releases, `ui-revert` to go back. [UI_CREATION.md](./docs/UI_CREATION.md) |
|
|
286
291
|
| 🔐 **Security** | Cookie sessions, API tokens, scrypt hashes, per-IP lockout, optional TLS, and a refusal to expose itself without a password. |
|
|
287
|
-
| 🧩 **
|
|
292
|
+
| 🧩 **Bring any program** | A server is `command` + `args` + `env` + `cwd` — if it runs in a shell, it runs here. Presets fill the form in for common ones; nothing requires one. |
|
|
288
293
|
| 🖥 **Cross-platform** | Linux, macOS and Windows: `/proc`, `ps` or Win32_Process, process groups or `taskkill /T`, no shell dependencies. |
|
|
289
294
|
|
|
290
295
|
---
|
|
@@ -350,7 +355,7 @@ restarts itself), and how hand-edits are validated: [SERVERS.md](./docs/SERVERS.
|
|
|
350
355
|
| `home-hosted stop <id>` | stop one server, nothing else (`--workspace <id>`) |
|
|
351
356
|
| `home-hosted restart <id>` | restart one server, nothing else (`--workspace <id>`) — the same as the panel's per-server Restart |
|
|
352
357
|
| `home-hosted logs` | read the panel's own console output — the file `up` redirects it into (`--lines`, `--follow`, `--json`) |
|
|
353
|
-
| `home-hosted set-password` | set the panel password without opening a browser |
|
|
358
|
+
| `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 |
|
|
354
359
|
| `home-hosted set-token` | set the API token scripts and agents use (`--generate`, `--clear`) |
|
|
355
360
|
| `home-hosted migrate` | bring every config up to the schema this release understands (`--dry-run`, `--yes`) |
|
|
356
361
|
| `home-hosted init` | scaffold a self-contained project, whose scripts keep state in the repo (`--home ./state`) |
|
|
@@ -454,12 +459,13 @@ Everything binds `127.0.0.1` until you say otherwise.
|
|
|
454
459
|
are sealed with AES-256-GCM under `HHOSTED_DDNS_SECRET` (default `hh` — set your own).
|
|
455
460
|
- **Behind a proxy** pick how far to trust it, and let `cookieSecure: auto` add `Secure` on https — or
|
|
456
461
|
upload a PEM pair and let home-hosted terminate TLS itself.
|
|
457
|
-
- **`loopback`** trusts `x-forwarded-*` only when the request
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
- **on** trusts the header from *any* peer. Only when the proxy is the only way in: the client
|
|
461
|
-
then comes from the caller's own header, so the per-IP lockout counts per *forged*
|
|
462
|
-
throttling brute force. The panel warns at startup when that combination is
|
|
462
|
+
- **`loopback`** trusts `x-forwarded-*` only when the request came from this machine. Right for a
|
|
463
|
+
proxy on the same host: the panel gets the real client address for its lockout and the logs, and
|
|
464
|
+
a forged header from anywhere else is ignored.
|
|
465
|
+
- **on** trusts the header from *any* peer. Only when the proxy is the only way in: the client
|
|
466
|
+
address then comes from the caller's own header, so the per-IP lockout counts per *forged*
|
|
467
|
+
address and stops throttling brute force. The panel warns at startup when that combination is
|
|
468
|
+
exposed.
|
|
463
469
|
- **off** ignores the header entirely. Use it when nothing sits in front, or when the proxy does not set
|
|
464
470
|
one.
|
|
465
471
|
|
|
@@ -492,19 +498,19 @@ Provider tokens stay in the workspace's secrets file. **Providers and the config
|
|
|
492
498
|
## 💾 Backups
|
|
493
499
|
|
|
494
500
|
**Global settings → Backups** archives the panel's own settings, its secrets and the TLS pair — plus
|
|
495
|
-
every workspace you pick. It is two-level:
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
**Automatic backups** write one archive on a schedule you set — the page asks in hours
|
|
504
|
-
stores `intervalMs` — with a retention of its own (`Keep automatic`). The two counts are independent:
|
|
505
|
-
and a scheduled pass never prunes one of yours to make
|
|
506
|
-
directory, and an automatic archive is named `auto-…` so you
|
|
507
|
-
in by hand with that prefix is treated as one, so do not use it.
|
|
501
|
+
every workspace you pick. It is two-level: *Create backup…* lists the global items and each workspace;
|
|
502
|
+
opening one lists its **settings**, **servers**, **secrets** and every data directory its entries
|
|
503
|
+
declare, and you can drop any single piece. Each secret has its own checkbox. *Restore…* shows the
|
|
504
|
+
same list from an archive before anything is written. Either way it is an ordinary `.zip`, or WinZip
|
|
505
|
+
AES-256 with a password, restored per path. Build output and dependency directories (`node_modules`,
|
|
506
|
+
`dist`, `.next`, framework caches) are skipped per entry; `backupIgnoreGenerated: false` captures them
|
|
507
|
+
anyway.
|
|
508
|
+
|
|
509
|
+
**Automatic backups** write one archive on a schedule you set — the page asks in hours, the config
|
|
510
|
+
stores `intervalMs` — with a retention of its own (`Keep automatic`). The two counts are independent:
|
|
511
|
+
`Keep` bounds the archives you take by hand, and a scheduled pass never prunes one of yours to make
|
|
512
|
+
room for its own. Both land in the same directory, and an automatic archive is named `auto-…` so you
|
|
513
|
+
can tell them apart — a name you drop in by hand with that prefix is treated as one, so do not use it.
|
|
508
514
|
|
|
509
515
|
<details>
|
|
510
516
|
<summary><b>🔑 Restoring a secret</b></summary>
|
|
@@ -520,7 +526,7 @@ Two things to know before restoring onto a machine already in use:
|
|
|
520
526
|
|
|
521
527
|
- **The password hash and API token hash are secrets like any other.** Restoring them reinstates the
|
|
522
528
|
old machine's password and long-lived token, so anyone holding that token keeps access. Leave them
|
|
523
|
-
unticked, or rotate afterwards with `
|
|
529
|
+
unticked, or rotate afterwards with `home-hosted set-token --generate`.
|
|
524
530
|
- **`HHOSTED_DDNS_SECRET` is not in the archive.** DDNS credentials travel sealed under it, so a host
|
|
525
531
|
with a different value cannot open them. Supply the same secret, or re-enter the credentials.
|
|
526
532
|
|
|
@@ -530,14 +536,62 @@ Two things to know before restoring onto a machine already in use:
|
|
|
530
536
|
<summary><b>🚚 One archive is a whole setup</b></summary>
|
|
531
537
|
|
|
532
538
|
Start a **blank** home-hosted anywhere — another machine, another user, a fresh container — upload the
|
|
533
|
-
archive and restore. Definitions come back,
|
|
534
|
-
`autostart` entries come up
|
|
539
|
+
archive and restore. Definitions come back, workspaces the target has never heard of are created with
|
|
540
|
+
their labels, data lands where *this* machine's config says, and `autostart` entries come up
|
|
541
|
+
immediately.
|
|
535
542
|
|
|
536
|
-
It works because an archive carries each workspace's `settings.json` and
|
|
537
|
-
paths are matched by the **declaration** (`omniroute:DATA_DIR`), not by an
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
543
|
+
It works because an archive carries the workspace registry, each workspace's `settings.json` and
|
|
544
|
+
`servers.config.json`, and paths are matched by the **declaration** (`omniroute:DATA_DIR`), not by an
|
|
545
|
+
absolute path from the source machine. A declaration using `{projectDir}`, `{dataRoot}` or `{home}`
|
|
546
|
+
follows the restoring panel (`{projectDir}` is `HHOSTED_PROJECT` or the panel's cwd, not
|
|
547
|
+
`HHOSTED_HOME`); a literal absolute path is restored to that same path.
|
|
548
|
+
|
|
549
|
+
**A restore never writes where no config declares, and never across workspaces.** A data path is only
|
|
550
|
+
placed under a workspace the archive says it belongs to — if that workspace's `servers.config.json` is
|
|
551
|
+
not part of the restore, its data is reported as skipped rather than guessed at.
|
|
552
|
+
|
|
553
|
+
</details>
|
|
554
|
+
|
|
555
|
+
<details>
|
|
556
|
+
<summary><b>✅ What comes back, and what you still have to do</b></summary>
|
|
557
|
+
|
|
558
|
+
| | Restored | Still yours to do |
|
|
559
|
+
| --- | --- | --- |
|
|
560
|
+
| Panel settings, listener, host vitals, backups policy | ✅ | Restart the panel if the listener or TLS policy changed (the plan says so) |
|
|
561
|
+
| Workspaces, their order and labels | ✅ | — |
|
|
562
|
+
| `servers.config.json`, server defaults, log retention | ✅ | `autostart` entries start by themselves; the rest are one *Start* away |
|
|
563
|
+
| Data directories each entry declares | ✅ | Nothing — but see the consistency note below |
|
|
564
|
+
| Telegram bots and chats, webhook targets | ✅ | Send a test from *Notifications* if the chat id came from another account |
|
|
565
|
+
| DDNS hostnames and their accounts | ✅ | Credentials only open under the same `HHOSTED_DDNS_SECRET`; otherwise re-enter them |
|
|
566
|
+
| Panel password and API token | ⬜ ticked per secret | Leave unticked, or rotate with `home-hosted set-token --generate` |
|
|
567
|
+
| Reverse-proxy routes | ✅ | Automatic HTTPS certificates are reissued by the engine on the new host. A pair **you uploaded** for a `tls: "manual"` route is not in the archive — re-upload it |
|
|
568
|
+
| Reverse-proxy engine binary | ❌ | Installed again from *Global settings → Reverse proxy* |
|
|
569
|
+
| Server logs, crash history, nanny state | ❌ | These describe the old box; the new one starts a fresh history |
|
|
570
|
+
| A server's `envFile` | ❌ not archived | It is the machine-local layer by design — copy it yourself, or declare its directory in `backupPaths` |
|
|
571
|
+
| Environment variables the panel runs with | ❌ | `HHOSTED_*`, `HHOSTED_DDNS_SECRET`, and anything a `${ENV}` placeholder needs |
|
|
572
|
+
|
|
573
|
+
</details>
|
|
574
|
+
|
|
575
|
+
<details>
|
|
576
|
+
<summary><b>⚠️ A backup of a running database may not be restorable</b></summary>
|
|
577
|
+
|
|
578
|
+
Data directories are copied file by file while your servers keep running — the panel does not stop or
|
|
579
|
+
freeze anything to take an archive, because doing so would mean a backup could take your services down.
|
|
580
|
+
|
|
581
|
+
That is fine for files, uploads and most app data. It is **not** a consistent snapshot of a live
|
|
582
|
+
database: SQLite mid-transaction, a Postgres data directory, or a WAL in the middle of a write can all
|
|
583
|
+
be captured torn, and the copy will look complete while failing to open.
|
|
584
|
+
|
|
585
|
+
For anything with a real database, do one of these before relying on the archive:
|
|
586
|
+
|
|
587
|
+
- **Quiesce it** — stop that entry from the panel, take the backup, start it again; or
|
|
588
|
+
- **dump it properly** (`sqlite3 app.db ".backup out.db"`, `pg_dump`, `mysqldump`) into a directory you
|
|
589
|
+
declare in `backupPaths`, so the archive carries the dump rather than the live files.
|
|
590
|
+
|
|
591
|
+
**Restoring** has the mirror-image hazard, and the plan names it: a data path copied over while its
|
|
592
|
+
server is running is replaced under a live process, which keeps its old view and loses whatever it
|
|
593
|
+
wrote since. The restore reports those entries — `Data was replaced under a running server` — and
|
|
594
|
+
the fix is to stop and start each one, or stop them before applying.
|
|
541
595
|
|
|
542
596
|
</details>
|
|
543
597
|
|
|
@@ -553,7 +607,11 @@ Two ship in this repo: `uis/stock`, and `uis/noc-console` for TUI and shortcuts
|
|
|
553
607
|
attaches both as `home-hosted-ui-<name>.zip`. Yours can be anything that compiles to static files —
|
|
554
608
|
the server never cares what built it.
|
|
555
609
|
|
|
556
|
-
<sub>Install a UI from the CLI: `home-hosted ui-switch
|
|
610
|
+
<sub>Install a UI from the CLI: `home-hosted ui-switch --asset noc-console` selects a UI directly, and
|
|
611
|
+
with no flags it lists the official assets to pick from. An official UI is switched to the version
|
|
612
|
+
that matches your panel when you update `home-hosted`. For unofficial UIs, `home-hosted ui-update`
|
|
613
|
+
offers their newer releases — or `--old` for older ones (the author sets up `ui.json` and GitHub
|
|
614
|
+
releases).</sub>
|
|
557
615
|
|
|
558
616
|
<details>
|
|
559
617
|
<summary><b>🤖 Or have an agent build the UI you actually want</b></summary>
|
|
@@ -574,8 +632,8 @@ specific:
|
|
|
574
632
|
<details>
|
|
575
633
|
<summary><b>The panel is up but something is wrong — where do I look?</b></summary>
|
|
576
634
|
|
|
577
|
-
`home-hosted logs` prints the panel's own console output
|
|
578
|
-
|
|
635
|
+
`home-hosted logs` prints the panel's own console output — what it is doing, and anything it could
|
|
636
|
+
not finish:
|
|
579
637
|
|
|
580
638
|
```bash
|
|
581
639
|
home-hosted logs # the last 50 lines
|
|
@@ -584,9 +642,8 @@ home-hosted logs --lines all # the whole thing, including the rotation
|
|
|
584
642
|
home-hosted logs --json # { path, lines } — or one object per line with --follow
|
|
585
643
|
```
|
|
586
644
|
|
|
587
|
-
It
|
|
588
|
-
|
|
589
|
-
the panel fails to start.
|
|
645
|
+
It reads the same file `status` names, and needs no session or API token — a panel answering badly is
|
|
646
|
+
exactly when you cannot get one. `up` prints the tail when the panel fails to start.
|
|
590
647
|
|
|
591
648
|
</details>
|
|
592
649
|
|
|
@@ -641,7 +698,7 @@ run.json the running panel (pid, url, token, mode 0600)
|
|
|
641
698
|
<workspace>/servers.config.json your servers, plus meta: which release and schema wrote it
|
|
642
699
|
<workspace>/.secrets.json Telegram token + DDNS credentials (mode 0600)
|
|
643
700
|
<workspace>/.logs/ per-server logs: <id>.log, rotated to <id>.log.1 … (newest first)
|
|
644
|
-
<workspace>/.state/
|
|
701
|
+
<workspace>/.state/ nanny state, the last detached child (<id>.run.json) and ddns.json
|
|
645
702
|
```
|
|
646
703
|
|
|
647
704
|
`home-hosted status` prints the paths.
|
|
@@ -656,9 +713,9 @@ proxy is the one panel-wide listener, and only when you switch it on: `80`/`443`
|
|
|
656
713
|
or `4480`/`4443` unprivileged with your router forwarding to them
|
|
657
714
|
([REVERSE_PROXY.md](./docs/REVERSE_PROXY.md#ports)).
|
|
658
715
|
|
|
659
|
-
**If that port is taken, `up` names
|
|
660
|
-
|
|
661
|
-
an unrelated listener is never signalled
|
|
716
|
+
**If that port is taken, `up` names the pid holding it** when the OS will say — rather than only
|
|
717
|
+
reporting the number — and exits, so a second panel never starts beside the first. A `follow` entry
|
|
718
|
+
adopts the process that replaced it; an unrelated listener is never signalled
|
|
662
719
|
([SERVERS.md](./docs/SERVERS.md#a-busy-port)).
|
|
663
720
|
|
|
664
721
|
</details>
|