1+ # ProjectVG Load Test Environment Start Script
2+
3+ Write-Host " Starting ProjectVG load test environment..." - ForegroundColor Green
4+
5+ # Move to project root from current script directory
6+ $scriptPath = Split-Path - Parent $MyInvocation.MyCommand.Path
7+ $projectRoot = Split-Path - Parent $scriptPath
8+ Set-Location $projectRoot
9+
10+ # Check required files exist
11+ if (-not (Test-Path " env.loadtest" )) {
12+ Write-Host " env.loadtest file not found!" - ForegroundColor Red
13+ exit 1
14+ }
15+
16+ if (-not (Test-Path " docker-compose.loadtest.yml" )) {
17+ Write-Host " docker-compose.loadtest.yml file not found!" - ForegroundColor Red
18+ exit 1
19+ }
20+
21+ # Clean up existing containers
22+ Write-Host " Cleaning up existing load test containers..." - ForegroundColor Yellow
23+ docker- compose - p projectvg- loadtest -- env- file env.loadtest -f docker- compose.loadtest.yml down -- remove-orphans 2> $null
24+
25+ # Remove existing images (prevent cache conflicts)
26+ docker rmi projectvg- loadtest- api:latest -f 2> $null
27+ docker rmi projectvg- dummy- llm:latest -f 2> $null
28+ docker rmi projectvg- dummy- memory:latest -f 2> $null
29+ docker rmi projectvg- dummy- tts:latest -f 2> $null
30+
31+ # Build and start load test environment
32+ Write-Host " Building load test environment..." - ForegroundColor Yellow
33+ docker- compose - p projectvg- loadtest -- env- file env.loadtest -f docker- compose.loadtest.yml build -- no- cache 2> $null
34+ docker- compose - p projectvg- loadtest -- env- file env.loadtest -f docker- compose.loadtest.yml up - d
35+
36+ # Wait for services to start
37+ Write-Host " Waiting for services to start..." - ForegroundColor Yellow
38+ Start-Sleep - Seconds 3
39+
40+ # Check service status
41+ Write-Host " Checking service status..." - ForegroundColor Yellow
42+
43+ $services = @ (
44+ @ {Name = " LLM Server" ; Url = " http://localhost:7808/health" },
45+ @ {Name = " Memory Server" ; Url = " http://localhost:7812/health" },
46+ @ {Name = " TTS Server" ; Url = " http://localhost:7816/health" },
47+ @ {Name = " Main API" ; Url = " http://localhost:7804/api/v1/health" }
48+ )
49+
50+ $allHealthy = $true
51+ foreach ($service in $services ) {
52+ try {
53+ $response = Invoke-RestMethod - Uri $service.Url - TimeoutSec 3
54+ if ($response.status -eq " ok" -or $response.Status -eq " Healthy" ) {
55+ Write-Host " $ ( $service.Name ) : OK" - ForegroundColor Green
56+ } else {
57+ Write-Host " $ ( $service.Name ) : FAILED" - ForegroundColor Red
58+ $allHealthy = $false
59+ }
60+ } catch {
61+ Write-Host " $ ( $service.Name ) : CONNECTION FAILED" - ForegroundColor Red
62+ $allHealthy = $false
63+ }
64+ }
65+
66+ if ($allHealthy ) {
67+ Write-Host " `n Load test environment started successfully!" - ForegroundColor Green
68+ Write-Host " Service URLs:" - ForegroundColor Cyan
69+ Write-Host " - Main API: http://localhost:7804" - ForegroundColor White
70+ Write-Host " - LLM Server: http://localhost:7808" - ForegroundColor White
71+ Write-Host " - Memory Server: http://localhost:7812" - ForegroundColor White
72+ Write-Host " - TTS Server: http://localhost:7816" - ForegroundColor White
73+
74+ Write-Host " `n You can now start load testing!" - ForegroundColor Green
75+ Write-Host " To stop: scripts\stop-loadtest.ps1" - ForegroundColor Yellow
76+ } else {
77+ Write-Host " `n Some services failed to start" - ForegroundColor Red
78+ Write-Host " Check logs: docker-compose -p projectvg-loadtest --env-file env.loadtest -f docker-compose.loadtest.yml logs" - ForegroundColor White
79+ }
0 commit comments