home-hosted 0.9.9 → 0.9.11

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.
@@ -175,31 +175,64 @@ construction.
175
175
 
176
176
  ## Restoring onto a blank host
177
177
 
178
+ `restore` takes the archive's **file name**, not a path: the name is the allowlist entry, which is
179
+ what keeps a restore from being pointed at any file on the host. Copy the archive into the backups
180
+ directory first — `home-hosted backup list` prints that directory, and the refusal names it too:
181
+
178
182
  ```console
179
- $ home-hosted backup restore backup-2026-10-21-04-15-49-881.zip
180
- Plan for backup-2026-10-21-04-15-49-881.zip — nothing has been written yet
181
- settings global:settings
182
- secrets global:secrets
183
- secrets global:secrets:password
184
- secrets global:secrets:apiToken
185
- settings workspace:default:settings
186
- servers workspace:default:servers
187
- data workspace:default:data:/srv/blog/dump
183
+ $ home-hosted backup restore /media/usb/backup-2026-10-21-04-15-49-881.zip --all --confirm
184
+ error no backup named "/media/usb/backup-2026-10-21-04-15-49-881.zip" in /home/you/.home-hosted/.hh/.backups — a restore takes the archive's file name, not a path; copy it there first
185
+ ```
188
186
 
189
- apply it with `home-hosted backup restore backup-2026-10-21-04-15-49-881.zip --confirm`
187
+ ```console
188
+ $ home-hosted backup restore backup-2026-10-21-04-15-49-881.zip --all
189
+ Plan for backup-2026-10-21-04-15-49-881.zip — nothing has been written yet
190
+ global
191
+ - global:settings
192
+ - global:secrets
193
+ - global:secrets:password
194
+ - global:secrets:apiToken
195
+ workspace
196
+ - workspace:default
197
+ - workspace:default:settings
198
+ - workspace:default:servers
199
+ - workspace:default:data
200
+ - workspace:default:data:/srv/blog/dump
201
+
202
+ not applied — this session cannot ask. Re-run with `--confirm` to apply.
190
203
  ```
191
204
 
192
205
  The plan comes first, always. A restore writes over live data, so the default is to say what it
193
- *would* do.
206
+ *would* do — and like `create`, it needs a scope: `--all`, or `--include <ids>`. Neither flag is
207
+ refused, and that refusal lists the ids the archive actually holds.
194
208
 
195
209
  ```console
196
- $ home-hosted backup restore backup-2026-10-21-04-15-49-881.zip --confirm
210
+ $ home-hosted backup restore backup-2026-10-21-04-15-49-881.zip --all --confirm
197
211
  restored 7 items from backup-2026-10-21-04-15-49-881.zip
198
212
  ```
199
213
 
200
214
  The workspace did not exist on this host. It was created, not skipped: an archive is a whole machine's
201
215
  setup, and refusing it because the id is new would make a blank-host restore impossible.
202
216
 
217
+ ### When a restore cannot do what you asked
218
+
219
+ A restore that writes nothing **exits 1 and says why** — never *"restored 0 items"* with a success
220
+ status. The same is true of a wrong or missing password on an encrypted archive, and of an archive
221
+ from a newer config schema:
222
+
223
+ ```console
224
+ $ home-hosted backup restore backup-2026-10-21-04-15-49-881.zip --all --confirm
225
+ error this backup is password-protected — add `--password <text>` to unlock it
226
+
227
+ $ home-hosted backup restore old.zip --all --confirm
228
+ error written by home-hosted 0.8.0 (config schema 1); this release understands schema 2
229
+ ```
230
+
231
+ A restore that applies **some** of an archive carries on and names every piece it had to leave
232
+ behind, marked `!`, so a partial result never reads as a complete one. A mistyped `--include` or
233
+ `--exclude` is refused before anything is written, naming the id — the dangerous direction being
234
+ `--exclude`, where a typo would exclude nothing and apply the credentials you meant to drop.
235
+
203
236
  Then the entry starts, and the database is read back:
204
237
 
205
238
  ```console
package/docs/SERVERS.md CHANGED
@@ -23,7 +23,10 @@ Pick one in the header; the workspace's server defaults and log retention sit in
23
23
  ```
24
24
 
25
25
  Relative paths resolve against the directory you ran `home-hosted` from, so a project can keep its
26
- servers and its state together.
26
+ servers and its state together. **A service manager starts you somewhere else:** systemd uses `/`
27
+ unless the unit sets `WorkingDirectory=`, and `docker run` does too without `-w`. Every relative
28
+ `cwd`, `{projectDir}` and `dataEnvs` then points under `/`, and the entry fails to start. Pin the
29
+ base with `--project`, `$HHOSTED_PROJECT`, or the unit's `WorkingDirectory=`.
27
30
 
28
31
  ## Presets
29
32
 
@@ -57,7 +60,7 @@ platform cannot confirm is exactly what the rest of this file refuses to signal
57
60
 
58
61
  | field | what it does |
59
62
  | --- | --- |
60
- | `command`, `args`, `cwd` | what to run. `{placeholders}` resolve in `args` only (`env`, `dataEnvs`, `backupPaths` and `bootstrap.args` too); `command`, `cwd` and `envFile` are used literally, so `cwd: "~/app"` is not a home directory |
63
+ | `command`, `args`, `cwd` | what to run. `{placeholders}` resolve in `args` only (`env`, `dataEnvs`, `backupPaths` and `bootstrap.args` too); `command`, `cwd` and `envFile` are used literally, so `cwd: "~/app"` is not a home directory. **`command` is a program, not a command line** — it is spawned with no shell, so `"node server.js"` asks for a program of that name; write `"command": "node", "args": ["server.js"]` |
61
64
  | `env`, `dataEnvs`, `envFile` | environment; `dataEnvs` also marks data directories for backups, `envFile` keeps secrets out of the config |
62
65
  | `enabled` | `true` (default) starts it; `false` keeps the entry in the config but refuses to start it, stops it if it is running, and leaves a disabled `persistent` entry unattached at boot |
63
66
  | `port`, `bind` | enables the readiness wait, health checks and the conflict preflight; `local` keeps it on `127.0.0.1` |
@@ -222,6 +225,19 @@ set onPortConflict to "follow" to adopt it, "reclaim" to replace it with a super
222
225
  or "kill" to stop whatever holds the port
223
226
  ```
224
227
 
228
+ **A holder that belongs to another workspace is never adopted or killed.** A server id is only unique
229
+ inside its workspace, but the process is the panel's, so the panel checks every workspace before it
230
+ treats a listener as a stranger. The refusal names the workspace and entry to go and stop, because that
231
+ server is not on the page you are looking at:
232
+
233
+ ```text
234
+ port 7021 is held by pid 2505354, which this panel supervises on media-box/photos —
235
+ stop that server instead
236
+ ```
237
+
238
+ The same rule reaches `free-port` and `stop.killPortHolders`: a port is never freed from under another
239
+ workspace's entry.
240
+
225
241
  ### An entry with no port that outlived the panel
226
242
 
227
243
  A port is what makes the checks above possible, so an entry with **no port** has none of them. A
@@ -328,3 +344,8 @@ restart needed:
328
344
 
329
345
  A save from the panel's own UI is the panel's write: it replaces the file, so hand-edits made while
330
346
  it runs are lost by that next save. Edit, then let the panel read it back, before using the UI.
347
+
348
+ Whatever encoding your editor puts on the file is fine. A UTF-8 **byte-order mark** (Notepad's
349
+ "UTF-8 with BOM", PowerShell 5.1's `Set-Content -Encoding UTF8`) and the **UTF-16LE** that
350
+ `Out-File` and `>` write on Windows are both read as the JSON they hold, so the panel only ever
351
+ complains about the JSON itself.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "home-hosted",
3
3
  "type": "module",
4
- "version": "0.9.9",
4
+ "version": "0.9.11",
5
5
  "packageManager": "pnpm@12.5.1",
6
6
  "description": "Self-hosted control panel that keeps your home-server processes alive: supervision, restarts, port conflicts, logs — and a UI you can replace.",
7
7
  "author": "NamesMT <dangquoctrung123@gmail.com>",