Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e939fb7
feat-#131 dockerize
Apr 18, 2024
46381a4
feat-#131 changed readme for docker
LondheShubham153 Apr 18, 2024
0914a41
Update README.md with docker changes
LondheShubham153 Apr 18, 2024
f11ce8e
feat-#131 changed env files for docker
LondheShubham153 Apr 18, 2024
f0491b8
Update Dockerfile with tests
LondheShubham153 Apr 21, 2024
b7c1364
Update Dockerfile
LondheShubham153 Apr 21, 2024
ee78003
Update Dockerfile
LondheShubham153 Apr 21, 2024
d8dcd86
Update .env.docker
LondheShubham153 Apr 21, 2024
bd50330
Create Jenkinsfile
LondheShubham153 Apr 21, 2024
22fc9fb
Updated Dockerfile and env variables
May 26, 2024
c52d5bf
Added K8s manifests
DevMadhup May 26, 2024
0549310
Updated Manifests
May 26, 2024
0b2497b
Added kubeadm setup file
May 26, 2024
f17809b
Updated manifests
May 27, 2024
01134d1
Update kubeadm.md
DevMadhup May 27, 2024
3542024
Create README.md
DevMadhup May 27, 2024
de1ea15
Add files via upload
DevMadhup May 27, 2024
2b91e76
Create README.md
DevMadhup May 27, 2024
c642f7b
Update README.md
DevMadhup May 27, 2024
6505266
Update README.md
DevMadhup May 28, 2024
ce090fd
Create persistentVolume.yaml
DevMadhup May 28, 2024
debebf0
Create persistentVolumeClaim.yaml
DevMadhup May 28, 2024
a5c1195
Update mongodb.yaml
DevMadhup May 28, 2024
2d0c074
Update redis.yaml
DevMadhup May 28, 2024
0811795
Update persistentVolume.yaml
DevMadhup May 28, 2024
e5c34c9
Update persistentVolumeClaim.yaml
DevMadhup May 28, 2024
3ccbaeb
Update kubeadm.md
DevMadhup May 29, 2024
c3e8fb8
Update README.md
DevMadhup May 29, 2024
f441cf5
Update README.md
DevMadhup May 29, 2024
caae7ba
Update README.md
DevMadhup May 29, 2024
e0541fb
Update README.md
DevMadhup Jun 1, 2024
dabd14e
Update redis.yaml
DevMadhup Jun 1, 2024
9b764e4
Update kubeadm.md
DevMadhup Jun 1, 2024
4ed1e37
Update kubeadm.md
DevMadhup Jun 1, 2024
b7a6a1b
Added enhancement
DevMadhup Jun 1, 2024
1054209
Added enhancement
DevMadhup Jun 1, 2024
f0fdc8e
Create public-ipv4.sh
DevMadhup Jun 2, 2024
4502afe
Update public-ipv4.sh
DevMadhup Jun 3, 2024
c76ffb4
Added enhancements for automation
DevMadhup Jun 9, 2024
b2634fc
Delete Automations/public-ipv4.sh
DevMadhup Jun 9, 2024
dc8b03c
Update Jenkinsfile
DevMadhup Jun 9, 2024
df0c64a
Update Jenkinsfile
DevMadhup Jun 13, 2024
dcffe47
Create Jenkinsfile
DevMadhup Jun 13, 2024
18df5c3
Updated environment variables
Jun 13, 2024
d92022e
Updated environment variables
Jun 13, 2024
3b8dc12
Updated environment variables
Jun 13, 2024
cd13eed
Update Jenkinsfile
DevMadhup Jun 13, 2024
1b6def6
Updated environment variables
Jun 13, 2024
fc61e44
Updated environment variables
Jun 13, 2024
e630505
Updated environment variables
Jun 13, 2024
2b9df3a
Update Jenkinsfile
DevMadhup Jun 13, 2024
1b0bb5e
Update Jenkinsfile
DevMadhup Jun 13, 2024
2f562da
Create updatebackendnew.sh
DevMadhup Jul 8, 2024
287280b
Create updatefrontendnew.sh
DevMadhup Jul 8, 2024
b09bc9f
Update updatebackendnew.sh
DevMadhup Jul 8, 2024
228d59b
added enchancement
DevMadhup Jul 14, 2024
3acc289
Fix: wanderlust backend and frontend
DevMadhup Jul 15, 2024
a724e36
Update Dockerfile
Ashu407 Oct 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Automations/updateBackend.sh
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}"

Comment on lines +11 to +15
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Validate IPv4 and add curl timeouts; abort safely if unavailable

Prevent writing an empty IP to the env file when metadata is unreachable.

-ipv4_address=$(curl -s http://169.254.169.254/latest/meta-data/public-ipv4)
+ipv4_address=$(curl -s --connect-timeout 2 -m 4 http://169.254.169.254/latest/meta-data/public-ipv4 || true)
+if [ -z "${ipv4_address}" ]; then
+  echo -e "${RED}ERROR: Could not determine public IPv4 (metadata unavailable). Aborting without changes.${NC}"
+  exit 1
+fi
🤖 Prompt for AI Agents
In Automations/updateBackend.sh around lines 11 to 15, the script fetches the
public IPv4 without timeouts or validation and may write an empty value; update
the curl invocation to include sensible timeouts (e.g. --connect-timeout and
--max-time) and capture curl exit status, then validate the result against a
simple IPv4 regex (or use getent/hostname -I if available); if the result is
empty or fails validation, print an error and exit non‑zero without modifying
the env file, otherwise continue and write the validated IPv4.

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
Comment on lines +16 to +20
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Non‑zero exit on idempotent run will break Jenkins

exit -1 yields 255 and fails the stage when no change is needed. Return 0 for “already updated.”

-        echo -e "${YELLOW}${file_to_find} file is already updated to the current host's Ipv4 ${NC}"
-        exit -1;
+        echo -e "${YELLOW}${file_to_find} already matches current IPv4. No changes.${NC}"
+        exit 0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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 [[ "${alreadyUpdate}" == "FRONTEND_URL=\"http://${ipv4_address}:5173\"" ]]
then
echo -e "${YELLOW}${file_to_find} already matches current IPv4. No changes.${NC}"
exit 0
else
🧰 Tools
🪛 Shellcheck (0.11.0)

[error] 19-19: Can only exit with status 0-255. Other data should be written to stdout/stderr.

(SC2242)

🤖 Prompt for AI Agents
In Automations/updateBackend.sh around lines 16 to 20, the script exits with
exit -1 (which becomes 255) when the file is already updated; change this to
exit 0 so an idempotent run returns success for CI. Update the branch to echo
the "already updated" message and then call exit 0 (remove the unnecessary
semicolon) so Jenkins stages don't fail when no change is required.

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
31 changes: 31 additions & 0 deletions Automations/updateFrontend.sh
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}"

Comment on lines +11 to +15
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Harden IPv4 retrieval (timeout + fail if empty; IMDSv2 preferred)

Add curl timeouts and validate the value before proceeding. If empty, abort without touching the file. Consider IMDSv2 when on AWS.

-# 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)
+## Fetch public IPv4 (AWS IMDS). Use timeouts; abort if empty.
+ipv4_address=$(curl -s --connect-timeout 2 -m 4 http://169.254.169.254/latest/meta-data/public-ipv4 || true)
+if [ -z "${ipv4_address}" ]; then
+  echo -e "${RED}ERROR: Could not determine public IPv4 (metadata unavailable). Aborting without changes.${NC}"
+  exit 1
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# 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}"
## Fetch public IPv4 (AWS IMDS). Use timeouts; abort if empty.
ipv4_address=$(curl -s --connect-timeout 2 -m 4 http://169.254.169.254/latest/meta-data/public-ipv4 || true)
if [ -z "${ipv4_address}" ]; then
echo -e "${RED}ERROR: Could not determine public IPv4 (metadata unavailable). Aborting without changes.${NC}"
exit 1
fi
echo -e " ${GREEN}System Public Ipv4 address ${NC} : ${ipv4_address}"
🤖 Prompt for AI Agents
In Automations/updateFrontend.sh around lines 11 to 15, the script fetches the
public IPv4 without timeouts, validation or IMDSv2 support; update it to use
IMDSv2 by first requesting a token with a short timeout (curl --connect-timeout
and --max-time), then use that token to query the public-ipv4; if token request
fails, fall back to a timed metadata-v1 call; always check the returned value
and if empty or missing abort the script with a non-zero exit and a clear error
message so the file is not modified.

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
Comment on lines +16 to +20
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Do not exit with -1; return success on idempotent run

exit -1 maps to 255 and will fail the Jenkins stage when the file is already updated. Use 0 for idempotent no-op.

Apply:

-        echo -e "${YELLOW}${file_to_find} file is already updated to the current host's Ipv4 ${NC}"
-	exit -1;
+        echo -e "${YELLOW}${file_to_find} already matches current IPv4. No changes.${NC}"
+        exit 0
🧰 Tools
🪛 Shellcheck (0.11.0)

[error] 19-19: Can only exit with status 0-255. Other data should be written to stdout/stderr.

(SC2242)

🤖 Prompt for AI Agents
In Automations/updateFrontend.sh around lines 16 to 20, the script exits with -1
(which becomes 255) when the file is already updated; change that to return
success for an idempotent no-op by replacing exit -1 with exit 0 (or simply
remove the exit to allow normal successful completion), and ensure any
callers/Jenkins see a zero exit code for the already-updated case.

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
36 changes: 36 additions & 0 deletions Automations/updatebackendnew.sh
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
34 changes: 34 additions & 0 deletions Automations/updatefrontendnew.sh
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
78 changes: 78 additions & 0 deletions GitOps/Jenkinsfile
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
"""
Comment on lines +41 to +49
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Broken image tag substitution: patterns don’t match manifests

Manifest images are madhupdevops/wanderlust-*-beta, but sed searches backend-wanderlust/frontend-wanderlust. Tags won’t update.

Apply:

- sed -i -e 's/backend-wanderlust.*/backend-wanderlust:${params.BACKEND_DOCKER_TAG}/g' backend.yaml
+ sed -i -E "s|(image:\s*madhupdevops/wanderlust-backend-beta:).*|\1${params.BACKEND_DOCKER_TAG}|" backend.yaml
@@
- sed -i -e 's/frontend-wanderlust.*/frontend-wanderlust:${params.FRONTEND_DOCKER_TAG}/g' frontend.yaml
+ sed -i -E "s|(image:\s*madhupdevops/wanderlust-frontend-beta:).*|\1${params.FRONTEND_DOCKER_TAG}|" frontend.yaml

Optional: guard empty tags to avoid producing invalid manifests.

+ if [ -z "${params.BACKEND_DOCKER_TAG}" ] || [ -z "${params.FRONTEND_DOCKER_TAG}" ]; then
+   error "Missing required image tags"
+ fi

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In GitOps/Jenkinsfile around lines 41 to 49, the sed substitutions use
backend-wanderlust/frontend-wanderlust which don’t match the real image names
(madhupdevops/wanderlust-*-beta), so tags are not updated; change the sed
patterns to match the actual manifest image strings (e.g.
madhupdevops/wanderlust-backend-beta and madhupdevops/wanderlust-frontend-beta)
and replace only the tag portion with
${params.BACKEND_DOCKER_TAG}/${params.FRONTEND_DOCKER_TAG} respectively, and
optionally add a guard that skips substitution or fails the build if the
provided tag is empty to avoid producing invalid manifests.

}

}
}
}

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
'''
}
}
}
}
}
}
119 changes: 119 additions & 0 deletions Jenkinsfile
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")
}
Comment on lines +21 to +22
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid hardcoding branch; checkout the PR/target branch

Hardcoding "devops" ignores the branch that triggered the build. Use BRANCH_NAME/CHANGE_BRANCH or a parameter to ensure the pipeline builds the intended ref.

- code_checkout("https://github.com/DevMadhup/wanderlust.git","devops")
+ // For multibranch/PRs:
+ code_checkout("https://github.com/DevMadhup/wanderlust.git", env.CHANGE_BRANCH ?: env.BRANCH_NAME ?: "main")
🤖 Prompt for AI Agents
In Jenkinsfile around lines 21 to 22, the pipeline is hardcoding the branch name
"devops" in the code_checkout call which ignores the branch/PR that triggered
the build; change the call to use the build-provided branch variables (e.g.,
env.CHANGE_BRANCH or env.BRANCH_NAME) with a safe default (such as "main") so
the pipeline checks out the PR branch or multibranch branch that triggered the
job instead of a fixed branch.

}
}

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"
}
}
}
}
}
}
Comment on lines +63 to +85
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Parallel env setup will fail if update scripts return non‑zero on no‑op

Given the current scripts use exit -1 on “already updated,” this stage will fail intermittently. Ensure scripts exit 0 on no‑op, or wrap with || true until scripts are fixed.

- sh "bash updateBackend.sh"
+ sh "bash updateBackend.sh"
  ...
- sh "bash updateFrontend.sh"
+ sh "bash updateFrontend.sh"

And in the meantime (temporary mitigation):

sh "bash updateBackend.sh || true"
sh "bash updateFrontend.sh || true"
🤖 Prompt for AI Agents
In Jenkinsfile around lines 63 to 85, the parallel stage runs updateBackend.sh
and updateFrontend.sh which currently return non‑zero on no‑op and will cause
the pipeline to fail; fix by updating those scripts so they return 0 when
there's nothing to do (preferred), and as a temporary mitigation wrap the shell
calls in the pipeline to ignore non‑zero exits (e.g., run the commands with a
trailing "|| true") until the scripts are corrected.


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")
]
}
}
}
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,33 @@ _I'd love for you to make the most of this project - it's all about learning, he
npm run dev
```

### Setting up with Docker

1. **Ensure Docker and Docker Compose are Installed**

2. **Clone the Repository**

``` bash

git clone https://github.com/{your-username}/wanderlust.git
```
3. **Navigate to the Project Directory**

```bash

cd wanderlust

```
4. **Update Environment Variables** - If you anticipate the IP address of the instance might change, update the `.env.sample` file with the new IP address.

5. **Run Docker Compose**

```bash

docker-compose up
```
This command will build the Docker images and start the containers for the backend and frontend, enabling you to access the Wanderlust application.

Comment on lines +98 to +124
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Fix Docker setup instructions: update .env.docker files, not .env.sample

docker-compose uses backend/.env.docker and frontend/.env.docker. Editing .env.sample won’t apply to containers.

Suggested wording:

  • Update environment variables:
    • Edit backend/.env.docker (e.g., FRONTEND_URL) and frontend/.env.docker (e.g., VITE_API_PATH).
    • Or run Automations/updatebackendnew.sh and Automations/updatefrontendnew.sh to auto-set host IPs.
  • Start: docker compose up -d
🤖 Prompt for AI Agents
In README.md around lines 98 to 124, the Docker instructions incorrectly tell
users to edit .env.sample when docker-compose actually reads backend/.env.docker
and frontend/.env.docker; update the text to instruct users to edit
backend/.env.docker (e.g., FRONTEND_URL) and frontend/.env.docker (e.g.,
VITE_API_PATH) or run Automations/updatebackendnew.sh and
Automations/updatefrontendnew.sh to auto-set host IPs, and change the startup
command suggestion to use "docker compose up -d" for detached startup.

## 🌟 Ready to Contribute?

Kindly go through [CONTRIBUTING.md](https://github.com/krishnaacharyaa/wanderlust/blob/main/.github/CONTRIBUTING.md) to understand everything from setup to contributing guidelines.
Expand Down
10 changes: 10 additions & 0 deletions backend/.env.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
MONGODB_URI="mongodb://mongo-service/wanderlust"
REDIS_URL="redis://redis-service:6379"
PORT=8080
FRONTEND_URL="http://13.52.243.88:5173"
ACCESS_COOKIE_MAXAGE=120000
ACCESS_TOKEN_EXPIRES_IN='120s'
REFRESH_COOKIE_MAXAGE=120000
REFRESH_TOKEN_EXPIRES_IN='120s'
JWT_SECRET=70dd8b38486eee723ce2505f6db06f1ee503fde5eb06fc04687191a0ed665f3f98776902d2c89f6b993b1c579a87fedaf584c693a106f7cbf16e8b4e67e9d6df
NODE_ENV=Development
Comment on lines +1 to +10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Remove hard-coded JWT secret from repo and use secrets/placeholders

A real-looking JWT_SECRET is committed (detected by gitleaks). This is a security blocker. Replace with a placeholder and inject via secret manager, CI/CD, or a local untracked .env.

-JWT_SECRET=70dd8b38486eee723ce2505f6db06f1ee503fde5eb06fc04687191a0ed665f3f98776902d2c89f6b993b1c579a87fedaf584c693a106f7cbf16e8b4e67e9d6df
+JWT_SECRET=change-me

Additional recommendations:

  • Use service DNS names in Docker Compose to avoid IPs, e.g., VITE_API_PATH=http://backend:8080 and FRONTEND_URL=http://frontend:5173.
  • Consider NODE_ENV=development or production (lowercase is conventional in Node ecosystems).
  • Remove unnecessary quotes in values to satisfy dotenv linters.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
MONGODB_URI="mongodb://mongo-service/wanderlust"
REDIS_URL="redis://redis-service:6379"
PORT=8080
FRONTEND_URL="http://13.52.243.88:5173"
ACCESS_COOKIE_MAXAGE=120000
ACCESS_TOKEN_EXPIRES_IN='120s'
REFRESH_COOKIE_MAXAGE=120000
REFRESH_TOKEN_EXPIRES_IN='120s'
JWT_SECRET=70dd8b38486eee723ce2505f6db06f1ee503fde5eb06fc04687191a0ed665f3f98776902d2c89f6b993b1c579a87fedaf584c693a106f7cbf16e8b4e67e9d6df
NODE_ENV=Development
MONGODB_URI="mongodb://mongo-service/wanderlust"
REDIS_URL="redis://redis-service:6379"
PORT=8080
FRONTEND_URL="http://13.52.243.88:5173"
ACCESS_COOKIE_MAXAGE=120000
ACCESS_TOKEN_EXPIRES_IN='120s'
REFRESH_COOKIE_MAXAGE=120000
REFRESH_TOKEN_EXPIRES_IN='120s'
JWT_SECRET=change-me
NODE_ENV=Development
🧰 Tools
🪛 dotenv-linter (3.3.0)

[warning] 1-1: [QuoteCharacter] The value has quote characters (', ")

(QuoteCharacter)


[warning] 2-2: [QuoteCharacter] The value has quote characters (', ")

(QuoteCharacter)


[warning] 3-3: [UnorderedKey] The PORT key should go before the REDIS_URL key

(UnorderedKey)


[warning] 4-4: [QuoteCharacter] The value has quote characters (', ")

(QuoteCharacter)


[warning] 4-4: [UnorderedKey] The FRONTEND_URL key should go before the MONGODB_URI key

(UnorderedKey)


[warning] 5-5: [UnorderedKey] The ACCESS_COOKIE_MAXAGE key should go before the FRONTEND_URL key

(UnorderedKey)


[warning] 6-6: [QuoteCharacter] The value has quote characters (', ")

(QuoteCharacter)


[warning] 6-6: [UnorderedKey] The ACCESS_TOKEN_EXPIRES_IN key should go before the FRONTEND_URL key

(UnorderedKey)


[warning] 8-8: [QuoteCharacter] The value has quote characters (', ")

(QuoteCharacter)


[warning] 9-9: [UnorderedKey] The JWT_SECRET key should go before the MONGODB_URI key

(UnorderedKey)


[warning] 10-10: [UnorderedKey] The NODE_ENV key should go before the PORT key

(UnorderedKey)

🪛 Gitleaks (8.28.0)

[high] 9-9: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

🤖 Prompt for AI Agents
In backend/.env.docker around lines 1 to 10, a real-looking JWT_SECRET is
committed; replace it with a non-sensitive placeholder (e.g.
JWT_SECRET=__REPLACE_WITH_SECRET__) and ensure the real secret is injected at
runtime via your secret manager, CI/CD environment variables, or an untracked
local .env file; also update FRONTEND_URL and any API path to use Docker service
DNS (e.g. http://frontend:5173 and http://backend:8080 or VITE_API_PATH) instead
of an IP, remove unnecessary quotes from values to satisfy dotenv linters, and
normalize NODE_ENV to lowercase (development or production).

2 changes: 1 addition & 1 deletion backend/.env.sample
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"
Loading
Loading