From 9f48a6fd6e668c17a41fc070972f1346967bdd5e Mon Sep 17 00:00:00 2001 From: TopazKang Date: Sun, 22 Sep 2024 18:20:35 +0900 Subject: [PATCH 1/2] feature/deploy github-actions: dev.yaml - blue-green script active test server --- .github/workflows/github-actions-dev.yaml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/github-actions-dev.yaml b/.github/workflows/github-actions-dev.yaml index a50fd331..933932a6 100644 --- a/.github/workflows/github-actions-dev.yaml +++ b/.github/workflows/github-actions-dev.yaml @@ -38,6 +38,18 @@ jobs: - name: Push Docker Image to GHCR run: docker push ghcr.io/topazkang/be-dev:latest + deploy_test: + runs-on: [ self-hosted, Linux, X64, connectrip_test] + name: Deploy Test API + needs: build + + steps: + - name: set env & deploy + run: | + cd /home/ubuntu + echo "${{ secrets.ENV_FILE_TEST }}" > .env + sudo sh switch.sh + deploy_dev: runs-on: [ self-hosted, Linux, X64, connectrip_be_dev ] name: Deploy Dev API From 6116f9b7f70a4f1d35ad9984c9a208605aa5add8 Mon Sep 17 00:00:00 2001 From: TopazKang Date: Sun, 22 Sep 2024 18:43:39 +0900 Subject: [PATCH 2/2] feature/deploy github-actions: dev.yaml - blue-green script detach on test server --- .github/workflows/github-actions-dev.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github-actions-dev.yaml b/.github/workflows/github-actions-dev.yaml index 933932a6..38ce179c 100644 --- a/.github/workflows/github-actions-dev.yaml +++ b/.github/workflows/github-actions-dev.yaml @@ -46,9 +46,12 @@ jobs: steps: - name: set env & deploy run: | - cd /home/ubuntu + cd /home/ubuntu/deploy/back echo "${{ secrets.ENV_FILE_TEST }}" > .env - sudo sh switch.sh + docker image prune -a -f + docker-compose -f docker-compose.back.yaml down + docker-compose -f docker-compose.back.yaml pull + docker-compose -f docker-compose.back.yaml up -d deploy_dev: runs-on: [ self-hosted, Linux, X64, connectrip_be_dev ]