From c79aff834d9efbe82da67a56a1c0b04bfc94ed1e Mon Sep 17 00:00:00 2001 From: woojong Date: Thu, 24 Oct 2024 16:33:39 +0900 Subject: [PATCH] Modify/#398 infra zero down time (#421) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 서브모듈 커밋 시점 변경 * docs: 액츄에이터 의존성 추가 * infra: 무중단 배포를 위한 cd 스크립트 변경 * infra: 테스트와 빌드 하나로 통합 * infra: 스크립트 수정 * infra: 스크립트 수정 * infra: 스크립트 수정 * infra: 스크립트 수정 * infra: 스크립트 수정 * infra: 스크립트 수정 * infra: 스크립트 수정 --- .github/workflows/Backend-CD-Prod-A.yml | 2 ++ .github/workflows/Backend-CD-Prod-B.yml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/Backend-CD-Prod-A.yml b/.github/workflows/Backend-CD-Prod-A.yml index 1e43ca0b..6e0ff3bb 100644 --- a/.github/workflows/Backend-CD-Prod-A.yml +++ b/.github/workflows/Backend-CD-Prod-A.yml @@ -33,6 +33,8 @@ jobs: echo "No container named 'server' to remove." fi + sudo docker system prune -f + docker pull ${{ secrets.DOCKER_SERVER_IMAGE }} docker run -d -p 80:8080 --name server \ diff --git a/.github/workflows/Backend-CD-Prod-B.yml b/.github/workflows/Backend-CD-Prod-B.yml index 24e924fb..9265fe79 100644 --- a/.github/workflows/Backend-CD-Prod-B.yml +++ b/.github/workflows/Backend-CD-Prod-B.yml @@ -16,6 +16,7 @@ jobs: - name: Port forwarding begin run: | + sudo sysctl -w net.ipv4.ip_forward=1 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 @@ -32,6 +33,8 @@ jobs: echo "No container named 'server' to remove." fi + sudo docker system prune -f + docker pull ${{ secrets.DOCKER_SERVER_IMAGE }} docker run -d -p 80:8080 --name server \