From db3dc65512cc5dcb881f3760aa7bff2955c11656 Mon Sep 17 00:00:00 2001 From: Abhishek-N Date: Thu, 29 Jun 2023 17:59:43 +0530 Subject: [PATCH 01/10] update workflows --- .github/workflows/app.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 063d962..f136a59 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -44,4 +44,9 @@ jobs: uses: codecov/codecov-action@v3 with: token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true \ No newline at end of file + fail_ci_if_error: true + - name: Deploy to EC2 + run: | + eval `ssh-agent -s` + ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" + ssh ${{ secrets.SERVER }} "source ~/.nvm/nvm.sh; cd /home/ddp/prefect-proxy; git pull; pm2 restart prefect-proxy" From f852eb5f8fc9dbafdfdd3329c9b9ef0fe6b47bd5 Mon Sep 17 00:00:00 2001 From: Abhishek-N Date: Thu, 29 Jun 2023 18:09:16 +0530 Subject: [PATCH 02/10] add ssh config --- .github/workflows/app.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index f136a59..7d7df0a 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -45,6 +45,12 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true + - name: Create known_hosts file + run: | + mkdir -p ~/.ssh + touch ~/.ssh/known_hosts + - name: Add remote host key to known_hosts + run: ssh-keyscan ${{ secrets.SERVERIP }} >> ~/.ssh/known_hosts - name: Deploy to EC2 run: | eval `ssh-agent -s` From 2e267e61fcb62f026e249c083a6bd95a6ac8dcdc Mon Sep 17 00:00:00 2001 From: Abhishek-N Date: Thu, 29 Jun 2023 20:56:06 +0530 Subject: [PATCH 03/10] update --- .github/workflows/app.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 7d7df0a..08f4480 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -45,14 +45,9 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true - - name: Create known_hosts file - run: | - mkdir -p ~/.ssh - touch ~/.ssh/known_hosts - - name: Add remote host key to known_hosts - run: ssh-keyscan ${{ secrets.SERVERIP }} >> ~/.ssh/known_hosts - name: Deploy to EC2 run: | eval `ssh-agent -s` - ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" + ssh-add - <<< ${{ secrets.SSH_PRIVATE_KEY | replace('\n', '\\n') }} ssh ${{ secrets.SERVER }} "source ~/.nvm/nvm.sh; cd /home/ddp/prefect-proxy; git pull; pm2 restart prefect-proxy" + \ No newline at end of file From 5b1eb100f2bbf7064094de9d283550e7a3fbf748 Mon Sep 17 00:00:00 2001 From: Abhishek-N Date: Thu, 29 Jun 2023 21:05:51 +0530 Subject: [PATCH 04/10] update --- .github/workflows/app.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 08f4480..10c1da5 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -48,6 +48,5 @@ jobs: - name: Deploy to EC2 run: | eval `ssh-agent -s` - ssh-add - <<< ${{ secrets.SSH_PRIVATE_KEY | replace('\n', '\\n') }} + echo "${{ secrets.SSH_PRIVATE_KEY }}" | ssh-add - ssh ${{ secrets.SERVER }} "source ~/.nvm/nvm.sh; cd /home/ddp/prefect-proxy; git pull; pm2 restart prefect-proxy" - \ No newline at end of file From ccd94ddd783ed97623236c8f7d0b6089c9e794ac Mon Sep 17 00:00:00 2001 From: Abhishek-N Date: Thu, 17 Aug 2023 11:20:44 +0530 Subject: [PATCH 05/10] add ssh --- .github/workflows/app.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index d8a313e..f974aa1 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -27,6 +27,17 @@ jobs: run: | python -m pip install --upgrade pip if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Create known_hosts file + run: | + mkdir -p ~/.ssh + touch ~/.ssh/known_hosts + - name: Add remote host key to known_hosts + run: ssh-keyscan ${{ secrets.SERVERIP }} >> ~/.ssh/known_hosts + - name: Set up port forwarding via SSH + run: | + eval `ssh-agent -s` + ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" + ssh ${{ secrets.SERVER }} -f -N - name: Create Google App credentials file run: | echo '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}' > /tmp/google_credentials.json @@ -53,5 +64,5 @@ jobs: - name: Deploy to EC2 run: | eval `ssh-agent -s` - echo "${{ secrets.SSH_PRIVATE_KEY }}" | ssh-add - + echo "${{ secrets.SSH_PRIVATE_KEY }}" ssh ${{ secrets.SERVER }} "source ~/.nvm/nvm.sh; cd /home/ddp/prefect-proxy; git pull; pm2 restart prefect-proxy" From 0a6df23822d5631352d92af07d1b7de032b7bbbb Mon Sep 17 00:00:00 2001 From: Abhishek-N Date: Thu, 17 Aug 2023 13:27:21 +0530 Subject: [PATCH 06/10] print known_hosts --- .github/workflows/app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index f974aa1..c9db51a 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -22,7 +22,6 @@ jobs: - name: Create logs directory run: | mkdir -p logs - echo "LOGDIR=logs" >> $GITHUB_ENV - name: Install dependencies run: | python -m pip install --upgrade pip @@ -31,6 +30,7 @@ jobs: run: | mkdir -p ~/.ssh touch ~/.ssh/known_hosts + cat ~/.ssh/known_hosts - name: Add remote host key to known_hosts run: ssh-keyscan ${{ secrets.SERVERIP }} >> ~/.ssh/known_hosts - name: Set up port forwarding via SSH From a71bf4f0b89abfa87a2001fab96080cc27dd1509 Mon Sep 17 00:00:00 2001 From: Abhishek-N Date: Thu, 17 Aug 2023 14:19:22 +0530 Subject: [PATCH 07/10] add logdir to env --- .github/workflows/app.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index c9db51a..2108964 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -30,7 +30,6 @@ jobs: run: | mkdir -p ~/.ssh touch ~/.ssh/known_hosts - cat ~/.ssh/known_hosts - name: Add remote host key to known_hosts run: ssh-keyscan ${{ secrets.SERVERIP }} >> ~/.ssh/known_hosts - name: Set up port forwarding via SSH @@ -44,7 +43,9 @@ jobs: - name: Test with pytest env: GOOGLE_APPLICATION_CREDENTIALS: /tmp/google_credentials.json + LOGDIR: ${{ env.GITHUB_WORKSPACE }}/logs run: | + mkdir -p $LOGDIR coverage run -m pytest coverage report --fail-under=70 coverage xml From b3cafcde3f9271f481dce39e5501ad4afd46703d Mon Sep 17 00:00:00 2001 From: Abhishek-N Date: Thu, 17 Aug 2023 14:41:21 +0530 Subject: [PATCH 08/10] update workspace for logs --- .github/workflows/app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 2108964..2fdcfa9 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -43,7 +43,7 @@ jobs: - name: Test with pytest env: GOOGLE_APPLICATION_CREDENTIALS: /tmp/google_credentials.json - LOGDIR: ${{ env.GITHUB_WORKSPACE }}/logs + LOGDIR: ${{ github.workspace }}/logs run: | mkdir -p $LOGDIR coverage run -m pytest From 784714655c49bfc3652452fcb11acd2f57de4144 Mon Sep 17 00:00:00 2001 From: Abhishek-N Date: Thu, 17 Aug 2023 16:25:12 +0530 Subject: [PATCH 09/10] add ssh key --- .github/workflows/app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 2fdcfa9..0c8573d 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -65,5 +65,5 @@ jobs: - name: Deploy to EC2 run: | eval `ssh-agent -s` - echo "${{ secrets.SSH_PRIVATE_KEY }}" + ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" ssh ${{ secrets.SERVER }} "source ~/.nvm/nvm.sh; cd /home/ddp/prefect-proxy; git pull; pm2 restart prefect-proxy" From c939fa30b8264e9fe31c717155b31e3c935fa42b Mon Sep 17 00:00:00 2001 From: Abhishek-N Date: Thu, 17 Aug 2023 16:37:43 +0530 Subject: [PATCH 10/10] remove port forwarding --- .github/workflows/app.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/app.yml b/.github/workflows/app.yml index 0c8573d..1df219f 100644 --- a/.github/workflows/app.yml +++ b/.github/workflows/app.yml @@ -32,11 +32,6 @@ jobs: touch ~/.ssh/known_hosts - name: Add remote host key to known_hosts run: ssh-keyscan ${{ secrets.SERVERIP }} >> ~/.ssh/known_hosts - - name: Set up port forwarding via SSH - run: | - eval `ssh-agent -s` - ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" - ssh ${{ secrets.SERVER }} -f -N - name: Create Google App credentials file run: | echo '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}' > /tmp/google_credentials.json