Building a Notes App CI/CD Pipeline: Using GitHub, Docker Hub, and Jenkins

👋Hello I am Mohd Saif, passionate technology enthusiast currently pursuing a bachelor of Computer application degree.
🎓Education: I am currently pursuing a bachelor of Computer application degree with the focus on coding at Bareilly University my education journey has equipped me with strong foundation in Computer science and I am eager to apply my knowledge to real word challenges.
💡Passion for technology: I have always been deeply passionate about technology and I am particular drawn to devops with AWS.
🚀Skills: 🔹Linux 🔹Shell scripting 🔹Python 🔹Ansible 🔹Docker 🔹Kubernetes 🔹Jenkins CI/CD 🔹Maven 🔹Git and GitHub
✨Future goals: My goal is to facilitate seamless collaboration between development and operations teams, ensuring faster releases and high-quality software. I am a proactive learner, constantly exploring new DevOps trends and practices
In this blog, we will walk through setting up a CI/CD pipeline for a Notes application. We'll leverage GitHub for version control, Jenkins for continuous integration and deployment automation, Docker and DockerHub for containerization, and VMware Workstation 17 for hosting our application.
Prerequisites
GitHub Account: Ensure you have a GitHub account and repository set up for your Notes application.
Jenkins: Install Jenkins on your local machine or server.
Docker: Install Docker on your local machine or server.
DockerHub Account: Create a DockerHub account for storing your Docker images.
VMware Workstation 17: Ensure you have an account on VMware workstation or EC2 instance with access the terminal.
Step 1: Setting up GitHub Repository
Create a Repository: Go to GitHub and create a new repository for your Notes application.

I have already created this repository.
Push Your Code: Clone your repository locally and push your Notes application code to the repository.
a) I cloned the project and entered the project directory using the
cdcommand. Then, I used the commandsgit add .andgit commit -m "your message".
b) I set the URL with the repository URL using the
git remote set-urlcommand and pushed my project to the GitHub repository using thegit push origin maincommand.
c) Now, everyone can see this repository where I pushed my project to GitHub.

Step 2: Configuring Jenkins
Install Jenkins Plugins: Ensure you have the necessary Jenkins plugins installed: GitHub Integration, Docker, and Pipeline.

I have already installed all the necessary plugins, so I don't need any additional plugins.
Create a New Job: In Jenkins, create a new Pipeline job.

General: Now, let's add a description. Check the GitHub project option and enter the project URL.


Build Triggers: Now, go to the build triggers option and check the GitHub hook trigger for GITscm polling.

Pipeline: Now, choose Pipeline Script

When writing the pipeline script, we need a Docker Hub account for pushing the image and credentials. Now, let's configure the credentials and Docker Hub account.
Step 3:Setting Up Docker Hub and Configuring Jenkins Credentials
To proceed, we need to set up a Docker Hub account and configure the Jenkins credentials.
Open a Docker Hub account or create an account:

I already have a Docker Hub account, so I don't need to create another one.
Now, go to Manage Jenkins and configure the credentials using your Docker Hub account:


Click on "System" and select "Add Credentials," then create a credentials ID.

Now, add the Docker Hub username and password along with a credentials ID, just like I did with dockerHub, and then save the credentials.
Step 4: Now, go to the VMware terminal
Login to Docker Hub: Log in to Docker Hub using the VMware Workstation terminal with the
docker logincommand.
Step 5: Now, return to our Jenkins notes-app project
Pipeline: Now, I need to add the credentials to the pipeline script I created.
now apply and save this pipeline

Now, apply and save this pipeline.
Now build the pipeline :

See everyone, we have successfully built our pipeline.
Push and run the project: Now, we are going back to the pipeline script to add a few commands:
sh "docker tag my-note-app ${env.dockerHubUser}/my-note-app:latest"andsh "docker push ${env.dockerHubUser}/my-note-app:latest".
Now, apply and save the pipeline.
Next, click "Build Now":

My pipeline script successfully runs on port number 8000.
Now, let's run our notes application using the IP address and port 8000.

See everyone, it's ready for work. We successfully built, deployed, and ran our notes application.
Summary
In this blog, we have set up a complete CI/CD pipeline for a Notes application using GitHub, Jenkins, Docker, DockerHub, and VMware workstation. By following these steps, you can automate the process of building, testing, and deploying your applications seamlessly.
