From 2b37348d23482fbd4ddf7e13c49ae5576e257930 Mon Sep 17 00:00:00 2001 From: alstn113 Date: Wed, 8 Jan 2025 20:21:12 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=B0=B0=ED=8F=AC=20=EC=8A=A4?= =?UTF-8?q?=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/scripts/deploy.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/scripts/deploy.sh b/server/scripts/deploy.sh index ba41e73..fd96c4f 100644 --- a/server/scripts/deploy.sh +++ b/server/scripts/deploy.sh @@ -58,13 +58,13 @@ switch_container() { echo "Starting $next_container..." docker compose -f compose.yml up "$next_container" -d - # sleep 5 + sleep 5 - # if ! health_check "$health_check_url"; then - # echo "Health check failed, rolling back..." - # docker compose -f compose.yml down "$next_container" - # return - # fi + if ! health_check "$health_check_url"; then + echo "Health check failed, rolling back..." + docker compose -f compose.yml down "$next_container" + return + fi sed -i "s/server $prev_container:8080;/server $next_container:8080;/" "$NGINX_CONFIG_PATH" @@ -75,6 +75,8 @@ switch_container() { fi echo "$next_container is now live and accepting requests!" + + docker compose -f compose.yml down "$prev_container" } IS_GREEN=$(docker container ps | grep app-green)