forked from MCKRUZ/microsoft-agentic-harness
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop-services.ps1
More file actions
107 lines (84 loc) · 2.38 KB
/
Copy pathstop-services.ps1
File metadata and controls
107 lines (84 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<#
.SYNOPSIS
Stop all Agentic Harness infrastructure services
.DESCRIPTION
Stops the observability stack in reverse order:
1. Prometheus + Grafana
2. OTel Collector + Jaeger
.PARAMETER RemoveVolumes
Remove Docker volumes when stopping (clears all stored data)
.PARAMETER OTelOnly
Stop only the OTel Collector + Jaeger stack
.PARAMETER DashboardsOnly
Stop only the Prometheus + Grafana stack
.EXAMPLE
.\stop-services.ps1
Stops all services, preserves data volumes
.EXAMPLE
.\stop-services.ps1 -RemoveVolumes
Stops all services and deletes stored data
#>
param(
[Parameter()]
[switch]$RemoveVolumes,
[Parameter()]
[switch]$OTelOnly,
[Parameter()]
[switch]$DashboardsOnly
)
$ErrorActionPreference = "Stop"
$repoRoot = $PSScriptRoot
function Write-Success { param($Message) Write-Host "[OK] $Message" -ForegroundColor Green }
function Write-Info { param($Message) Write-Host "[..] $Message" -ForegroundColor Cyan }
function Stop-Stack {
param(
[string]$Path,
[string]$Name,
[bool]$Volumes
)
Write-Info "Stopping $Name..."
Push-Location $Path
try {
$composeArgs = @("down")
if ($Volumes) {
$composeArgs += "-v"
}
docker-compose $composeArgs 2>&1
if ($LASTEXITCODE -eq 0) {
Write-Success "$Name stopped"
}
else {
Write-Host "[!!] Failed to stop $Name" -ForegroundColor Red
}
}
finally {
Pop-Location
}
}
# Main
try {
Write-Host ""
Write-Host "Stopping Agentic Harness Services" -ForegroundColor Magenta
if ($RemoveVolumes) {
Write-Host " (removing volumes)" -ForegroundColor Yellow
}
Write-Host ""
$otelDir = Join-Path $repoRoot "scripts\otel-collector"
$dashDir = Join-Path $repoRoot "Dashboards"
# Stop in reverse order: Dashboards first, then OTel
if (-not $OTelOnly) {
Stop-Stack -Path $dashDir -Name "Prometheus + Grafana" -Volumes $RemoveVolumes
Write-Host ""
}
if (-not $DashboardsOnly) {
Stop-Stack -Path $otelDir -Name "OTel Collector + Jaeger" -Volumes $RemoveVolumes
Write-Host ""
}
Write-Success "All services stopped"
Write-Host ""
}
catch {
Write-Host "[!!] Unexpected error: $_" -ForegroundColor Red
Write-Host $_.ScriptStackTrace -ForegroundColor DarkGray
exit 1
}