Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deploy.sh #43

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ BLUE_PROFILE=$(curl -s http://localhost/profile)
echo "> $BLUE_PROFILE"

# ์‰ฌ๊ณ  ์žˆ๋Š” set ์ฐพ๊ธฐ: set1์ด ์‚ฌ์šฉ์ค‘์ด๋ฉด set2๊ฐ€ ์‰ฌ๊ณ  ์žˆ๊ณ , ๋ฐ˜๋Œ€๋ฉด set1์ด ์‰ฌ๊ณ  ์žˆ์Œ
if [ $BLUE_PROFILE == set1 ]
then
if [ "$BLUE_PROFILE" == "set1" ]; then
GREEN_PROFILE=set2
GREEN_PORT=8082
elif [ $BLUE_PROFILE == set2 ]
then
elif [ "$BLUE_PROFILE" == "set2" ]; then
GREEN_PROFILE=set1
GREEN_PORT=8081
else
Expand Down Expand Up @@ -47,23 +45,19 @@ echo "> $GREEN_PROFILE 10์ดˆ ํ›„ Health check ์‹œ์ž‘"
echo "> curl -s http://localhost:$GREEN_PORT/actuator/health "
sleep 10

for retry_count in {1..10}
do
for retry_count in {1..10}; do
response=$(curl -s http://localhost:$GREEN_PORT/actuator/health)
up_count=$(echo $response | grep 'UP' | wc -l)

if [ $up_count -ge 1 ]
then
if [ $up_count -ge 1 ]; then
echo "> Health check ์„ฑ๊ณต"

break
else
echo "> Health check์˜ ์‘๋‹ต์„ ์•Œ ์ˆ˜ ์—†๊ฑฐ๋‚˜ ํ˜น์€ status๊ฐ€ UP์ด ์•„๋‹™๋‹ˆ๋‹ค."
echo "> Health check: ${response}"
fi

if [ $retry_count -eq 10 ]
then
if [ $retry_count -eq 10 ]; then
echo "> Health check ์‹คํŒจ. "
echo "> Nginx์— ์—ฐ๊ฒฐํ•˜์ง€ ์•Š๊ณ  ๋ฐฐํฌ๋ฅผ ์ข…๋ฃŒํ•ฉ๋‹ˆ๋‹ค."
exit 1
Expand All @@ -74,10 +68,9 @@ do
done

echo "> $BLUE_PROFILE ์—์„œ ๊ตฌ๋™์ค‘์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ pid ํ™•์ธ"
BLUE_PID=$(pgrep -f $BLUE_PROFILE-nowsopt.jar)
BLUE_PID=$(pgrep -f $BLUE_PROFILE-univoice.jar | head -n 1)

if [ -z $BLUE_PID ]
then
if [ -z "$BLUE_PID" ]; then
echo "> ํ˜„์žฌ ๊ตฌ๋™์ค‘์ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์—†์œผ๋ฏ€๋กœ ์ข…๋ฃŒํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค."
else
echo "> ๊ธฐ์กด ${BLUE_PROFILE} ์„œ๋ฒ„ ์ค‘๋‹จ"
Expand Down
Loading