-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
65 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
BEFORE_PORT="$BEFORE_PORT" | ||
NEW_PORT="$NEW_PORT" | ||
NEW_ACTUATOR_PORT="$NEW_ACTUATOR_PORT" | ||
|
||
echo "기존 포트 : $BEFORE_PORT" | ||
echo "새로운 포트: $NEW_PORT" | ||
echo "새로운 ACTUATOR_PORT: $NEW_ACTUATOR_PORT" | ||
|
||
count=0 | ||
for count in {0..20} | ||
do | ||
echo "서버 상태 확인(${count}/20)"; | ||
|
||
UP=$(curl -s http://127.0.0.1:${NEW_ACTUATOR_PORT}/actuator/health-check) | ||
|
||
if [ "${UP}" != '{"status":"up"}' ] | ||
then | ||
sleep 10 | ||
continue | ||
else | ||
break | ||
fi | ||
done | ||
|
||
if [ $count -eq 20 ] | ||
then | ||
echo "새로운 서버 배포를 실패했습니다." | ||
exit 1 | ||
fi | ||
|
||
export BACKEND_PORT=$NEW_PORT | ||
envsubst '${BACKEND_PORT}' < backend.template > backend.conf | ||
sudo mv backend.conf /etc/nginx/conf.d/ | ||
sudo nginx -s reload | ||
|
||
if sudo docker ps | grep ${BEFORE_PORT}; then | ||
sudo docker stop $(docker ps -q --filter "expose=${BEFORE_PORT}") | ||
fi | ||
|
||
sudo docker container prune -f |