Skip to content

Commit

Permalink
Modify/#398 infra zero down time (#422)
Browse files Browse the repository at this point in the history
* chore: 서브모듈 커밋 시점 변경

* docs: 액츄에이터 의존성 추가

* infra: 무중단 배포를 위한 cd 스크립트 변경

* infra: 테스트와 빌드 하나로 통합

* infra: 스크립트 수정

* infra: 스크립트 수정

* infra: 스크립트 수정

* infra: 스크립트 수정

* infra: 스크립트 수정

* infra: 스크립트 수정

* infra: 스크립트 수정

* infra: 서비스 상태 체크 및 종료 로직 추가
  • Loading branch information
dwax1324 authored Oct 24, 2024
1 parent 29c1231 commit b84c61f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 24 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/Backend-CD-Prod-A.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,32 @@ jobs:
-e TZ=Asia/Seoul \
${{ secrets.DOCKER_SERVER_IMAGE }}
- name: Wait for service to start
run: |
echo "Waiting for the service to start..."
sleep 30
- name: Check service availability
run: |
HTTP_STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:80/actuator/health)
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Service is up and running"
else
echo "Service is not responding. HTTP Status: $HTTP_STATUS"
exit 1
fi
SUCCESS=false
for i in {1..10}; do
HTTP_STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:80/actuator/health)
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Service is up and running"
SUCCESS=true
break
else
echo "Attempt $i: Service is not responding. HTTP Status: $HTTP_STATUS"
sleep 3
fi
done
- name: Port forwarding end
run: |
sudo iptables -t nat -D PREROUTING 1
sudo iptables -t nat -D POSTROUTING 1
sudo iptables -D INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -L -v -t nat
- name: Exit if fails
run: |
if [ "$SUCCESS" = false ]; then
echo "Service did not respond successfully after $ATTEMPTS attempts"
sudo exit 1
fi
33 changes: 21 additions & 12 deletions .github/workflows/Backend-CD-Prod-B.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,32 @@ jobs:
-e TZ=Asia/Seoul \
${{ secrets.DOCKER_SERVER_IMAGE }}
- name: Wait for service to start
run: |
echo "Waiting for the service to start..."
sleep 30
- name: Check service availability
run: |
HTTP_STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:80/actuator/health)
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Service is up and running"
else
echo "Service is not responding. HTTP Status: $HTTP_STATUS"
exit 1
fi
SUCCESS=false
for i in {1..10}; do
HTTP_STATUS=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:80/actuator/health)
if [ "$HTTP_STATUS" -eq 200 ]; then
echo "Service is up and running"
SUCCESS=true
break
else
echo "Attempt $i: Service is not responding. HTTP Status: $HTTP_STATUS"
sleep 3
fi
done
- name: Port forwarding end
run: |
sudo iptables -t nat -D PREROUTING 1
sudo iptables -t nat -D POSTROUTING 1
sudo iptables -D INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
sudo iptables -L -v -t nat
- name: Exit if fails
run: |
if [ "$SUCCESS" = false ]; then
echo "Service did not respond successfully after $ATTEMPTS attempts"
sudo exit 1
fi

0 comments on commit b84c61f

Please sign in to comment.