28 lines
1.1 KiB
PowerShell
28 lines
1.1 KiB
PowerShell
# 检查部署状态
|
||
param(
|
||
[string]$Server = "45.249.208.118",
|
||
[string]$Username = "root",
|
||
[string]$Password = "lxvhNYFZ4160",
|
||
[string]$RemotePath = "/root/deploy"
|
||
)
|
||
|
||
$plinkPath = "C:\Program Files\PuTTY\plink.exe"
|
||
$hostKey = "SHA256:WZOtvC/+IWw29P8vyovSabmIRFkQ/Bnmhj+qhTshA4Q"
|
||
|
||
Write-Host "等待应用启动..." -ForegroundColor Yellow
|
||
Start-Sleep -Seconds 15
|
||
|
||
Write-Host "`n=== 检查容器状态 ===" -ForegroundColor Cyan
|
||
& $plinkPath -batch -ssh -hostkey $hostKey -pw $Password "${Username}@${Server}" "cd ${RemotePath} && docker compose ps"
|
||
|
||
Write-Host "`n=== 检查应用健康状态 ===" -ForegroundColor Cyan
|
||
$healthCheck = & $plinkPath -batch -ssh -hostkey $hostKey -pw $Password "${Username}@${Server}" "curl -s http://localhost:4320/api/health"
|
||
Write-Host $healthCheck
|
||
|
||
Write-Host "`n=== 查看应用日志(最后20行) ===" -ForegroundColor Cyan
|
||
& $plinkPath -batch -ssh -hostkey $hostKey -pw $Password "${Username}@${Server}" "cd ${RemotePath} && docker compose logs --tail=20 app"
|
||
|
||
Write-Host "`n✓ 检查完成!" -ForegroundColor Green
|
||
Write-Host "应用地址: http://${Server}:4320" -ForegroundColor Cyan
|
||
|