Skip to content

v2.1.0 — Run nodes as a Windows service

Choose a tag to compare

@iovigi iovigi released this 10 Jul 22:18

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 of InferHub.Node/Program.cs into NodeHostBuilderExtensions.AddInferHubNode(this IHostApplicationBuilder). The console Program.cs is now a two-liner. One place to register node services; the two hosts can never drift.
  • New project InferHub.Node.WindowsService. A thin Sdk.Worker host (InferHub.Node.Service.exe) that calls AddWindowsService() + 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-id file) 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.Node behaves exactly as v2.0.0 — the refactor is behaviour-preserving.
  • Core stayed host-agnostic. No Windows/ASP.NET types leaked into InferHub.Shared or the node's Configuration/. The only new dependency is first-party Microsoft.Extensions.Hosting.WindowsServices, in the new project only.
  • dotnet test green: 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" -DelayedStart

What'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.