@geekbeer/minion 2.68.3 → 2.68.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/win/lib/process-manager.js +13 -19
- package/win/minion-cli.ps1 +1 -1
- package/win/routes/commands.js +0 -2
package/package.json
CHANGED
|
@@ -69,7 +69,7 @@ function buildGracefulStopBlock(agentPort, apiToken) {
|
|
|
69
69
|
return [
|
|
70
70
|
` try {`,
|
|
71
71
|
` Invoke-RestMethod -Uri 'http://localhost:${agentPort}/api/shutdown' -Method POST ` +
|
|
72
|
-
`-Headers @{ Authorization = 'Bearer ${apiToken}' } -TimeoutSec 5 | Out-Null`,
|
|
72
|
+
`-ContentType 'application/json' -Headers @{ Authorization = 'Bearer ${apiToken}' } -TimeoutSec 5 | Out-Null`,
|
|
73
73
|
` Log 'Graceful shutdown requested, waiting for offline heartbeat...'`,
|
|
74
74
|
` Start-Sleep -Seconds 4`,
|
|
75
75
|
` } catch {`,
|
|
@@ -218,32 +218,26 @@ function buildAllowedCommands(procMgr, agentConfig = {}) {
|
|
|
218
218
|
|
|
219
219
|
commands['restart-agent'] = {
|
|
220
220
|
description: 'Restart the minion agent process',
|
|
221
|
-
spawnArgs: ['powershell', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-
|
|
222
|
-
buildRestartScript(stopBlock, startBlock, agentPort, apiToken)]],
|
|
221
|
+
spawnArgs: ['powershell', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
|
|
222
|
+
`& '${buildRestartScript(stopBlock, startBlock, agentPort, apiToken)}'`]],
|
|
223
223
|
deferred: true,
|
|
224
224
|
}
|
|
225
225
|
commands['update-agent'] = {
|
|
226
226
|
description: 'Update @geekbeer/minion to latest version and restart',
|
|
227
|
-
spawnArgs: ['powershell', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
'
|
|
232
|
-
agentPort,
|
|
233
|
-
apiToken,
|
|
234
|
-
)]],
|
|
227
|
+
spawnArgs: ['powershell', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
|
|
228
|
+
`& '${buildUpdateScript(
|
|
229
|
+
'npm install -g @geekbeer/minion@latest',
|
|
230
|
+
stopBlock, startBlock, 'update-agent', agentPort, apiToken,
|
|
231
|
+
)}'`]],
|
|
235
232
|
deferred: true,
|
|
236
233
|
}
|
|
237
234
|
commands['update-agent-dev'] = {
|
|
238
235
|
description: 'Update @geekbeer/minion from Verdaccio (dev) and restart',
|
|
239
|
-
spawnArgs: ['powershell', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
'
|
|
244
|
-
agentPort,
|
|
245
|
-
apiToken,
|
|
246
|
-
)]],
|
|
236
|
+
spawnArgs: ['powershell', ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
|
|
237
|
+
`& '${buildUpdateScript(
|
|
238
|
+
'npm install -g @geekbeer/minion@latest --registry http://verdaccio:4873',
|
|
239
|
+
stopBlock, startBlock, 'update-agent-dev', agentPort, apiToken,
|
|
240
|
+
)}'`]],
|
|
247
241
|
deferred: true,
|
|
248
242
|
}
|
|
249
243
|
commands['status-services'] = {
|
package/win/minion-cli.ps1
CHANGED
|
@@ -206,7 +206,7 @@ function Stop-MinionProcess {
|
|
|
206
206
|
try {
|
|
207
207
|
$headers = @{}
|
|
208
208
|
if ($token) { $headers['Authorization'] = "Bearer $token" }
|
|
209
|
-
Invoke-RestMethod -Uri "$AgentUrl/api/shutdown" -Method POST -Headers $headers -TimeoutSec 5 | Out-Null
|
|
209
|
+
Invoke-RestMethod -Uri "$AgentUrl/api/shutdown" -Method POST -ContentType 'application/json' -Headers $headers -TimeoutSec 5 | Out-Null
|
|
210
210
|
Write-Host "Graceful shutdown requested, waiting..."
|
|
211
211
|
Start-Sleep -Seconds 4
|
|
212
212
|
} catch {
|
package/win/routes/commands.js
CHANGED
|
@@ -68,13 +68,11 @@ async function commandRoutes(fastify) {
|
|
|
68
68
|
const [cmd, args] = allowedCommand.spawnArgs
|
|
69
69
|
spawnLog(`[${command}] spawn: ${cmd} ${JSON.stringify(args)}`)
|
|
70
70
|
try {
|
|
71
|
-
// Capture PowerShell stderr to diagnose silent exit (code=0, 116ms)
|
|
72
71
|
const stderrPath = path.join(os.homedir(), '.minion', `${command}-stderr.log`)
|
|
73
72
|
const stderrFd = fs.openSync(stderrPath, 'w')
|
|
74
73
|
const child = spawn(cmd, args, {
|
|
75
74
|
detached: true,
|
|
76
75
|
stdio: ['ignore', 'ignore', stderrFd],
|
|
77
|
-
windowsHide: true,
|
|
78
76
|
})
|
|
79
77
|
child.on('error', (err) => {
|
|
80
78
|
spawnLog(`[${command}] child error: ${err.message}`)
|