Skip to content

chore: nginx upstream 설정 sed 명령어 수정 #368#369

Merged
Han-Joon-Hyeok merged 1 commit intomainfrom
chore/bluegreen-무중단-배포-스크립트-수정#368
Mar 25, 2025

Hidden character warning

The head ref may contain hidden characters: "chore/bluegreen-\ubb34\uc911\ub2e8-\ubc30\ud3ec-\uc2a4\ud06c\ub9bd\ud2b8-\uc218\uc815#368"
Merged

chore: nginx upstream 설정 sed 명령어 수정 #368#369
Han-Joon-Hyeok merged 1 commit intomainfrom
chore/bluegreen-무중단-배포-스크립트-수정#368

Conversation

@Han-Joon-Hyeok
Copy link
Contributor

개요

blue/green 무중단 배포 중, green 컨테이너에서 blue 컨테이너로 전환이 정상적으로 이루어지지 않는 문제를 수정했습니다.

원인

nginx의 upstream이 green으로 바뀌지 않고 blue로 남아있던 것이 원인이었습니다.
nginx 설정 파일의 내용을 변경하기 위한 ShellScript에서 sed 명령어가 정상적으로 작동하지 않았기 때문입니다.

sed -i "s|http://$current|http://$target|" $NGINX_CONFIGURATION_FILE

무중단 배포를 수행하기 전에 로컬 환경에 있는 변경 사항을 모두 되돌리는데, 이때 nginx 설정 파일의 upstream의 기본 값은 blue로 설정됩니다.
그러다보니 nginx 설정 파일에는 proxy_pass http://blue로 존재하게 되는데, sed 명령어가 찾고자 하는 문자열 http://green을 찾지 못해 http://blue로 변경하지 못했던 것입니다.

작업 내용

sed 명령어가 찾고자 하는 문자열을 http://$current가 아닌 proxy_pass http://를 찾도록 변경했습니다.

sed -i -E "s|proxy_pass[[:space:]]+http://[^;]+;|proxy_pass http://$target;|g" $NGINX_CONFIGURATION_FILE

@Han-Joon-Hyeok Han-Joon-Hyeok added the bug Something isn't working label Mar 25, 2025
@Han-Joon-Hyeok Han-Joon-Hyeok self-assigned this Mar 25, 2025
@Han-Joon-Hyeok Han-Joon-Hyeok linked an issue Mar 25, 2025 that may be closed by this pull request
@Han-Joon-Hyeok Han-Joon-Hyeok merged commit d2deea8 into main Mar 25, 2025
1 check passed
@Han-Joon-Hyeok Han-Joon-Hyeok deleted the chore/bluegreen-무중단-배포-스크립트-수정#368 branch March 25, 2025 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[chore] blue/green 무중단 배포 스크립트 수정

1 participant