add automatic deploy and test of insider's builds

This commit is contained in:
Göran Sander
2025-09-26 22:22:14 +02:00
parent d9ee5a8d50
commit 235da81919
3 changed files with 66 additions and 46 deletions

2
.gitignore vendored
View File

@@ -59,3 +59,5 @@ build.cjs
butler-sos
src/config/production_vac.yaml
tmp/
docs/docker-compose/.env
docs/docker-compose/config/production_influxdb_v3.yaml

View File

@@ -19,7 +19,7 @@ The GitHub Actions workflow `insiders-build.yaml` now includes automatic deploym
The deployment workflow supports configurable properties via GitHub repository variables. All have sensible defaults, so configuration is optional:
| Variable Name | Description | Default Value |
|-------------|-------------|---------------|
| ------------------------------------ | ---------------------------------------------------- | --------------------------- |
| `BUTLER_SOS_INSIDER_DEPLOY_RUNNER` | GitHub runner name/label to use for deployment | `host2-win` |
| `BUTLER_SOS_INSIDER_SERVICE_NAME` | Windows service name for Butler SOS | `Butler SOS insiders build` |
| `BUTLER_SOS_INSIDER_DEPLOY_PATH` | Directory path where to deploy the binary | `C:\butler-sos-insider` |
@@ -27,6 +27,7 @@ The deployment workflow supports configurable properties via GitHub repository v
| `BUTLER_SOS_INSIDER_DOWNLOAD_PATH` | Temporary download path for artifacts | `./download` |
**To configure GitHub variables:**
1. Go to your repository → Settings → Secrets and variables → Actions
2. Click on the "Variables" tab
3. Click "New repository variable"
@@ -34,6 +35,7 @@ The deployment workflow supports configurable properties via GitHub repository v
5. The workflow will automatically use these values, falling back to defaults if not set
**Example customization:**
```yaml
# Set custom runner name
BUTLER_SOS_INSIDER_DEPLOY_RUNNER: "my-custom-runner"
@@ -53,15 +55,18 @@ BUTLER_SOS_INSIDER_SERVICE_TIMEOUT: "60"
On the deployment server (default: `host2-win`, configurable via `BUTLER_SOS_INSIDER_DEPLOY_RUNNER` variable), ensure the GitHub runner is configured with:
**Runner Labels:**
- The runner must be labeled to match the `BUTLER_SOS_INSIDER_DEPLOY_RUNNER` variable value (default: `host2-win`)
**Permissions:**
- The runner service account must have permission to:
- Stop and start Windows services
- Write to the deployment directory (default: `C:\butler-sos-insider`, configurable via `BUTLER_SOS_INSIDER_DEPLOY_PATH`)
- Execute PowerShell scripts
**PowerShell Execution Policy:**
```powershell
# Run as Administrator
Set-ExecutionPolicy RemoteSigned -Scope LocalMachine
@@ -72,6 +77,7 @@ Set-ExecutionPolicy RemoteSigned -Scope LocalMachine
Create a Windows service. The service name and deployment path can be customized via GitHub repository variables (see section 1).
**Default values:**
- Service Name: `"Butler SOS insiders build"` (configurable via `BUTLER_SOS_INSIDER_SERVICE_NAME`)
- Deploy Path: `C:\butler-sos-insider` (configurable via `BUTLER_SOS_INSIDER_DEPLOY_PATH`)
@@ -80,6 +86,7 @@ Create a Windows service. The service name and deployment path can be customized
NSSM is a popular tool for creating Windows services from executables and provides better service management capabilities.
First, download and install NSSM:
1. Download NSSM from https://nssm.cc/download
2. Extract to a location like `C:\nssm`
3. Add `C:\nssm\win64` (or `win32`) to your system PATH
@@ -105,6 +112,7 @@ REM nssm set "Butler SOS insiders build" ObjectName ".\ServiceAccount" "password
```
**NSSM Service Management Commands:**
```cmd
REM Start the service
nssm start "Butler SOS insiders build"
@@ -126,6 +134,7 @@ nssm edit "Butler SOS insiders build"
```
**Using NSSM with PowerShell:**
```powershell
# Run as Administrator
$serviceName = "Butler SOS insiders build"
@@ -151,6 +160,7 @@ Write-Host "Service '$serviceName' installed successfully with NSSM"
```
**Option B: Using PowerShell**
```powershell
# Run as Administrator
$serviceName = "Butler SOS insiders build"
@@ -168,12 +178,14 @@ New-Service -Name $serviceName -BinaryPathName "$exePath --config $configPath" -
```
**Option C: Using SC command**
```cmd
REM Run as Administrator
sc create "Butler SOS insiders build" binPath="C:\butler-sos-insider\butler-sos.exe --config C:\butler-sos-insider\config\production_template.yaml" DisplayName="Butler SOS insiders build" start=demand
```
**Option C: Using Windows Service Manager (services.msc)**
1. Open Services management console
2. Right-click and select "Create Service"
3. Fill in the details:
@@ -187,6 +199,7 @@ sc create "Butler SOS insiders build" binPath="C:\butler-sos-insider\butler-sos.
NSSM is a popular tool for creating Windows services from executables and provides better service management capabilities.
First, download and install NSSM:
1. Download NSSM from https://nssm.cc/download
2. Extract to a location like `C:\nssm`
3. Add `C:\nssm\win64` (or `win32`) to your system PATH
@@ -212,6 +225,7 @@ REM nssm set "Butler SOS insiders build" ObjectName ".\ServiceAccount" "password
```
**NSSM Service Management Commands:**
```cmd
REM Start the service
nssm start "Butler SOS insiders build"
@@ -233,6 +247,7 @@ nssm edit "Butler SOS insiders build"
```
**Using NSSM with PowerShell:**
```powershell
# Run as Administrator
$serviceName = "Butler SOS insiders build"
@@ -346,6 +361,7 @@ To manually test the deployment process:
- **Logging issues:** Verify the logs directory exists and has write permissions
**NSSM Diagnostic Commands:**
```cmd
REM Check if NSSM is available
nssm version
@@ -364,6 +380,7 @@ nssm status "Butler SOS insiders build"
```
**Log Locations:**
- GitHub Actions logs: Available in the workflow run details
- Windows Event Logs: Check System and Application logs
- Service logs: Check Butler SOS application logs if configured
@@ -374,6 +391,7 @@ nssm status "Butler SOS insiders build"
## Configuration Files
The deployment includes the configuration template and log appender files in the zip package:
- `config/production_template.yaml` - Main configuration template
- `config/log_appender_xml/` - Log4j configuration files