Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 포트 비교 바꿔보기 #813

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/be_cd-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
- name: Deploy docker container
run: |
sudo docker-compose --env-file ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/be_app-docker-compose.yml up -d

# 실행중인 서버 확인
- name: Determine Active and Inactive Ports (Blue/Green)
id: determine-ports
Expand All @@ -114,16 +114,17 @@ jobs:
ip="127.0.0.1"
for port in "${ports[@]}"; do
RESPONSE=$(curl -s http://$ip:$port/api/actuator/health)
IS_ACTIVE=$(echo ${RESPONSE} | grep 'UP' | wc -l)
if [ $IS_ACTIVE -eq 1 -a $port -eq "8080" ]; then
IS_ACTIVE=$(echo "$RESPONSE" | grep 'UP' | wc -l)
if [ $IS_ACTIVE -eq 1 ] && [ $port -eq 8080 ]; then
echo "BLUE_PORT=8080" >> $GITHUB_ENV
echo "GREEN_PORT=8081" >> $GITHUB_ENV
elif [ $IS_ACTIVE -eq 1 -a $port -eq "8081" ]; then
elif [ $IS_ACTIVE -eq 1 ] && [ $port -eq 8081 ]; then
echo "BLUE_PORT=8081" >> $GITHUB_ENV
echo "GREEN_PORT=8080" >> $GITHUB_ENV
fi
done


- name: Start the new (green/blue) environment
run: |
sudo docker-compose --env-file ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/be_app-docker-compose.yml -p ${{ env.GREEN_PORT }} up -d
Expand Down
Loading