Skip to content

Commit

Permalink
Updating the Zero-Deployment Steps in Pipelines adding consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmdksh committed Nov 5, 2024
1 parent 93e1f17 commit 0ff615c
Show file tree
Hide file tree
Showing 5 changed files with 226 additions and 31 deletions.
51 changes: 45 additions & 6 deletions .github/workflows/main-deploy-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,23 @@ jobs:
docker image prune -a --force
docker compose pull
rollout-deploy-1:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Update each backend service one by one
## First Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=0 --scale qacc-be-graph-ql2=1 --scale qacc-be-graph-ql3=1
docker compose up -d --no-deps --scale qacc-be-job1=0 --scale qacc-be-job2=1 --scale qacc-be-job3=1
docker compose up -d --no-deps --scale qacc-be-graph-ql1=0
docker compose up -d --no-deps --scale qacc-be-job1=0
docker compose up -d
# Wait for qacc-be-graph-ql1 to be healthy (timeout after 5 minutes)
Expand All @@ -47,9 +60,22 @@ jobs:
fi
echo "First deployment phase completed successfully"
rollout-deploy-2:
needs: rollout-deploy-1
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Second Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=1 --scale qacc-be-graph-ql2=0 --scale qacc-be-graph-ql3=1
docker compose up -d --no-deps --scale qacc-be-job1=1 --scale qacc-be-job2=0 --scale qacc-be-job3=1
docker compose up -d --no-deps --scale qacc-be-graph-ql2=0
docker compose up -d --no-deps --scale qacc-be-job2=0
docker compose up -d
# Wait for qacc-be-graph-ql2 to be healthy (timeout after 5 minutes)
Expand All @@ -71,9 +97,22 @@ jobs:
fi
echo "Second deployment phase completed successfully"
rollout-deploy-3:
needs: rollout-deploy-2
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Third Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=1 --scale qacc-be-graph-ql2=1 --scale qacc-be-graph-ql3=0
docker compose up -d --no-deps --scale qacc-be-job1=1 --scale qacc-be-job2=1 --scale qacc-be-job3=0
docker compose up -d --no-deps --scale qacc-be-graph-ql3=0
docker compose up -d --no-deps --scale qacc-be-job3=0
docker compose up -d
# Wait for qacc-be-graph-ql3 to be healthy (timeout after 5 minutes)
Expand Down
51 changes: 45 additions & 6 deletions .github/workflows/main-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,23 @@ jobs:
docker image prune -a --force
docker compose pull
rollout-deploy-1:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Update each backend service one by one
## First Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=0 --scale qacc-be-graph-ql2=1 --scale qacc-be-graph-ql3=1
docker compose up -d --no-deps --scale qacc-be-job1=0 --scale qacc-be-job2=1 --scale qacc-be-job3=1
docker compose up -d --no-deps --scale qacc-be-graph-ql1=0
docker compose up -d --no-deps --scale qacc-be-job1=0
docker compose up -d
# Wait for qacc-be-graph-ql1 to be healthy (timeout after 5 minutes)
Expand All @@ -189,9 +202,22 @@ jobs:
fi
echo "First deployment phase completed successfully"
rollout-deploy-2:
needs: rollout-deploy-1
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Second Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=1 --scale qacc-be-graph-ql2=0 --scale qacc-be-graph-ql3=1
docker compose up -d --no-deps --scale qacc-be-job1=1 --scale qacc-be-job2=0 --scale qacc-be-job3=1
docker compose up -d --no-deps --scale qacc-be-graph-ql2=0
docker compose up -d --no-deps --scale qacc-be-job2=0
docker compose up -d
# Wait for qacc-be-graph-ql2 to be healthy (timeout after 5 minutes)
Expand All @@ -213,9 +239,22 @@ jobs:
fi
echo "Second deployment phase completed successfully"
rollout-deploy-3:
needs: rollout-deploy-2
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Third Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=1 --scale qacc-be-graph-ql2=1 --scale qacc-be-graph-ql3=0
docker compose up -d --no-deps --scale qacc-be-job1=1 --scale qacc-be-job2=1 --scale qacc-be-job3=0
docker compose up -d --no-deps --scale qacc-be-graph-ql3=0
docker compose up -d --no-deps --scale qacc-be-job3=0
docker compose up -d
# Wait for qacc-be-graph-ql3 to be healthy (timeout after 5 minutes)
Expand Down
51 changes: 45 additions & 6 deletions .github/workflows/main-publish-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,23 @@ jobs:
docker image prune -a --force
docker compose pull
rollout-deploy-1:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Update each backend service one by one
## First Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=0 --scale qacc-be-graph-ql2=1 --scale qacc-be-graph-ql3=1
docker compose up -d --no-deps --scale qacc-be-job1=0 --scale qacc-be-job2=1 --scale qacc-be-job3=1
docker compose up -d --no-deps --scale qacc-be-graph-ql1=0
docker compose up -d --no-deps --scale qacc-be-job1=0
docker compose up -d
# Wait for qacc-be-graph-ql1 to be healthy (timeout after 5 minutes)
Expand All @@ -94,9 +107,22 @@ jobs:
fi
echo "First deployment phase completed successfully"
rollout-deploy-2:
needs: rollout-deploy-1
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Second Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=1 --scale qacc-be-graph-ql2=0 --scale qacc-be-graph-ql3=1
docker compose up -d --no-deps --scale qacc-be-job1=1 --scale qacc-be-job2=0 --scale qacc-be-job3=1
docker compose up -d --no-deps --scale qacc-be-graph-ql2=0
docker compose up -d --no-deps --scale qacc-be-job2=0
docker compose up -d
# Wait for qacc-be-graph-ql2 to be healthy (timeout after 5 minutes)
Expand All @@ -118,9 +144,22 @@ jobs:
fi
echo "Second deployment phase completed successfully"
rollout-deploy-3:
needs: rollout-deploy-2
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.PRODUCTION_HOST }}
username: ${{ secrets.PRODUCTION_USERNAME }}
key: ${{ secrets.PRODUCTION_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Third Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=1 --scale qacc-be-graph-ql2=1 --scale qacc-be-graph-ql3=0
docker compose up -d --no-deps --scale qacc-be-job1=1 --scale qacc-be-job2=1 --scale qacc-be-job3=0
docker compose up -d --no-deps --scale qacc-be-graph-ql3=0
docker compose up -d --no-deps --scale qacc-be-job3=0
docker compose up -d
# Wait for qacc-be-graph-ql3 to be healthy (timeout after 5 minutes)
Expand Down
53 changes: 46 additions & 7 deletions .github/workflows/staging-deploy-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,24 @@ jobs:
git pull origin staging
docker image prune -a --force
docker compose pull
rollout-deploy-1:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.STAGING_HOST }}
username: ${{ secrets.STAGING_USERNAME }}
key: ${{ secrets.STAGING_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Update each backend service one by one
## First Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=0 --scale qacc-be-graph-ql2=1 --scale qacc-be-graph-ql3=1
docker compose up -d --no-deps --scale qacc-be-job1=0 --scale qacc-be-job2=1 --scale qacc-be-job3=1
docker compose up -d --no-deps --scale qacc-be-graph-ql1=0
docker compose up -d --no-deps --scale qacc-be-job1=0
docker compose up -d
# Wait for qacc-be-graph-ql1 to be healthy (timeout after 5 minutes)
Expand All @@ -47,9 +60,22 @@ jobs:
fi
echo "First deployment phase completed successfully"
rollout-deploy-2:
needs: rollout-deploy-1
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.STAGING_HOST }}
username: ${{ secrets.STAGING_USERNAME }}
key: ${{ secrets.STAGING_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Second Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=1 --scale qacc-be-graph-ql2=0 --scale qacc-be-graph-ql3=1
docker compose up -d --no-deps --scale qacc-be-job1=1 --scale qacc-be-job2=0 --scale qacc-be-job3=1
docker compose up -d --no-deps --scale qacc-be-graph-ql2=0
docker compose up -d --no-deps --scale qacc-be-job2=0
docker compose up -d
# Wait for qacc-be-graph-ql2 to be healthy (timeout after 5 minutes)
Expand All @@ -71,9 +97,22 @@ jobs:
fi
echo "Second deployment phase completed successfully"
rollout-deploy-3:
needs: rollout-deploy-2
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.STAGING_HOST }}
username: ${{ secrets.STAGING_USERNAME }}
key: ${{ secrets.STAGING_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Third Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=1 --scale qacc-be-graph-ql2=1 --scale qacc-be-graph-ql3=0
docker compose up -d --no-deps --scale qacc-be-job1=1 --scale qacc-be-job2=1 --scale qacc-be-job3=0
docker compose up -d --no-deps --scale qacc-be-graph-ql3=0
docker compose up -d --no-deps --scale qacc-be-job3=0
docker compose up -d
# Wait for qacc-be-graph-ql3 to be healthy (timeout after 5 minutes)
Expand Down
51 changes: 45 additions & 6 deletions .github/workflows/staging-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,23 @@ jobs:
docker image prune -a --force
docker compose pull
rollout-deploy-1:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.STAGING_HOST }}
username: ${{ secrets.STAGING_USERNAME }}
key: ${{ secrets.STAGING_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Update each backend service one by one
## First Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=0 --scale qacc-be-graph-ql2=1 --scale qacc-be-graph-ql3=1
docker compose up -d --no-deps --scale qacc-be-job1=0 --scale qacc-be-job2=1 --scale qacc-be-job3=1
docker compose up -d --no-deps --scale qacc-be-graph-ql1=0
docker compose up -d --no-deps --scale qacc-be-job1=0
docker compose up -d
# Wait for qacc-be-graph-ql1 to be healthy (timeout after 5 minutes)
Expand All @@ -189,9 +202,22 @@ jobs:
fi
echo "First deployment phase completed successfully"
rollout-deploy-2:
needs: rollout-deploy-1
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.STAGING_HOST }}
username: ${{ secrets.STAGING_USERNAME }}
key: ${{ secrets.STAGING_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Second Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=1 --scale qacc-be-graph-ql2=0 --scale qacc-be-graph-ql3=1
docker compose up -d --no-deps --scale qacc-be-job1=1 --scale qacc-be-job2=0 --scale qacc-be-job3=1
docker compose up -d --no-deps --scale qacc-be-graph-ql2=0
docker compose up -d --no-deps --scale qacc-be-job2=0
docker compose up -d
# Wait for qacc-be-graph-ql2 to be healthy (timeout after 5 minutes)
Expand All @@ -213,9 +239,22 @@ jobs:
fi
echo "Second deployment phase completed successfully"
rollout-deploy-3:
needs: rollout-deploy-2
runs-on: ubuntu-latest
steps:
- name: SSH and Redeploy
uses: appleboy/[email protected]
with:
host: ${{ secrets.STAGING_HOST }}
username: ${{ secrets.STAGING_USERNAME }}
key: ${{ secrets.STAGING_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd QAcc-BE
## Third Deployment
docker compose up -d --no-deps --scale qacc-be-graph-ql1=1 --scale qacc-be-graph-ql2=1 --scale qacc-be-graph-ql3=0
docker compose up -d --no-deps --scale qacc-be-job1=1 --scale qacc-be-job2=1 --scale qacc-be-job3=0
docker compose up -d --no-deps --scale qacc-be-graph-ql3=0
docker compose up -d --no-deps --scale qacc-be-job3=0
docker compose up -d
# Wait for qacc-be-graph-ql3 to be healthy (timeout after 5 minutes)
Expand Down

0 comments on commit 0ff615c

Please sign in to comment.