Skip to content

Commit

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

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

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

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

* infra: 스크립트 수정

* infra: 스크립트 수정

* infra: 스크립트 수정

* infra: 스크립트 수정

* infra: 스크립트 수정

* infra: 스크립트 수정
  • Loading branch information
dwax1324 authored Oct 24, 2024
1 parent c84b181 commit 35f0747
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/Backend-CD-Prod-A.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
- name: Port forwarding begin
run: |
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination ${{ secrets.BE_PROD_B_PRIVATE_IP }}:80
sudo iptables -t nat -I PREROUTING 1 -p tcp --dport 80 -j DNAT --to-destination ${{ secrets.BE_PROD_B_PRIVATE_IP }}:80
sudo iptables -t nat -I POSTROUTING 1 -p tcp --dport 80 -j SNAT --to-source ${{ secrets.BE_PROD_A_PRIVATE_IP }}
sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
- name: Deploy
run: |
Expand All @@ -35,7 +37,7 @@ jobs:
docker run -d -p 80:8080 --name server \
-e JAVA_OPTS="-XX:InitialRAMPercentage=70.0 -XX:MaxRAMPercentage=70.0" \
-e TZ=Asia/Seoul \
-e TZ=Asia/Seoul
${{ secrets.DOCKER_SERVER_IMAGE }}
- name: Wait for service to start
Expand All @@ -55,6 +57,6 @@ jobs:
- name: Port forwarding end
run: |
sudo sysctl -w net.ipv4.ip_forward=0
iptables -t nat -D PREROUTING -p tcp --dport 80 -j DNAT --to-destination ${{ secrets.BE_PROD_B_PRIVATE_IP }}:80
sudo iptables -t nat -L -n -v
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
12 changes: 6 additions & 6 deletions .github/workflows/Backend-CD-Prod-B.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ jobs:
- name: Port forwarding begin
run: |
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination ${{ secrets.BE_PROD_A_PRIVATE_IP }}:80
sudo iptables -t nat -I PREROUTING 1 -p tcp --dport 80 -j DNAT --to-destination ${{ secrets.BE_PROD_A_PRIVATE_IP }}:80
sudo iptables -t nat -I POSTROUTING 1 -p tcp --dport 80 -j SNAT --to-source ${{ secrets.BE_PROD_B_PRIVATE_IP }}
sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
- name: Deploy
run: |
Expand Down Expand Up @@ -46,7 +47,6 @@ jobs:
- 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
Expand All @@ -56,6 +56,6 @@ jobs:
- name: Port forwarding end
run: |
sudo sysctl -w net.ipv4.ip_forward=0
iptables -t nat -D PREROUTING -p tcp --dport 80 -j DNAT --to-destination ${{ secrets.BE_PROD_A_PRIVATE_IP }}:80
sudo iptables -t nat -L -n -v
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

0 comments on commit 35f0747

Please sign in to comment.