Skip to content

NextAI-Gen/devops-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DevOps CI/CD Implementation Project

Project Overview

This project demonstrates a professional-grade DevOps workflow for a Node.js application. It covers everything from source code management to automated testing, containerization, and continuous deployment using Jenkins.

Key Features

  • Application: Simple Node.js Express server with a modern, responsive UI.
  • Source Control: GitHub integration with structured branching and commit history.
  • CI/CD Pipeline: Automated Jenkins pipeline (Checkout → Install → Test → Build → Deploy).
  • Containerization: Fully Dockerized application for consistent environments.
  • Automated Testing: Unit tests implemented with Jest.

Tools Used

Category Tool
Language Node.js
Web Framework Express
Testing Jest
Version Control Git / GitHub
CI/CD Jenkins
Containerization Docker

Steps to Run the Project

1. Local Development

# Install dependencies
npm install

# Run the app locally
npm run dev

The app will be available at http://localhost:3000.

2. Dockerization

# Build the Docker image
docker build -t devops-demo:latest .

# Run the application in a container
docker run -p 3000:3000 devops-demo:latest

3. CI/CD Workflow (Jenkins)

The Jenkinsfile in this repository automates the following stages:

  1. Checkout: Pulls the latest code from GitHub.
  2. Install: Installs dependencies using npm install.
  3. Test: Runs automated Jest tests. If any test fails, the build stops.
  4. Build Docker Image: Builds a fresh Docker image from the latest code.
  5. Deploy: Runs the newly built container (simulating deployment).

CI/CD Workflow Explanation

  1. Code Commit: A developer pushes code to the dev or main branch on GitHub.
  2. Trigger: GitHub sends a webhook notification to the Jenkins server.
  3. Pipeline Execution: Jenkins automatically starts the pipeline defined in the Jenkinsfile.
  4. Verification: The code is tested and validated.
  5. Artifact Creation: A Docker image is created, ensuring the app is packaged with all its dependencies.
  6. Delivery: The application is updated automatically, reducing manual errors and downtime.

GitHub & Jenkins Integration

To set up the automated trigger:

  1. Go to your GitHub Repository Settings > Webhooks.
  2. Add your Jenkins URL (e.g., http://your-jenkins-url/github-webhook/).
  3. In Jenkins, create a Pipeline Job and point it to your repository URL.
  4. Enable "GitHub hook trigger for GITScm polling" in the job configuration.

Branching Strategy

  • main: Production-ready code.
  • dev: Development and integration branch.
  • feature/*: Specific feature development branches.

License

MIT

About

A professional DevOps implementation showcasing CI/CD with Jenkins, Docker, and Node.js.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors