From dbe2abce9d2bd689cf1ac07717119a96361a0998 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=AF=E1=86=AB=E1=84=8C=E1=85=A1=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=AE=E1=86=AB?= Date: Thu, 3 Jul 2025 13:26:50 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix(cd):=20JAVA=5FOPTS=20=EB=88=84=EB=9D=BD?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EC=BB=A8=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=84=88=20=EC=8B=A4=ED=96=89=20=EC=8B=A4=ED=8C=A8=20?= =?UTF-8?q?=EB=B0=8F=20=ED=97=AC=EC=8A=A4=20=EC=B2=B4=ED=81=AC=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/DOCKER-CD-STAGING.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/DOCKER-CD-STAGING.yml b/.github/workflows/DOCKER-CD-STAGING.yml index ee71462..d4ee25a 100644 --- a/.github/workflows/DOCKER-CD-STAGING.yml +++ b/.github/workflows/DOCKER-CD-STAGING.yml @@ -99,6 +99,7 @@ jobs: NEW_CONTAINER_NAME="${APP_NAME}-${NEW_PORT}" docker run -d --name ${NEW_CONTAINER_NAME} --restart always \ -p ${NEW_PORT}:8080 \ + -e JAVA_OPTS='-Xms256m -Xmx512m' \ -e SPRING_PROFILES_ACTIVE=staging \ -e SPRING_DATASOURCE_URL='${{ secrets.DB_URL }}' \ -e SPRING_DATASOURCE_USERNAME='${{ secrets.DB_USERNAME }}' \ @@ -116,7 +117,7 @@ jobs: ${IMAGE_NAME}:latest echo "### 4. 헬스 체크를 시작합니다." - sleep 10 + sleep 30 for retry_count in {1..10}; do echo " > [${retry_count}/10] 서버 상태 체크 중..." response=$(curl -s http://localhost:${NEW_PORT}/actuator/health) From d1e315920e540276604c3dd002045d4ec5bbfe3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=80=E1=85=AF=E1=86=AB=E1=84=8C=E1=85=A1=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=AE=E1=86=AB?= Date: Thu, 3 Jul 2025 13:32:08 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor(cd):=20=ED=97=AC=EC=8A=A4=20?= =?UTF-8?q?=EC=B2=B4=ED=81=AC=20=EB=A1=9C=EC=A7=81=EC=9D=84=20polling=20?= =?UTF-8?q?=EB=B0=A9=EC=8B=9D=EC=9C=BC=EB=A1=9C=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/DOCKER-CD-STAGING.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/DOCKER-CD-STAGING.yml b/.github/workflows/DOCKER-CD-STAGING.yml index d4ee25a..8260f14 100644 --- a/.github/workflows/DOCKER-CD-STAGING.yml +++ b/.github/workflows/DOCKER-CD-STAGING.yml @@ -117,22 +117,24 @@ jobs: ${IMAGE_NAME}:latest echo "### 4. 헬스 체크를 시작합니다." - sleep 30 - for retry_count in {1..10}; do - echo " > [${retry_count}/10] 서버 상태 체크 중..." - response=$(curl -s http://localhost:${NEW_PORT}/actuator/health) + for retry_count in {1..12}; do + echo " > [${retry_count}/12] 서버 상태 체크 중..." + + response=$(curl -s http://localhost:${NEW_PORT}/actuator/health || true) up_count=$(echo "$response" | grep -c '"status":"UP"') if [ $up_count -ge 1 ]; then echo " > ✅ 서버 실행 성공 (포트: ${NEW_PORT})" - break + break fi - if [ $retry_count -eq 10 ]; then - echo " > ❌ 서버 헬스체크 실패. 배포를 중단하고 새 컨테이너를 종료합니다." + + if [ $retry_count -eq 12 ]; then + echo " > ❌ 1분 동안 헬스 체크에 실패했습니다. 배포를 중단하고 새 컨테이너를 종료합니다." docker rm -f ${NEW_CONTAINER_NAME} - exit 1 + exit 1 # 실패 상태로 종료 fi - sleep 5 + + sleep 5 done echo "### 5. Nginx 설정을 변경하여 트래픽을 새 포트(Green)로 전환합니다."