Install and update from the admin page: repo catalog, module version requirements, shell updates
ProdDash now has a version (package.json, 1.1.0) and modules declare the
shell versions they need ("proddash": ">=1.1.0" in the manifest). A module
whose requirement this shell doesn't meet is listed in the admin page but
never loaded, and cannot be installed from the catalog.
Modules come from two places: bundled with the checkout (modules/) and
installed from the admin page into the data directory (<data dir>/modules/).
Same id in both → the newer version runs; a downloaded copy the bundled one
has overtaken is removed. The admin page's new "Available modules" section
lists modules in the ProdDash repo that aren't installed here — one small
tar.gz of the branch is fetched (at most every few minutes, only while the
admin page is open or for the periodic update check) and read with a
dependency-free tar reader (ustar, GNU long names, pax headers; the pax
global comment carries the commit sha). Install downloads the module folder
into the data directory and mounts it immediately; a module card offers
"Update to vX" when the repo has a newer version. Uninstall removes an
installed module's files; a bundled module is hidden instead (its folder
belongs to the app) and can be restored from Available modules without a
download. Settings are kept across uninstall/reinstall.
Shell updates: the server compares the repo's package.json version and
commit sha with its own (git rev-parse when the app folder is a checkout),
shows a banner in the admin page, and "Update now" brings the app folder up
to date — git pull --ff-only for a checkout that is on the repo branch with
no local changes (file modes ignored), otherwise the archive is unpacked over
the folder (runtime state and .git untouched). The server then exits with
code 75 and starts its own replacement unless PRODDASH_LAUNCHER is set; the
replacement waits for the port to free up (EADDRINUSE retry). The page polls
until the new version answers. PRODDASH_REPO (owner/repo#branch),
PRODDASH_ARCHIVE_BASE and PRODDASH_NO_REMOTE_CHECK configure/disable it.
Docs: MODULE-GUIDE gets the rules every module follows (all settings in the
admin page, dependencies shipped inside the module, everything runs inside
the module's server entry — no helper programs, declare the ProdDash
requirement and bump the version), the proddash/version manifest fields and
the new installation story; README gets "Installing modules and updating";
CLAUDE.md summarises the rules.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RNYUv9EyrGSFmCnmH7WYKH
This commit is contained in:
+39
-4
@@ -9,6 +9,31 @@ their own dashboards, move and resize them, and give each tile its own
|
||||
per-tile settings. Your module renders inside the tile and talks to the
|
||||
outside world only through the small API the shell hands it.
|
||||
|
||||
## Rules every module follows
|
||||
|
||||
These are not style preferences — the admin page, the installer and the
|
||||
people running the booth depend on them.
|
||||
|
||||
1. **All settings live in the ProdDash admin page.** Server-wide settings go
|
||||
in `configSchema`, per-tile settings in `instanceSchema`. Never a separate
|
||||
setup page, wizard, config file the operator edits by hand, or environment
|
||||
variable.
|
||||
2. **Dependencies ship inside the module folder.** Zero dependencies is the
|
||||
norm (the shell has none). Anything you genuinely need is vendored into
|
||||
the module — or fetched by your own `init()` on first start, with the
|
||||
admin health line saying what is happening. No `npm install`, no
|
||||
installer, no "run this first".
|
||||
3. **Everything the module does runs inside the module.** No helper scripts,
|
||||
companion programs, daemons or services the operator has to start next to
|
||||
ProdDash. If your feature needs a listener, a decoder or a worker, your
|
||||
server entry owns it: start it in `init()`, stop it in `stop()`, report
|
||||
it in `health()`. A child process the module itself spawns and supervises
|
||||
is fine; a program someone launches by hand is not.
|
||||
4. **Declare the ProdDash version you need** (`"proddash": ">=1.1.0"` in the
|
||||
manifest) and **bump your own `version`** whenever you change the module.
|
||||
The admin page refuses to install a module whose requirement the running
|
||||
shell doesn't meet, and it offers updates by comparing versions.
|
||||
|
||||
## The shape of a module
|
||||
|
||||
A module is one folder dropped into `modules/`:
|
||||
@@ -21,9 +46,16 @@ modules/<id>/
|
||||
└── ... assets (css, images…) served statically at /modules/<id>/
|
||||
```
|
||||
|
||||
**Installation is exactly this:** copy the folder into `modules/`, restart
|
||||
ProdDash (`node server.js`), then configure and enable it at `/admin`. No
|
||||
shell code changes, ever.
|
||||
**Installation is exactly this:** in the admin page, open **Available
|
||||
modules** and press **Install** — the module is downloaded from the ProdDash
|
||||
repo into the server's data directory (`<data dir>/modules/<id>/`) and starts
|
||||
immediately. Developing locally? Drop the folder into `modules/` (bundled
|
||||
with the checkout) or into the data directory's `modules/` and restart. No
|
||||
shell code changes, ever. Modules bundled with a checkout and modules
|
||||
installed from the admin page live side by side; when both have the same id
|
||||
the newer version runs. **Uninstall** in the admin page removes an installed
|
||||
module's files (a bundled one is hidden instead, since its folder belongs to
|
||||
the app); its settings are kept for a later reinstall.
|
||||
|
||||
## module.json
|
||||
|
||||
@@ -32,6 +64,7 @@ shell code changes, ever.
|
||||
"id": "my-module",
|
||||
"name": "My Module",
|
||||
"version": "1.0.0",
|
||||
"proddash": ">=1.1.0",
|
||||
"description": "One line shown in the Add-tile picker and the admin page",
|
||||
"client": "client.js",
|
||||
"server": "server.js",
|
||||
@@ -52,7 +85,9 @@ shell code changes, ever.
|
||||
| --- | --- | --- |
|
||||
| `id` | yes | Must equal the folder name. Lowercase, dashes. |
|
||||
| `name` | yes | Human name shown on the tile header and in menus. |
|
||||
| `version`, `description` | no | Shown in the admin page / picker. |
|
||||
| `version` | yes | Your module's version (`x.y.z`). Bump it on every change — the admin page offers updates when the repo's copy is newer than the installed one. |
|
||||
| `proddash` | yes | The ProdDash versions this module works with: `">=1.1.0"`, `"^1.1.0"`, `">=1.1.0 <2.0.0"`, or `"*"`. A module whose requirement the running shell doesn't meet is listed in the admin page but never loaded, and can't be installed from the catalog. |
|
||||
| `description` | no | Shown in the admin page / picker. |
|
||||
| `client` | yes | Client entry file, loaded as an ES module. |
|
||||
| `server` | no | Server entry file (CommonJS), loaded with `require()`. |
|
||||
| `style` | no | A stylesheet the shell injects once per module. |
|
||||
|
||||
Reference in New Issue
Block a user