File tree Expand file tree Collapse file tree 1 file changed +12
-9
lines changed
Expand file tree Collapse file tree 1 file changed +12
-9
lines changed Original file line number Diff line number Diff line change 9999 NEW_CONTAINER_NAME="${APP_NAME}-${NEW_PORT}"
100100 docker run -d --name ${NEW_CONTAINER_NAME} --restart always \
101101 -p ${NEW_PORT}:8080 \
102+ -e JAVA_OPTS='-Xms256m -Xmx512m' \
102103 -e SPRING_PROFILES_ACTIVE=staging \
103104 -e SPRING_DATASOURCE_URL='${{ secrets.DB_URL }}' \
104105 -e SPRING_DATASOURCE_USERNAME='${{ secrets.DB_USERNAME }}' \
@@ -116,22 +117,24 @@ jobs:
116117 ${IMAGE_NAME}:latest
117118
118119 echo "### 4. 헬스 체크를 시작합니다."
119- sleep 10
120- for retry_count in {1..10}; do
121- echo " > [${retry_count}/10] 서버 상태 체크 중..."
122- response=$(curl -s http://localhost:${NEW_PORT}/actuator/health)
120+ for retry_count in {1..12}; do
121+ echo " > [${retry_count}/12] 서버 상태 체크 중..."
122+
123+ response=$(curl -s http://localhost:${NEW_PORT}/actuator/health || true )
123124 up_count=$(echo "$response" | grep -c '"status":"UP"')
124125
125126 if [ $up_count -ge 1 ]; then
126127 echo " > ✅ 서버 실행 성공 (포트: ${NEW_PORT})"
127- break
128+ break
128129 fi
129- if [ $retry_count -eq 10 ]; then
130- echo " > ❌ 서버 헬스체크 실패. 배포를 중단하고 새 컨테이너를 종료합니다."
130+
131+ if [ $retry_count -eq 12 ]; then
132+ echo " > ❌ 1분 동안 헬스 체크에 실패했습니다. 배포를 중단하고 새 컨테이너를 종료합니다."
131133 docker rm -f ${NEW_CONTAINER_NAME}
132- exit 1
134+ exit 1 # 실패 상태로 종료
133135 fi
134- sleep 5
136+
137+ sleep 5
135138 done
136139
137140 echo "### 5. Nginx 설정을 변경하여 트래픽을 새 포트(Green)로 전환합니다."
You can’t perform that action at this time.
0 commit comments