@andrian.yablonskyy/thub-coordinator 1.0.9 → 1.0.10

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.
Files changed (2) hide show
  1. package/README.md +15 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -43,7 +43,8 @@ The Coordinator loads a plain **JSON** config file (no YAML support). Resolution
43
43
  "scheduler": { "assignAckTimeoutSec": 15, "requeueOnLost": true, "maxQueuedPerAgent": 20, "tickIntervalSec": 10 },
44
44
  "jobs": { "defaultTimeoutSec": 1800, "maxTimeoutSec": 14400 },
45
45
  "retention": { "logRetentionDays": 14, "artifactRetentionDays": 30 },
46
- "artifacts": { "maxUploadMb": 512, "linkTtlHours": 168 }
46
+ "artifacts": { "maxUploadMb": 512, "linkTtlHours": 168 },
47
+ "updates": { "checkIntervalHours": 6, "registry": null }
47
48
  }
48
49
  ```
49
50
 
@@ -100,6 +101,10 @@ thub-admin jobs clean --yes
100
101
  thub-admin group add ci-nightly --comment "shared CI pool"
101
102
  thub-admin group list
102
103
  thub-admin group remove <groupId>
104
+
105
+ # The Coordinator is only ever updated by hand (never from the dashboard).
106
+ thub-admin check-update # installed vs latest published version
107
+ thub-admin self-update [--to <x.y.z>] # sudo npm i -g; the postinstall restarts the service
103
108
  ```
104
109
 
105
110
  Both `jobs reset` and `jobs clean` refuse to run without `--yes` — there's no undo for either, especially `clean`.
@@ -120,13 +125,14 @@ All endpoints are under `/api/v1`, JSON, and require `Authorization: Bearer <tok
120
125
  | `GET` | `/jobs/:id/logs/stream` | Server-Sent Events: `log`, `state`, `end`. Honors `Last-Event-ID` for resume. |
121
126
  | `GET` | `/jobs/:id/artifacts` | Artifact list with signed download URLs. |
122
127
  | `GET` | `/resources` | Resources with status (read-only). |
128
+ | `GET` | `/agents/me/update` | `{updateTo, latest}` — a self-update requested for the calling agent. |
123
129
 
124
130
  **Resource (Client) endpoints** (used by [thub-client](https://github.com/andrianyablonskyy/thub-client)):
125
131
 
126
132
  | Method | Path | Description |
127
133
  |---|---|---|
128
134
  | `POST` | `/resources/register` | Self-register (every start/restart) using the shared `clientJoinKey`; upserts by `clientId`. `hostInfo.addresses` (`[{iface, address, family}]`) lists the host's non-loopback interface addresses; the request's source address is stored as the external one. |
129
- | `POST` | `/resources/:id/heartbeat` | Heartbeat and self-reported state, plus the current `addresses`; refreshes the external address; response may carry `commands[]`. |
135
+ | `POST` | `/resources/:id/heartbeat` | Heartbeat and self-reported state, plus the current `addresses`; refreshes the external address; response may carry `commands[]` (`cancel-job`, `self-update`). |
130
136
  | `POST` | `/resources/:id/status` | Explicit status change, e.g. a local lock. |
131
137
  | `GET` | `/resources/:id/jobs/next?wait=30` | Long-poll for an assigned job; `204` when nothing arrived within `wait` seconds. |
132
138
  | `POST` | `/jobs/:id/accept` | Acknowledge assignment. |
@@ -155,6 +161,13 @@ Server-rendered Pug templates styled with Bootstrap 5.3, with a little vanilla J
155
161
 
156
162
  The Coordinator's own version (`ver. X.Y.Z`) is shown under the TestHub logo, top left of every page.
157
163
 
164
+ **Versions and self-update.** The Coordinator checks the npm registry for the latest Coordinator, Agent and Client every `updates.checkIntervalHours` (default 6, `0` disables; `updates.registry` for a private mirror) and on **Check for updates**. A newer Coordinator shows as a badge under the logo; 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
+ - 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
+ - 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
+ - The Coordinator itself is updated by hand only: `thub-admin self-update`.
168
+
169
+ A request is cleared when the Agent/Client reports the new version.
170
+
158
171
  ## Data storage
159
172
 
160
173
  SQLite via `better-sqlite3`, WAL mode. Schema migrations are plain numbered SQL files in `src/db/migrations/`, applied automatically at startup. `job_logs` rows are compacted into `artifacts/<jobId>/console.log` when a job finishes and deleted after `logRetentionDays`; artifacts are deleted after `artifactRetentionDays`. See the [main repo's ER diagram](https://github.com/andrianyablonskyy/thub#9-data-storage-sqlite) for the full schema.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrian.yablonskyy/thub-coordinator",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
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": {