修改config
This commit is contained in:
1 parent
5e68d97127
commit
1890a8380b
4 files changed
+108
-23
No files matched your search
@@ -0,0 +1,25 @@
|
||||
param(
|
||||
[string]$RepoUrl = "",
|
||||
[string]$Branch = "main",
|
||||
[string]$RepoDir = ".",
|
||||
[string]$ComposeFile = "docker-compose.yml",
|
||||
[string]$BaseUrl = "http://localhost:57778",
|
||||
[string]$AdminToken = ""
|
||||
)
|
||||
if (!(Test-Path $RepoDir)) { New-Item -ItemType Directory -Path $RepoDir | Out-Null }
|
||||
if (!(Test-Path (Join-Path $RepoDir ".git"))) {
|
||||
if ($RepoUrl -eq "") { throw "RepoUrl is required for clone" }
|
||||
git clone -b $Branch $RepoUrl $RepoDir
|
||||
}
|
||||
Set-Location $RepoDir
|
||||
git remote set-url origin $RepoUrl
|
||||
git fetch origin
|
||||
git checkout $Branch
|
||||
git pull origin $Branch
|
||||
if (!(Test-Path $ComposeFile)) { throw "compose not found: $ComposeFile" }
|
||||
docker compose -f $ComposeFile up -d --build
|
||||
$headers = @{}
|
||||
if ($AdminToken -ne "") { $headers["X-Admin-Token"] = $AdminToken }
|
||||
try { Invoke-RestMethod -Method Post -Uri "$BaseUrl/api/admin/reload_cutoff" -Headers $headers | Out-Null } catch { }
|
||||
try { Invoke-RestMethod -Method Get -Uri "$BaseUrl/api/metrics" | ConvertTo-Json -Depth 3 | Write-Output } catch { }
|
||||
try { Invoke-RestMethod -Method Post -Uri "$BaseUrl/api/admin/test_push" -Headers $headers | ConvertTo-Json -Depth 3 | Write-Output } catch { }
|
||||
Reference in new issue
Block a user