From 8310e0159af093b941c5a51a1502b3bae3407f93 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sat, 13 Apr 2024 03:14:58 -0500 Subject: [PATCH] chore: clean up script --- scripts/deploy.ps1 | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/deploy.ps1 b/scripts/deploy.ps1 index 10821de..61d2341 100644 --- a/scripts/deploy.ps1 +++ b/scripts/deploy.ps1 @@ -24,16 +24,26 @@ function StartContainer { while ($running -eq $false -and $attempts -lt $attemptLimit) { - $response = Invoke-WebRequest -Uri "http://localhost:$containerHostPort/rss" -UseBasicParsing - - if ($response.StatusCode -eq 200) + try { - $running = $true + $response = Invoke-WebRequest -Uri "http://localhost:$containerHostPort/rss" -UseBasicParsing + + if ($response.StatusCode -eq 200) + { + $running = $true + } + else + { + Write-Host "Waiting for $containerName container to start..." + Start-Sleep -Seconds $waitTimeInSeconds + $attempts++ + } } - else + catch { Write-Host "Waiting for $containerName container to start..." Start-Sleep -Seconds $waitTimeInSeconds + $attempts++ } } @@ -106,8 +116,6 @@ if ($LASTEXITCODE -ne 0) # Checkif green container is running $greenContainerId = docker ps --filter "name=blog.stevanfreeborn.com.green" --format "{{.ID}}" -Write-Host "Green container ID: $greenContainerId" - if ($null -eq $greenContainerId) { Write-Host "Green container is not running. Starting green container."