25 lines
888 B
PowerShell
25 lines
888 B
PowerShell
$ContainerName = "nginx-proxy"
|
|
|
|
Write-Host "[Reload] Checking configuration in $ContainerName..." -ForegroundColor Cyan
|
|
|
|
# 1. Validate Configuration
|
|
docker exec $ContainerName nginx -t
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "[Reload] Configuration is VALID." -ForegroundColor Green
|
|
|
|
# 2. Graceful Reload
|
|
Write-Host "[Reload] Triggering graceful reload..." -ForegroundColor Cyan
|
|
docker exec $ContainerName nginx -s reload
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "[Reload] ✅ Reload signal sent successfully." -ForegroundColor Green
|
|
Write-Host "[Reload] Zero-downtime update in progress." -ForegroundColor Green
|
|
} else {
|
|
Write-Host "[Reload] ❌ Failed to send reload signal." -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
} else {
|
|
Write-Host "[Reload] ❌ Configuration is INVALID. Aborting reload." -ForegroundColor Red
|
|
exit 1
|
|
}
|