Skip to content

Commit eda2b1c

Browse files
authored
Merge pull request #56 from Block-Guard/feat/#51/selected-news-api
[Refactor] deploy.yml 파일 수정
2 parents aa72602 + 4cf6476 commit eda2b1c

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

.github/workflows/deploy.yml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,20 @@ jobs:
6464
docker rm $NEW_NAME || true
6565
docker run -d --name $NEW_NAME -p $NEW_PORT:8080 ${{ secrets.DOCKER_USERNAME }}/blockguard_server:latest
6666
67-
echo "헬스체크 진행 중..."
68-
for i in {1..10}; do
69-
STATUS=$(curl -s http://localhost:$NEW_PORT/actuator/health | grep '"status":"UP"' || true)
70-
if [ -n "$STATUS" ]; then
71-
echo "헬스체크 통과"
72-
break
73-
else
74-
echo "⏱ 대기 중..."
75-
sleep 3
76-
fi
67+
echo "헬스체크 시작"
68+
for i in $(seq 1 40); do
69+
STATUS=$(curl -s http://localhost:$NEW_PORT/actuator/health || true)
70+
echo "[$i] health: $STATUS"
71+
echo "$STATUS" | grep -q '"status":"UP"' && PASSED=1 && break || true
72+
sleep 3
7773
done
7874
79-
if [ -z "$STATUS" ]; then
80-
echo "헬스체크 실패: 롤백 없음"
81-
docker logs $NEW_NAME
75+
if [ "${PASSED:-0}" -ne 1 ]; then
76+
echo "헬스체크 실패 → 새 컨테이너 로그"
77+
sudo docker logs "$NEW" | tail -n 200
8278
exit 1
8379
fi
80+
echo "헬스체크 통과"
8481
8582
echo "nginx 포트 전환"
8683
sudo sed -i "s/proxy_pass http:\/\/localhost:808[0-9];/proxy_pass http:\/\/localhost:$NEW_PORT;/" /etc/nginx/sites-available/default

0 commit comments

Comments
 (0)