v2.1.0 — Run nodes as a Windows service
Run an InferHub node as a native Windows service — auto-start on boot, restart-on-failure recovery, and logging to the Windows Event Log, installed with a single PowerShell script. Rather than bolt Windows hosting onto the core worker, the node's DI wiring is extracted into one shared composition root (AddInferHubNode) that both the cross-platform console host and a new Windows-only host compose. Same node, cleaner packaging; dev/console and Linux paths are untouched.
What's new
- Shared composition root —
AddInferHubNode. The node's entire DI wiring moves out ofInferHub.Node/Program.csintoNodeHostBuilderExtensions.AddInferHubNode(this IHostApplicationBuilder). The consoleProgram.csis now a two-liner. One place to register node services; the two hosts can never drift. - New project
InferHub.Node.WindowsService. A thinSdk.Workerhost (InferHub.Node.Service.exe) that callsAddWindowsService()+AddInferHubNode(), enables the Windows Event Log by default, and sets a 30s shutdown grace so in-flight jobs can drain on stop/reboot. Compiles on the Linux CI matrix too —AddWindowsService()no-ops off Windows. - Optional
Node:DataDirectory. Relocates writable node state (the.inferhub-node-idfile) to e.g.C:\ProgramData\InferHub\Node, so a least-privilege service account that cannot write next to the exe still works. Default is unchanged (content root). - Deployment tooling under
deploy/windows/.install-service.ps1(auto / delayed-auto start, restart-on-failure recovery, data-directory ACL, optional machine-scoped enrollment secret; idempotent),uninstall-service.ps1,update-service.ps1, and an end-to-end runbook. No WiX/MSI — plain PowerShell +sc.exe.
Compatibility
- Nothing changes for existing usage.
dotnet run --project src/InferHub.Nodebehaves exactly as v2.0.0 — the refactor is behaviour-preserving. - Core stayed host-agnostic. No Windows/ASP.NET types leaked into
InferHub.Sharedor the node'sConfiguration/. The only new dependency is first-partyMicrosoft.Extensions.Hosting.WindowsServices, in the new project only. dotnet testgreen: 199 tests.
Install
The attached InferHub-Node-Service-v2.1.0-win-x64.zip contains the self-contained InferHub.Node.Service.exe and the deploy/windows scripts. See deploy/windows/README.md for the full runbook:
./deploy/windows/install-service.ps1 -BinaryPath "C:\Program Files\InferHub\Node\InferHub.Node.Service.exe" -DelayedStartWhat's next
The Linux analog is the same host pattern with builder.Services.AddSystemd() and a .service unit file — a trivial future add on top of the AddInferHubNode extraction.