@andrian.yablonskyy/thub-coordinator 1.0.12 → 1.0.13
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/README.md +2 -2
- package/package.json +1 -1
- package/src/config.js +6 -3
- package/src/services/updates.js +4 -4
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ The Coordinator loads a plain **JSON** config file (no YAML support). Resolution
|
|
|
44
44
|
"jobs": { "defaultTimeoutSec": 1800, "maxTimeoutSec": 14400 },
|
|
45
45
|
"retention": { "logRetentionDays": 14, "artifactRetentionDays": 30 },
|
|
46
46
|
"artifacts": { "maxUploadMb": 512, "linkTtlHours": 168 },
|
|
47
|
-
"updates": { "
|
|
47
|
+
"updates": { "checkIntervalMin": 15, "registry": null }
|
|
48
48
|
}
|
|
49
49
|
```
|
|
50
50
|
|
|
@@ -161,7 +161,7 @@ Server-rendered Pug templates styled with Bootstrap 5.3, with a little vanilla J
|
|
|
161
161
|
|
|
162
162
|
The Coordinator's own version (`ver. X.Y.Z`) is shown under the TestHub logo, top left of every page.
|
|
163
163
|
|
|
164
|
-
**Versions and self-update.** The Coordinator checks the npm registry for the latest Coordinator, Agent and Client every `updates.
|
|
164
|
+
**Versions and self-update.** The Coordinator checks the npm registry for the latest Coordinator, Agent and Client every `updates.checkIntervalMin` (default 15 minutes, `0` disables; the older `checkIntervalHours` is ignored; `updates.registry` for a private mirror) and on **Check for updates**. A newer Coordinator shows as an **Update app to X.Y.Z** button in the navbar for admins (a badge under the logo for viewers); Agents and Resources show each one's version with an **update available** or pending **→ vX.Y.Z** badge. Admins request self-updates per agent/resource (**Update**, which becomes **Cancel update**) or with **Update all agents** / **Update all clients**, always to the latest version:
|
|
165
165
|
- Clients get a `self-update` command on their next heartbeat and install it through their root `thub-client-update` helper, once none of the host's instances is busy.
|
|
166
166
|
- Agents install it at the start of their next run (`GET /api/v1/agents/me/update`), then re-run the command on the new version.
|
|
167
167
|
- The Coordinator itself: the **Update app** button writes `<dataDir>/update-request.json`; the root `thub-coordinator-update.path` unit (installed by `sudo npm i -g`) runs `npm i -g` for it, and the postinstall restarts the service (the dashboard and API are briefly down). Logs: `journalctl -u thub-coordinator-update`. Without that unit, use `thub-admin self-update` on the host.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrian.yablonskyy/thub-coordinator",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "TestHub Coordinator — job queue, resource registry, scheduler, heartbeat monitor, log/artifact store and web dashboard",
|
|
5
5
|
"main": "src/server.js",
|
|
6
6
|
"engines": {
|
package/src/config.js
CHANGED
|
@@ -54,10 +54,13 @@ const DEFAULTS = {
|
|
|
54
54
|
linkTtlHours: 168
|
|
55
55
|
},
|
|
56
56
|
// New-version check of the Coordinator/Agent/Client packages (README
|
|
57
|
-
// §10.2)
|
|
58
|
-
// registry
|
|
57
|
+
// §10.2), every 15 minutes so a new Coordinator's "Update app" button
|
|
58
|
+
// shows up promptly. 0 disables the periodic check; registry null = the
|
|
59
|
+
// public npm registry (or npm_config_registry). The old
|
|
60
|
+
// `checkIntervalHours` (6) is no longer read — installed configs still
|
|
61
|
+
// carry it from their defaults.
|
|
59
62
|
updates: {
|
|
60
|
-
|
|
63
|
+
checkIntervalMin: 15,
|
|
61
64
|
registry: null
|
|
62
65
|
}
|
|
63
66
|
};
|
package/src/services/updates.js
CHANGED
|
@@ -22,7 +22,7 @@ const fs = require('node:fs'),
|
|
|
22
22
|
// as root when the dashboard writes an update request (README §10.2).
|
|
23
23
|
const UPDATE_PATH_UNIT = '/etc/systemd/system/thub-coordinator-update.path';
|
|
24
24
|
|
|
25
|
-
// Latest published versions, refreshed every `updates.
|
|
25
|
+
// Latest published versions, refreshed every `updates.checkIntervalMin`
|
|
26
26
|
// and on demand from the dashboard. Kept in memory only — a restart just
|
|
27
27
|
// checks again.
|
|
28
28
|
function createUpdatesService({ config }){
|
|
@@ -96,12 +96,12 @@ function createUpdatesService({ config }){
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
function start(){
|
|
99
|
-
const
|
|
100
|
-
if (!(
|
|
99
|
+
const minutes = Number(config.updates.checkIntervalMin);
|
|
100
|
+
if (!(minutes > 0)){
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
checkNow().catch(() => {});
|
|
104
|
-
const timer = setInterval(() => checkNow().catch(() => {}),
|
|
104
|
+
const timer = setInterval(() => checkNow().catch(() => {}), minutes * 60 * 1000);
|
|
105
105
|
timer.unref?.();
|
|
106
106
|
}
|
|
107
107
|
|