
Code Deploy를 활용한 대표적인 blue/green 배포 플로우
Code Deploy를 활용한 Blue/Green 배포
필요조건

모우다팀은 Code Deploy, S3를 사용하고 있지 않습니다.
하지만 서버에 소스파일을 최신화하고 실행시키는 script 파일을 사용하고 있습니다.
그래서 script를 활용하겠습니다.
name: Rolling Deployment
on:
push:
branches:
- main
jobs:
deploy-prod1:
name: Deploy to Prod1 Instance
runs-on: runner-prod1
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run Prod1 instance deploy script
run: |
cd ~/deploy && ./deploy.sh
check-prod1:
name: Check Prod1 Instance
runs-on: runner-prod1
needs: deploy-prod1
steps:
- name: Wait for Prod1 instance to be ready
run: sleep 30
- name: Health check for Prod1 instance
run: |
RESPONSE=$(curl --write-out '%{http_code}' --silent --output /dev/null <http://localhost:8080/health>)
if [ $RESPONSE -ne 200 ]; then
echo "Prod1 instance deployment failed."
exit 1
fi
echo "Prod1 instance is healthy."
deploy-prod2:
name: Deploy to Prod2 Instance
runs-on: runner-prod2
needs: check-prod1
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run Prod2 instance deploy script
run: |
cd ~/deploy && ./deploy.sh
check-prod2:
name: Check Prod2 Instance
runs-on: runner-prod2
needs: deploy-prod2
steps:
- name: Wait for Prod2 instance to be ready
run: sleep 30
- name: Health check for Prod2 instance
run: |
RESPONSE=$(curl --write-out '%{http_code}' --silent --output /dev/null <http://localhost:8080/health>)
if [ $RESPONSE -ne 200 ]; then
echo "Prod2 instance deployment failed."
exit 1
fi
echo "Prod2 instance is healthy."
