-
Notifications
You must be signed in to change notification settings - Fork 0
Automation deployment for staging and prod #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Ayush8923
wants to merge
12
commits into
main
Choose a base branch
from
feat/frontend-cicd-deployment
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+82
−5
Open
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6c3d49c
feat(*): automation deployment for staging and prod
Ayush8923 725f60f
chore: refine log separators in deployment script
Ayush8923 ff4167b
fix(*): added the environment name in deployment pipeline
Ayush8923 8d79917
fix(*): update naming convention
Ayush8923 dd273e3
Merge branch 'main' into feat/frontend-cicd-deployment
Prajna1999 e8ca6ee
feat: testing CD on branch
Prajna1999 3e4b468
Merge branch 'main' into feat/frontend-cicd-deployment
Ayush8923 c1eb2e5
fix(*): update the readme and prduction deployment also
Ayush8923 baf27bd
Merge branch 'main' of https://github.com/ProjectTech4DevAI/kaapi-fro…
Ayush8923 7f51fc5
Merge branch 'main' into feat/frontend-cicd-deployment
Ayush8923 1cf8617
Merge branch 'main' into feat/frontend-cicd-deployment
Ayush8923 b5dd403
feat(*): for the deployment use aws ssm instead of ssh
Ayush8923 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Deploy Kaapi to EC2 Production | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - release | ||
|
|
||
| jobs: | ||
| deploy: | ||
| name: Deploy Kaapi Frontend to EC2 Production | ||
| runs-on: ubuntu-latest | ||
| environment: AWS_PRODUCTION_ENV | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Deploy via SSH | ||
| uses: appleboy/ssh-action@v1.0.3 | ||
| env: | ||
| PM2_APP_NAME: ${{ secrets.PM2_APP_NAME }} | ||
| BUILD_DIRECTORY: ${{ secrets.BUILD_DIRECTORY }} | ||
| with: | ||
| host: ${{ secrets.EC2_HOST }} | ||
| username: ${{ secrets.EC2_USER }} | ||
| key: ${{ secrets.EC2_SSH_KEY }} | ||
| script_stop: true | ||
Ayush8923 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| script: | | ||
| set -e | ||
|
|
||
| echo "=== Navigating to Project Directory ===" | ||
| cd $BUILD_DIRECTORY | ||
|
|
||
| echo "=== Fetch Latest Code ===" | ||
| git pull origin release | ||
|
|
||
| echo "=== Stop Running Application ===" | ||
| pm2 stop "$PM2_APP_NAME" || true | ||
|
|
||
| echo "=== Install Dependencies ===" | ||
| npm ci | ||
|
|
||
| echo "=== Build Application ===" | ||
| npm run build | ||
|
|
||
| echo "=== Start Application ===" | ||
| pm2 start "$PM2_APP_NAME" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: Deploy Kaapi to EC2 Staging | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| deploy: | ||
| name: Deploy Kaapi Frontend to EC2 Staging | ||
| runs-on: ubuntu-latest | ||
| environment: AWS_STAGING_ENV | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Deploy via SSH | ||
| uses: appleboy/ssh-action@v1.0.3 | ||
| env: | ||
| PM2_APP_NAME: ${{ secrets.PM2_APP_NAME }} | ||
| BUILD_DIRECTORY: ${{ secrets.BUILD_DIRECTORY }} | ||
| with: | ||
| host: ${{ secrets.EC2_HOST }} | ||
| username: ${{ secrets.EC2_USER }} | ||
| key: ${{ secrets.EC2_SSH_KEY }} | ||
| script_stop: true | ||
| script: | | ||
| set -e | ||
|
|
||
| echo "=== Navigating to Project Directory ===" | ||
| cd $BUILD_DIRECTORY | ||
|
|
||
| echo "=== Fetch Latest Code ===" | ||
| git pull origin main | ||
|
|
||
| echo "=== Stop Running Application ===" | ||
| pm2 stop "$PM2_APP_NAME" || true | ||
|
|
||
| echo "=== Install Dependencies ===" | ||
| npm ci | ||
|
|
||
| echo "=== Build Application ===" | ||
| npm run build | ||
|
|
||
| echo "=== Start Application ===" | ||
| pm2 start "$PM2_APP_NAME" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Production uses the release branch, as discussed in the GitHub issue.
For reference, you can check it here: #22 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for confusion, my exact statement was this: can use main branch for staging and use release for production same way the Kaapi-backend is working or else use dev branch for staging and main branch for prod
Here I want to say use release means GitHub release not branch name release ... again sorry for the confusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have update the flow same as the backend so in the production automation deployment only run when tags like v1.0.0, v2.1.0, etc., are created. and also updated the Readme accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great