Skip to main content

Command Palette

Search for a command to run...

Day 24 : Complete Jenkins CI/CD Project

Published
โ€ข2 min read
Day 24 : Complete Jenkins CI/CD Project

Hello DevOps Enthusiasts! ๐Ÿš€

Welcome to Day 24 of our #90DaysOfDevOps challenge. Today, we're diving into a crucial task: setting up a complete CI/CD pipeline for your Node.js application using Jenkins. This project will not only enhance your DevOps skills but also be a great addition to your resume. Let's get started! ๐Ÿ˜

Task 1: Setting Up the Project

Step 1: Fork the Repository

First, you need to fork the repository. This will create a copy of the project under your GitHub account, allowing you to make changes without affecting the original project.

  1. Go to the repository URL.

  2. Click on the "Fork" button in the upper right corner.

  3. Select your GitHub account to fork the repository.

Step 2: GitHub Integration with Jenkins

Next, set up a connection between your Jenkins job and your GitHub repository.

  1. Open Jenkins Dashboard.

  2. Create a New Item: Enter a name for your job and select "Freestyle project

  3. Configure GitHub Project:

    • In the "General" tab, check "GitHub project" and enter your repository URL.

  1. Source Code Management:

    • Select "Git" and enter your repository URL.

    • Add credentials if required.

Go to your GitHub profile settings.

Go to SSH & GPG keys, Click-on New SSH Key.

Add your private key here.

Click-on Build now

Task 2: Running the Application with Docker Compose

Step 1: Create a Docker Compose File

Docker Compose simplifies running multi-container Docker applications. Create a docker-compose.yml file in your project root:

version: '3'
services:
  app:
    image: node:14
    working_dir: /app
    volumes:
      - .:/app
    command: sh -c "npm install && npm start"
    ports:
      - "3000:3000"

Step 2: Configure Jenkins Job

  1. Open Jenkins Job Configuration.

  2. Build Triggers: Ensure "GitHub hook trigger for GITScm polling" is checked.

  3. Build Environment: Check "Provide Node & npm bin/ folder to PATH".

  4. Build Steps:

    • Execute Shell:

        docker-compose up -d
      

Step 3: Run the Project

  1. Save your Jenkins job configuration.

  2. Click "Build Now" to trigger the build manually or push a change to your GitHub repository to trigger automatically via WebHooks.

Conclusion

Congratulations! You've successfully set up a complete CI/CD pipeline for your Node.js application using Jenkins and Docker Compose. This project showcases your ability to automate and streamline the development workflow, a valuable skill in any DevOps toolkit. Be sure to add this to your resume and share your success with the community.

Stay tuned for more exciting tasks as we continue our #90DaysOfDevOps journey. Keep pushing your limits and happy coding! ๐ŸŒŸ

More from this blog

Gunjan's blog

34 posts