Skip to content

Commit

Permalink
feat: docker purne 추가 및 nginx sed 로직 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
flydog98 committed Dec 18, 2023
1 parent 215979e commit 9c34f7b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/backend-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ jobs:
script: |
CURRENT_STATE=$(curl -s http://${{ secrets.BLUE_GREEN_HOST }}:${{ secrets.BLUE_GREEN_PORT }}/status)
echo "The current state is $CURRENT_STATE"
docker image prune -f
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-backend:0.1
if [ $CURRENT_STATE = "blue" ]; then
docker run -d --name backend-green -p 8081:8080 \
Expand Down Expand Up @@ -111,9 +112,9 @@ jobs:
password: ${{ secrets.NGINX_SSH_PASSWORD }}
port: ${{ secrets.NGINX_SSH_PORT }}
script: |
if [ $(cat /status) = "green" ]; then
sed -i 's/proxy_pass http:\/\/127.0.0.1:808[0-1];/proxy_pass http:\/\/127.0.0.1:8081;/' /etc/nginx/sites-available/default
if [ "$CURRENT_STATE" = "green" ]; then
sed -i 's/proxy_pass http:\/\/[a-zA-Z0-9\.\-]+:8080;/proxy_pass http:\/\/[a-zA-Z0-9\.\-]+:8081;/' /etc/nginx/sites-available/default
else
sed -i 's/proxy_pass http:\/\/127.0.0.1:808[0-1];/proxy_pass http:\/\/127.0.0.1:8080;/' /etc/nginx/sites-available/default
sed -i 's/proxy_pass http:\/\/[a-zA-Z0-9\.\-]+:8081;/proxy_pass http:\/\/[a-zA-Z0-9\.\-]+:8080;/' /etc/nginx/sites-available/default
fi
sudo nginx -s reload

0 comments on commit 9c34f7b

Please sign in to comment.