forked from NSPG13/agent-bounties
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck-production-compose.ps1
More file actions
75 lines (68 loc) · 2.19 KB
/
Copy pathcheck-production-compose.ps1
File metadata and controls
75 lines (68 loc) · 2.19 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
param(
[string] $ProjectName = "agent-bounties-prod-smoke",
[string] $EnvFile = ".env.example",
[int] $ApiPort = 18080,
[int] $McpPort = 18090,
[switch] $RequireEvalHistory
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
. (Join-Path $PSScriptRoot "_shared\powershell.ps1")
function Wait-HttpOk {
param(
[Parameter(Mandatory = $true)]
[string] $Url
)
for ($i = 0; $i -lt 60; $i++) {
try {
Invoke-WebRequest -UseBasicParsing -Uri $Url -TimeoutSec 2 | Out-Null
return
} catch {
Start-Sleep -Seconds 2
}
}
throw "$Url did not become healthy within 120 seconds"
}
Push-Location $repoRoot
$oldApiPort = $env:API_PORT
$oldMcpPort = $env:MCP_PORT
$oldPublicBaseUrl = $env:PUBLIC_BASE_URL
$oldMcpBaseUrl = $env:MCP_BASE_URL
$env:API_PORT = "$ApiPort"
$env:MCP_PORT = "$McpPort"
$env:PUBLIC_BASE_URL = "http://127.0.0.1:$ApiPort"
$env:MCP_BASE_URL = "http://127.0.0.1:$McpPort"
$composeArgs = @(
"--env-file", $EnvFile,
"-p", $ProjectName,
"-f", "docker-compose.production.yml"
)
$baseIndexerComposeArgs = $composeArgs + @("--profile", "base-indexer")
try {
Invoke-Checked { docker compose @baseIndexerComposeArgs config | Out-Null }
Invoke-Checked { docker compose @baseIndexerComposeArgs build base-indexer }
Invoke-Checked { docker compose @composeArgs up -d --build }
Wait-HttpOk "http://127.0.0.1:$ApiPort/health"
Wait-HttpOk "http://127.0.0.1:$McpPort/health"
Invoke-Checked {
if ($RequireEvalHistory) {
& "$PSScriptRoot\check-production-smoke.ps1" `
-ApiBaseUrl "http://127.0.0.1:$ApiPort" `
-McpBaseUrl "http://127.0.0.1:$McpPort" `
-RequireEvalHistory
}
else {
& "$PSScriptRoot\check-production-smoke.ps1" `
-ApiBaseUrl "http://127.0.0.1:$ApiPort" `
-McpBaseUrl "http://127.0.0.1:$McpPort"
}
}
}
finally {
docker compose @composeArgs down -v
$env:API_PORT = $oldApiPort
$env:MCP_PORT = $oldMcpPort
$env:PUBLIC_BASE_URL = $oldPublicBaseUrl
$env:MCP_BASE_URL = $oldMcpBaseUrl
Pop-Location
}