Skip to content

Commit

Permalink
fix: github 환경 변수 변경 및 backend_ssh_username 사용
Browse files Browse the repository at this point in the history
  • Loading branch information
flydog98 committed Dec 18, 2023
1 parent d37671f commit 74bb017
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/backend-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
port: ${{ secrets.NGINX_SSH_PORT }}
script: |
CURRENT_STATE=$(cat /status)
echo "CURRENT_STATE=$CURRENT_STATE" >> $GITHUB_ENV
echo "::set-output name=CURRENT_STATE::$CURRENT_STATE"
- name: SSH and Deploy
uses: appleboy/ssh-action@master
Expand All @@ -78,11 +78,11 @@ jobs:
password: ${{ secrets.BACKEND_SSH_PASSWORD }}
port: ${{ secrets.BACKEND_SSH_PORT }}
script: |
echo "The current state is ${{ env.CURRENT_STATE }}"
echo "The current state is ${{ steps.get-state.outputs.CURRENT_STATE }}"
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-backend:0.1
if [ ${{ env.CURRENT_STATE }} = "blue" ]; then
if [ ${{ steps.get-state.outputs.CURRENT_STATE }} = "blue" ]; then
docker run -d --name backend-blue -p 8081:8080 \
-v /${{ secrets.CONTAINER_SSH_USERNAME }}/backend-logs:/app/packages/backend/logs/ \
-v /${{ secrets.BACKEND_SSH_USERNAME }}/backend-logs:/app/packages/backend/logs/ \
-e CONTAINER_GIT_USERNAME=${{ secrets.CONTAINER_GIT_USERNAME }} \
-e MONGODB_HOST=${{ secrets.MONGODB_HOST }} \
-e SECRET_KEY=${{ secrets.SECRET_KEY }} \
Expand All @@ -92,11 +92,11 @@ jobs:
-e CONTAINER_SERVER_HOST=${{ secrets.CONTAINER_SERVER_HOST }} \
-e CONTAINER_POOL_MAX=${{ secrets.CONTAINER_POOL_MAX }} \
${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-backend:0.1
docker rm -f backend-blue || true
docker rm -f backend-green || true
echo "green" > /status
else
docker run -d --name backend-green -p 8080:8080 \
-v /${{ secrets.CONTAINER_SSH_USERNAME }}/backend-logs:/app/packages/backend/logs/ \
-v /${{ secrets.BACKEND_SSH_USERNAME }}/backend-logs:/app/packages/backend/logs/ \
-e CONTAINER_GIT_USERNAME=${{ secrets.CONTAINER_GIT_USERNAME }} \
-e MONGODB_HOST=${{ secrets.MONGODB_HOST }} \
-e SECRET_KEY=${{ secrets.SECRET_KEY }} \
Expand All @@ -106,7 +106,7 @@ jobs:
-e CONTAINER_SERVER_HOST=${{ secrets.CONTAINER_SERVER_HOST }} \
-e CONTAINER_POOL_MAX=${{ secrets.CONTAINER_POOL_MAX }} \
${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-backend:0.1
docker rm -f backend-green || true
docker rm -f backend-blue || true
echo "blue" > /status
fi
Expand Down

0 comments on commit 74bb017

Please sign in to comment.