Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
81 changes: 81 additions & 0 deletions Jenkinsfile1
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
pipeline {
agent any
environment {
SONAR_HOME = tool "Sonar"
}
stages {
stage("Clone Code from GitHub") {
steps {
git url: "https://github.com/Sufiyan12421/Wanderlust-Mega-Project.git", branch: "main"
}
}

stage("SonarQube Quality Analysis") {
steps {
withSonarQubeEnv("Sonar") {
sh """
$SONAR_HOME/bin/sonar-scanner \
-Dsonar.projectKey=wanderlust \
-Dsonar.projectName=wanderlust
"""
}
}
}

stage("OWASP Dependency Check") {
steps {
dependencyCheck additionalArguments: '--scan ./', odcInstallation: 'dc'
dependencyCheckPublisher pattern: '**/dependency-check-report.xml'
}
}

stage("Sonar Quality Gate Scan") {
steps {
timeout(time: 2, unit: "MINUTES") {
waitForQualityGate abortPipeline: false
}
}
}

stage("Trivy File System Scan") {
steps {
sh "trivy fs ./ --format table -o trivy-fs-report.html"
archiveArtifacts artifacts: 'trivy-fs-report.html', allowEmptyArchive: true
}
}

stage("Deploy Using Docker Compose") {
steps {
sh '''
# Detect docker-compose command (v1 vs v2)
if command -v docker-compose >/dev/null 2>&1; then
COMPOSE_CMD="docker-compose"
else
COMPOSE_CMD="docker compose"
fi

echo "Using compose command: $COMPOSE_CMD"

# Stop and remove all old containers, networks, volumes for this compose project
$COMPOSE_CMD down --remove-orphans || true

# Remove any stale backend container by name (just in case)
docker rm -f backend || true

# Pull latest images
$COMPOSE_CMD pull

# Build fresh images without cache
$COMPOSE_CMD build --no-cache

# Start services in detached mode, recreating containers
$COMPOSE_CMD up -d --force-recreate

# Capture logs from backend only (or all if you want)
$COMPOSE_CMD logs backend > backend-logs.txt || true
'''
archiveArtifacts artifacts: 'backend-logs.txt', allowEmptyArchive: true
}
}
}
}
9 changes: 5 additions & 4 deletions backend/.env.docker
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
MONGODB_URI="mongodb://mongo-service/wanderlust"
REDIS_URL="redis://redis-service:6379"
PORT=8080
FRONTEND_URL="http://34.213.249.66:5173"
MONGODB_URI="mongodb://mongodb:27017/wanderlust"
REDIS_URL="redis://redis:6379"
PORT=5000
FRONTEND_URL="http://3.80.120.116: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

35 changes: 23 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
version: "3.8"

services:
mongodb:
container_name: mongo
image: mongo:latest
container_name: mongo
volumes:
- ./backend/data:/data
ports:
- "27017:27017"
networks:
- backend-network

redis:
image: redis:7.0.5-alpine
container_name: redis
restart: unless-stopped
expose:
- 6379
networks:
- backend-network

backend:
container_name: backend
build: ./backend
container_name: backend
env_file:
- ./backend/.env.docker
ports:
- "5000:5000"
depends_on:
- mongodb
- redis
networks:
- backend-network

frontend:
container_name: frontend
build: ./frontend
container_name: frontend
env_file:
- ./frontend/.env.docker
ports:
- "5173:5173"

redis:
container_name: redis
restart: unless-stopped
image: redis:7.0.5-alpine
expose:
- 6379
depends_on:
- mongodb
networks:
- backend-network

volumes:
data:

networks:
backend-network:
2 changes: 1 addition & 1 deletion frontend/.env.docker
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VITE_API_PATH="http://34.213.249.66:31100"
VITE_API_PATH="http://wanderlust.logicleaf.in:5000"