Skip to content

Commit 52f3a91

Browse files
committed
[Setting]: CD workflow 수정
1 parent 8a37e6f commit 52f3a91

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

scripts/deploy.sh

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,29 @@ do
6666
sleep 10
6767
done
6868

69-
ls -al
70-
pwd
71-
chmod +x ./switch.sh
72-
7369
echo "> 스위칭"
7470
sleep 10
75-
./switch.sh
71+
echo "> 현재 구동중인 Port 확인"
72+
CURRENT_PROFILE=$(curl -s http://localhost/profile)
73+
74+
if [ $CURRENT_PROFILE == deploy-one ]
75+
then
76+
IDLE_PORT=8082
77+
elif [ $CURRENT_PROFILE == deploy-two ]
78+
then
79+
IDLE_PORT=8081
80+
else
81+
echo "> 일치하는 Profile이 없습니다. Profile: $CURRENT_PROFILE"
82+
echo "> 8081을 할당합니다."
83+
IDLE_PORT=8081
84+
fi
85+
86+
echo "> 전환할 Port: $IDLE_PORT"
87+
echo "> Port 전환"
88+
echo "set \$service_url http://127.0.0.1:${IDLE_PORT};" |sudo tee /etc/nginx/conf.d/service-url.inc
89+
90+
PROXY_PORT=$(curl -s http://localhost/profile)
91+
echo "> Nginx Current Proxy Port: $PROXY_PORT"
92+
93+
echo "> Nginx Reload"
94+
sudo service nginx reload

0 commit comments

Comments
 (0)