flnxi-Wu/scripts/deploy/check-status.ps1
WuYongJie f646b71813
Some checks failed
CI Check / check (push) Has been cancelled
chore: 初始化本地仓库并同步最近改动
2025-11-18 17:50:16 +08:00

28 lines
1.1 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 检查部署状态
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