feat: update to version 0.1.3 with new CLI flags, logging enhancements, and Windows MSI installer

This commit is contained in:
serversdwn
2026-02-10 07:08:24 +00:00
parent edeb6a6eba
commit 69e856db6a
9 changed files with 424 additions and 57 deletions

114
installer/Product.wxs Normal file
View File

@@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Id="*"
Name="Thor Ingest Agent"
Language="1033"
Version="0.1.3"
Manufacturer="Seismo"
UpgradeCode="0E2EFA7E-2A75-4A2E-A5D5-9E9C6B99C0E1">
<Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" Platform="x64" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="INSTALLFOLDER" Name="ThorIngest">
<Component Id="MainExecutable" Guid="9A9F3E64-93A0-4D9F-8D2E-1C4B8B9E5E7A">
<File Id="ThorIngestExe" Source="..\dist\thor-ingest-agent.exe" KeyPath="yes" />
</Component>
<Component Id="ConfigExample" Guid="A6B1877F-3C8C-4CE1-9C30-70C8E2D6CB8F">
<File Id="ConfigExampleFile" Source="..\config.example.json" KeyPath="yes" />
</Component>
<Component Id="NssmBinary" Guid="F9E2D403-4F1C-4E55-8A34-0D7CBA74F2BC">
<File Id="NssmExe" Source="tools\nssm.exe" KeyPath="yes" />
</Component>
</Directory>
</Directory>
<Directory Id="CommonAppDataFolder">
<Directory Id="ProgramDataThorIngest" Name="ThorIngest">
<Directory Id="ProgramDataLogs" Name="logs" />
</Directory>
</Directory>
</Directory>
<Feature Id="MainFeature" Title="Thor Ingest Agent" Level="1">
<ComponentRef Id="MainExecutable" />
<ComponentRef Id="ConfigExample" />
<ComponentRef Id="NssmBinary" />
</Feature>
<CustomAction
Id="CreateProgramDataDirs"
Directory="TARGETDIR"
ExeCommand="cmd.exe /c if not exist &quot;[CommonAppDataFolder]ThorIngest\&quot; mkdir &quot;[CommonAppDataFolder]ThorIngest\&quot; &amp; if not exist &quot;[CommonAppDataFolder]ThorIngest\logs\&quot; mkdir &quot;[CommonAppDataFolder]ThorIngest\logs\&quot;"
Execute="deferred"
Impersonate="no"
Return="check" />
<CustomAction
Id="CopyDefaultConfig"
Directory="TARGETDIR"
ExeCommand="cmd.exe /c if not exist &quot;[CommonAppDataFolder]ThorIngest\config.json&quot; copy &quot;[INSTALLFOLDER]config.example.json&quot; &quot;[CommonAppDataFolder]ThorIngest\config.json&quot;"
Execute="deferred"
Impersonate="no"
Return="check" />
<CustomAction
Id="InstallService"
Directory="INSTALLFOLDER"
ExeCommand="&quot;[INSTALLFOLDER]nssm.exe&quot; install ThorIngest &quot;[INSTALLFOLDER]thor-ingest-agent.exe&quot; --config &quot;[CommonAppDataFolder]ThorIngest\config.json&quot; --log-dir &quot;[CommonAppDataFolder]ThorIngest\logs&quot;"
Execute="deferred"
Impersonate="no"
Return="check" />
<CustomAction
Id="ConfigureServiceStart"
Directory="INSTALLFOLDER"
ExeCommand="&quot;[INSTALLFOLDER]nssm.exe&quot; set ThorIngest Start SERVICE_AUTO_START"
Execute="deferred"
Impersonate="no"
Return="check" />
<CustomAction
Id="ConfigureServiceRestart"
Directory="INSTALLFOLDER"
ExeCommand="&quot;[INSTALLFOLDER]nssm.exe&quot; set ThorIngest AppExit Default Restart"
Execute="deferred"
Impersonate="no"
Return="check" />
<CustomAction
Id="StartService"
Directory="INSTALLFOLDER"
ExeCommand="&quot;[INSTALLFOLDER]nssm.exe&quot; start ThorIngest"
Execute="deferred"
Impersonate="no"
Return="check" />
<CustomAction
Id="RemoveService"
Directory="INSTALLFOLDER"
ExeCommand="&quot;[INSTALLFOLDER]nssm.exe&quot; remove ThorIngest confirm"
Execute="deferred"
Impersonate="no"
Return="check" />
<InstallExecuteSequence>
<Custom Action="CreateProgramDataDirs" After="InstallFiles">NOT Installed</Custom>
<Custom Action="CopyDefaultConfig" After="CreateProgramDataDirs">NOT Installed</Custom>
<Custom Action="InstallService" After="CopyDefaultConfig">NOT Installed</Custom>
<Custom Action="ConfigureServiceStart" After="InstallService">NOT Installed</Custom>
<Custom Action="ConfigureServiceRestart" After="ConfigureServiceStart">NOT Installed</Custom>
<Custom Action="StartService" After="ConfigureServiceRestart">NOT Installed</Custom>
<Custom Action="RemoveService" Before="RemoveFiles">REMOVE="ALL"</Custom>
</InstallExecuteSequence>
<UIRef Id="WixUI_Minimal" />
<UIRef Id="WixUI_ErrorProgressText" />
</Product>
</Wix>

21
installer/README.md Normal file
View File

@@ -0,0 +1,21 @@
# Thor Ingest MSI Installer
This folder contains the WiX MSI definition and build script.
## Prerequisites
- WiX Toolset v3.11+ (set `WIX` env var to the WiX `bin` path)
- `nssm.exe` placed at `installer/tools/nssm.exe`
- `thor-ingest-agent.exe` built into `thor-ingest-agent/dist/`
## Build
```powershell
./build.ps1
```
The MSI output will be:
```
installer/ThorIngest.msi
```

30
installer/build.ps1 Normal file
View File

@@ -0,0 +1,30 @@
$ErrorActionPreference = "Stop"
$WixBin = $env:WIX
if (-not $WixBin) {
Write-Error "WIX environment variable not set. Set WIX to your WiX Toolset bin path (e.g., C:\Program Files (x86)\WiX Toolset v3.11\bin)."
}
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$InstallerDir = $ScriptDir
$RootDir = Resolve-Path (Join-Path $InstallerDir "..")
$ProductWxs = Join-Path $InstallerDir "Product.wxs"
$DistDir = Join-Path $RootDir "dist"
$NssmPath = Join-Path $InstallerDir "tools\nssm.exe"
if (-not (Test-Path $DistDir)) {
Write-Error "dist folder not found. Build the EXE with PyInstaller first."
}
if (-not (Test-Path $NssmPath)) {
Write-Error "Missing nssm.exe at $NssmPath. Place the NSSM binary there before building."
}
$candle = Join-Path $WixBin "candle.exe"
$light = Join-Path $WixBin "light.exe"
& $candle -nologo $ProductWxs -out (Join-Path $InstallerDir "Product.wixobj")
& $light -nologo -ext WixUIExtension -ext WixUtilExtension -out (Join-Path $InstallerDir "ThorIngest.msi") (Join-Path $InstallerDir "Product.wixobj")
Write-Host "Built MSI: $InstallerDir\ThorIngest.msi"

View File

@@ -0,0 +1 @@
Place nssm.exe in this folder before building the MSI.