forked from krishnaacharyaa/wanderlust
-
Notifications
You must be signed in to change notification settings - Fork 190
Dev #7
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
Gujjar-Apurv-023
wants to merge
58
commits into
DevMadhup:main
Choose a base branch
from
Gujjar-Apurv-023:dev
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.
Open
Dev #7
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
e939fb7
feat-#131 dockerize
46381a4
feat-#131 changed readme for docker
LondheShubham153 0914a41
Update README.md with docker changes
LondheShubham153 f11ce8e
feat-#131 changed env files for docker
LondheShubham153 f0491b8
Update Dockerfile with tests
LondheShubham153 b7c1364
Update Dockerfile
LondheShubham153 ee78003
Update Dockerfile
LondheShubham153 d8dcd86
Update .env.docker
LondheShubham153 bd50330
Create Jenkinsfile
LondheShubham153 22fc9fb
Updated Dockerfile and env variables
c52d5bf
Added K8s manifests
DevMadhup 0549310
Updated Manifests
0b2497b
Added kubeadm setup file
f17809b
Updated manifests
01134d1
Update kubeadm.md
DevMadhup 3542024
Create README.md
DevMadhup de1ea15
Add files via upload
DevMadhup 2b91e76
Create README.md
DevMadhup c642f7b
Update README.md
DevMadhup 6505266
Update README.md
DevMadhup ce090fd
Create persistentVolume.yaml
DevMadhup debebf0
Create persistentVolumeClaim.yaml
DevMadhup a5c1195
Update mongodb.yaml
DevMadhup 2d0c074
Update redis.yaml
DevMadhup 0811795
Update persistentVolume.yaml
DevMadhup e5c34c9
Update persistentVolumeClaim.yaml
DevMadhup 3ccbaeb
Update kubeadm.md
DevMadhup c3e8fb8
Update README.md
DevMadhup f441cf5
Update README.md
DevMadhup caae7ba
Update README.md
DevMadhup e0541fb
Update README.md
DevMadhup dabd14e
Update redis.yaml
DevMadhup 9b764e4
Update kubeadm.md
DevMadhup 4ed1e37
Update kubeadm.md
DevMadhup b7a6a1b
Added enhancement
DevMadhup 1054209
Added enhancement
DevMadhup f0fdc8e
Create public-ipv4.sh
DevMadhup 4502afe
Update public-ipv4.sh
DevMadhup c76ffb4
Added enhancements for automation
DevMadhup b2634fc
Delete Automations/public-ipv4.sh
DevMadhup dc8b03c
Update Jenkinsfile
DevMadhup df0c64a
Update Jenkinsfile
DevMadhup dcffe47
Create Jenkinsfile
DevMadhup 18df5c3
Updated environment variables
d92022e
Updated environment variables
3b8dc12
Updated environment variables
cd13eed
Update Jenkinsfile
DevMadhup 1b6def6
Updated environment variables
fc61e44
Updated environment variables
e630505
Updated environment variables
2b9df3a
Update Jenkinsfile
DevMadhup 1b0bb5e
Update Jenkinsfile
DevMadhup 2f562da
Create updatebackendnew.sh
DevMadhup 287280b
Create updatefrontendnew.sh
DevMadhup b09bc9f
Update updatebackendnew.sh
DevMadhup 228d59b
added enchancement
DevMadhup 3acc289
Fix: wanderlust backend and frontend
DevMadhup 12f0abc
updated project
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,31 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Initializing variables | ||
| file_to_find="../backend/.env.docker" | ||
| alreadyUpdate=$(sed -n "4p" ../backend/.env.docker) | ||
| RED='\033[0;31m' | ||
| GREEN='\033[0;32m' | ||
| YELLOW='\033[0;33m' | ||
| NC='\033[0m' | ||
|
|
||
| # Use curl to fetch the public IPv4 address from the metadata service | ||
| ipv4_address=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4) | ||
|
|
||
| echo -e " ${GREEN}System Public Ipv4 address ${NC} : ${ipv4_address}" | ||
|
|
||
| if [[ "${alreadyUpdate}" == "FRONTEND_URL=\"http://${ipv4_address}:5173\"" ]] | ||
| then | ||
| echo -e "${YELLOW}${file_to_find} file is already updated to the current host's Ipv4 ${NC}" | ||
| exit -1; | ||
| else | ||
| if [ -f ${file_to_find} ] | ||
| then | ||
| echo -e "${GREEN}${file_to_find}${NC} found.." | ||
| echo -e "${YELLOW}Configuring env variables in ${NC} ${file_to_find}" | ||
| sleep 7s; | ||
| sed -i -e "s|FRONTEND_URL.*|FRONTEND_URL=\"http://${ipv4_address}:5173\"|g" ${file_to_find} | ||
| echo -e "${GREEN}env variables configured..${NC}" | ||
| else | ||
| echo -e "${RED}ERROR : File not found..${NC}" | ||
| fi | ||
| fi |
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,31 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Initializing variables | ||
| file_to_find="../frontend/.env.docker" | ||
| alreadyUpdate=$(cat ../frontend/.env.docker) | ||
| RED='\033[0;31m' | ||
| GREEN='\033[0;32m' | ||
| YELLOW='\033[0;33m' | ||
| NC='\033[0m' | ||
|
|
||
| # Use curl to fetch the public IPv4 address from the metadata service | ||
| ipv4_address=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4) | ||
|
|
||
| echo -e " ${GREEN}System Public Ipv4 address ${NC} : ${ipv4_address}" | ||
|
|
||
| if [[ "${alreadyUpdate}" == "VITE_API_PATH=\"http://${ipv4_address}:31100\"" ]] | ||
| then | ||
| echo -e "${YELLOW}${file_to_find} file is already updated to the current host's Ipv4 ${NC}" | ||
| exit -1; | ||
| else | ||
| if [ -f ${file_to_find} ] | ||
| then | ||
| echo -e "${GREEN}${file_to_find}${NC} found.." | ||
| echo -e "${YELLOW}Configuring env variables in ${NC} ${file_to_find}" | ||
| sleep 7s; | ||
| sed -i -e "s|VITE_API_PATH.*|VITE_API_PATH=\"http://${ipv4_address}:31100\"|g" ${file_to_find} | ||
| echo -e "${GREEN}env variables configured..${NC}" | ||
| else | ||
| echo -e "${RED}ERROR : File not found..${NC}" | ||
| fi | ||
| fi |
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,36 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Set the Instance ID and path to the .env file | ||
| INSTANCE_ID="i-0c7c9d3d4e8c3a012" | ||
|
|
||
| # Retrieve the public IP address of the specified EC2 instance | ||
| ipv4_address=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID --query 'Reservations[0].Instances[0].PublicIpAddress' --output text) | ||
|
|
||
| # Initializing variables | ||
| file_to_find="../backend/.env.docker" | ||
| alreadyUpdate=$(sed -n "4p" ../backend/.env.docker) | ||
| RED='\033[0;31m' | ||
| GREEN='\033[0;32m' | ||
| YELLOW='\033[0;33m' | ||
| NC='\033[0m' | ||
|
|
||
| # Use curl to fetch the public IPv4 address from the metadata service | ||
|
|
||
| echo -e " ${GREEN}System Public Ipv4 address ${NC} : ${ipv4_address}" | ||
|
|
||
| if [[ "${alreadyUpdate}" == "FRONTEND_URL=\"http://${ipv4_address}:5173\"" ]] | ||
| then | ||
| echo -e "${YELLOW}${file_to_find} file is already updated to the current host's Ipv4 ${NC}" | ||
| exit -1; | ||
| else | ||
| if [ -f ${file_to_find} ] | ||
| then | ||
| echo -e "${GREEN}${file_to_find}${NC} found.." | ||
| echo -e "${YELLOW}Configuring env variables in ${NC} ${file_to_find}" | ||
| sleep 7s; | ||
| sed -i -e "s|FRONTEND_URL.*|FRONTEND_URL=\"http://${ipv4_address}:5173\"|g" ${file_to_find} | ||
| echo -e "${GREEN}env variables configured..${NC}" | ||
| else | ||
| echo -e "${RED}ERROR : File not found..${NC}" | ||
| fi | ||
| fi |
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,34 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Set the Instance ID and path to the .env file | ||
| INSTANCE_ID="i-0c7c9d3d4e8c3a012" | ||
|
|
||
| # Retrieve the public IP address of the specified EC2 instance | ||
| ipv4_address=$(aws ec2 describe-instances --instance-ids $INSTANCE_ID --query 'Reservations[0].Instances[0].PublicIpAddress' --output text) | ||
|
|
||
| # Initializing variables | ||
| file_to_find="../frontend/.env.docker" | ||
| alreadyUpdate=$(cat ../frontend/.env.docker) | ||
| RED='\033[0;31m' | ||
| GREEN='\033[0;32m' | ||
| YELLOW='\033[0;33m' | ||
| NC='\033[0m' | ||
|
|
||
| echo -e " ${GREEN}System Public Ipv4 address ${NC} : ${ipv4_address}" | ||
|
|
||
| if [[ "${alreadyUpdate}" == "VITE_API_PATH=\"http://${ipv4_address}:31100\"" ]] | ||
| then | ||
| echo -e "${YELLOW}${file_to_find} file is already updated to the current host's Ipv4 ${NC}" | ||
| exit -1; | ||
| else | ||
| if [ -f ${file_to_find} ] | ||
| then | ||
| echo -e "${GREEN}${file_to_find}${NC} found.." | ||
| echo -e "${YELLOW}Configuring env variables in ${NC} ${file_to_find}" | ||
| sleep 7s; | ||
| sed -i -e "s|VITE_API_PATH.*|VITE_API_PATH=\"http://${ipv4_address}:31100\"|g" ${file_to_find} | ||
| echo -e "${GREEN}env variables configured..${NC}" | ||
| else | ||
| echo -e "${RED}ERROR : File not found..${NC}" | ||
| fi | ||
| fi |
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,78 @@ | ||
| @Library('Shared') _ | ||
| pipeline { | ||
| agent {label 'Node'} | ||
|
|
||
| parameters { | ||
| string(name: 'FRONTEND_DOCKER_TAG', defaultValue: '', description: 'Frontend Docker tag of the image built by the CI job') | ||
| string(name: 'BACKEND_DOCKER_TAG', defaultValue: '', description: 'Backend Docker tag of the image built by the CI job') | ||
| } | ||
|
|
||
| stages { | ||
| stage("Workspace cleanup"){ | ||
| steps{ | ||
| script{ | ||
| cleanWs() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Git: Code Checkout') { | ||
| steps { | ||
| script{ | ||
| code_checkout("https://github.com/DevMadhup/wanderlust.git","devops") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Verify: Docker Image Tags') { | ||
| steps { | ||
| script{ | ||
| echo "FRONTEND_DOCKER_TAG: ${params.FRONTEND_DOCKER_TAG}" | ||
| echo "BACKEND_DOCKER_TAG: ${params.BACKEND_DOCKER_TAG}" | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
| stage("Update: Kubernetes manifests"){ | ||
| steps{ | ||
| script{ | ||
| dir('kubernetes'){ | ||
| sh """ | ||
| sed -i -e 's/backend-wanderlust.*/backend-wanderlust:${params.BACKEND_DOCKER_TAG}/g' backend.yaml | ||
| """ | ||
| } | ||
|
|
||
| dir('kubernetes'){ | ||
| sh """ | ||
| sed -i -e 's/frontend-wanderlust.*/frontend-wanderlust:${params.FRONTEND_DOCKER_TAG}/g' frontend.yaml | ||
| """ | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("Git: Code update and push to GitHub"){ | ||
| steps{ | ||
| script{ | ||
| withCredentials([gitUsernamePassword(credentialsId: 'Github-cred', gitToolName: 'Default')]) { | ||
| sh ''' | ||
| echo "Checking repository status: " | ||
| git status | ||
|
|
||
| echo "Adding changes to git: " | ||
| git add . | ||
|
|
||
| echo "Commiting changes: " | ||
| git commit -m "Updated environment variables" | ||
|
|
||
| echo "Pushing changes to github: " | ||
| git push https://github.com/DevMadhup/wanderlust.git devops | ||
| ''' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
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,119 @@ | ||
| @Library('Shared') _ | ||
| pipeline { | ||
| agent any | ||
|
|
||
| environment{ | ||
| SONAR_HOME = tool "Sonar" | ||
| } | ||
| stages { | ||
|
|
||
| stage("Workspace cleanup"){ | ||
| steps{ | ||
| script{ | ||
| cleanWs() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Git: Code Checkout') { | ||
| steps { | ||
| script{ | ||
| code_checkout("https://github.com/DevMadhup/wanderlust.git","devops") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("OWASP: Dependency check"){ | ||
| steps{ | ||
| script{ | ||
| owasp_dependency() | ||
| } | ||
| } | ||
| post{ | ||
| success{ | ||
| archiveArtifacts artifacts: '**/dependency-check-report.xml', followSymlinks: false, onlyIfSuccessful: true | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("Trivy: Filesystem scan"){ | ||
| steps{ | ||
| script{ | ||
| trivy_scan() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("SonarQube: Code Analysis"){ | ||
| steps{ | ||
| script{ | ||
| sonarqube_analysis("Sonar","wanderlust","wanderlust") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("SonarQube: Code Quality Gates"){ | ||
| steps{ | ||
| script{ | ||
| sonarqube_code_quality() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage('Exporting environment variables') { | ||
| parallel{ | ||
| stage("Backend env setup"){ | ||
| steps { | ||
| script{ | ||
| dir("Automations"){ | ||
| sh "bash updateBackend.sh" | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("Frontend env setup"){ | ||
| steps { | ||
| script{ | ||
| dir("Automations"){ | ||
| sh "bash updateFrontend.sh" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("Docker: Build Images"){ | ||
| steps{ | ||
| script{ | ||
| dir('backend'){ | ||
| docker_build("backend-wanderlust","test-image-donot-use","madhupdevops") | ||
| } | ||
|
|
||
| dir('frontend'){ | ||
| docker_build("frontend-wanderlust","test-image-donot-use","madhupdevops") | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| stage("Docker: Push to DockerHub"){ | ||
| steps{ | ||
| script{ | ||
| docker_push("backend-wanderlust","test-image-donot-use","madhupdevops") | ||
| docker_push("frontend-wanderlust","test-image-donot-use","madhupdevops") | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| post{ | ||
| success{ | ||
| build job: "Wanderlust-CD", parameters: [ | ||
| string(name: 'FRONTEND_DOCKER_TAG', value: "test-image-donot-use"), | ||
| string(name: 'BACKEND_DOCKER_TAG', value: "test-image-donot-use") | ||
| ] | ||
| } | ||
| } | ||
| } |
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
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,9 @@ | ||
| MONGODB_URI="mongodb://mongo-service/wanderlust" | ||
| REDIS_URL="redis://redis-service:6379" | ||
| PORT=5000 | ||
| ACCESS_COOKIE_MAXAGE=120000 | ||
| ACCESS_TOKEN_EXPIRES_IN='120s' | ||
| REFRESH_COOKIE_MAXAGE=120000 | ||
| REFRESH_TOKEN_EXPIRES_IN='120s' | ||
| JWT_SECRET=70dd8b38486eee723ce2505f6db06f1ee503fde5eb06fc04687191a0ed665f3f98776902d2c89f6b993b1c579a87fedaf584c693a106f7cbf16e8b4e67e9d6df | ||
| NODE_ENV=Development | ||
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 |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| MONGODB_URI="mongodb://127.0.0.1/wanderlust" | ||
| REDIS_URL="127.0.0.1:6379" | ||
| REDIS_URL="127.0.0.1:6379" |
Oops, something went wrong.
Oops, something went wrong.
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.
Remove committed JWT secret and inject it from secrets management.
Line 8 contains a live secret in source control. This is a blocker security issue and should be rotated immediately.
Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 dotenv-linter (4.0.0)
[warning] 8-8: [UnorderedKey] The JWT_SECRET key should go before the MONGODB_URI key
(UnorderedKey)
🤖 Prompt for AI Agents