fix: preserve Windows agent tasks during upgrades

This commit is contained in:
lussierj committed 2026-08-25 15:56:35 +00:00
1 parent f5965af914
commit d8cd7ad058
4 files changed
+255 -34

No files matched your search

+17 -8
View File
@@ -51,15 +51,24 @@ Deploy Agent compatibility before enabling Hub enforcement of the
reports the expected non-secret `VERSION`.
5. Enable the matching Agent ID and shared secret on the Hub.
The installer copies runtime code to `C:\MinerOpsAgent`, preserves
`agent-config.json`, `agent-state.json`, and `logs\`, and registers or
updates `MinerOpsAgent`, `MinerOpsAgentTray`,
`MinerOpsApi3Enrichment`, and `MinerOpsPoolPoller`.
The installer copies only managed runtime code to `C:\MinerOpsAgent` and
preserves `agent-config.json`, `agent-state.json`, `logs\`, backups, probe
output, and other runtime data. During an upgrade, existing definitions for
`MinerOpsAgent`, `MinerOpsAgentTray`, `MinerOpsApi3Enrichment`, and
`MinerOpsPoolPoller` are authoritative and are not rewritten. Missing tasks are
created for a fresh or incomplete installation without hard-coded user names.
If `MinerOpsAgent` was running before an upgrade, the installer stops only that
Scheduled Task, waits for it to stop, replaces the managed files, and starts it
again. A previously stopped Agent remains stopped. The tray and periodic tasks
are not unnecessarily restarted.
Before replacing existing runtime files, the installer copies them to a
timestamped folder under `C:\MinerOpsAgent\backups`. To roll back, stop the
Agent tasks, copy the selected backup's runtime files back into
`C:\MinerOpsAgent`, and restart the tasks. `uninstall.ps1` unregisters the
four tasks and removes runtime code while preserving local configuration,
timestamped folder under `C:\MinerOpsAgent\backups`. A failed deployment
automatically restores those managed files, removes tasks created by that
failed attempt, and restores the main Agent's prior running state. For a manual
rollback, stop `MinerOpsAgent`, restore the selected backup's runtime files,
and restart it only if it was previously running. `uninstall.ps1` unregisters
the four tasks and removes runtime code while preserving local configuration,
state, logs, and backups.