Freestyle CI/CD Jenkins project with GitHub Web hooks: A Comprehensive Guide
Document the process from cloning the repository to adding webhooks, Deployment, etc. as a README.
A well-written readme file will help others to understand your project and you will understand how to use the project again without any problems.
Introduction:
This guide is about configuring freestyle CI/CD Node JS projects with Jenkins using GitHub Webhooks. This README explains step-by-step instructions from cloning the repository to configuring webhooks and deployments, ensuring flawless and automated development work.
Pre-requisites:
Create an EC2 instance as Jenkins Server for this project and install the following applications over there:
i)Install Java
ii)Install Jenkins
iii) Install Docker and Docker Compose
Setting up Jenkins server:
With the help of Jenkins server IP address, log in to Jenkins through a web browser and access Jenkins Dashboard.
Create a new Jenkins job for your project:
Choose 'New Item' from the dashboard.
Provide a name for your job and select the appropriate project type according to your requirements.
Configure the source code management settings using Git.
Install necessary plugins to enable GitHub integration and Docker support, based on your project's requirements.
Configuring GitHub Webhooks:
Log in to your GitHub account repository, and navigate to repository 'Settings' > 'Webhooks'.
Click 'Add webhook':
Enter the Payload URL, which should be your Jenkins job's URL followed by '/gitHub-webhook/'.
Choose the content type as 'application/JSON'.
Select the events that should trigger the webhook (e.g., 'Push events').
Save the webhook configuration and refresh the page.
Deploy your code:
Configure your Jenkins job:
Specify the GitHub repository URL.
Set up build triggers to use the GitHub webhook.
Set up deployment steps in the Jenkins job:
Based on your project requirement, use Docker Compose, scripts, or other tools.
Ensure that the builds are triggered and deployed application successfully.
Whenever code changes are pushed to your GitHub repository, the webhook will trigger the Jenkins job automatically.
Troubleshooting:
Considering the pre-requisites of this project you may face the other following issues while deploying this Project:
Check Groovy syntax while writing the build script.
Open the mentioned port in the inbound rules of the EC2 instance.
Make sure the mentioned port is free, and not used by other applications.
If you encounter other errors, Google👨💻 it and try to understand👨🎓
Task-02
Also, it's important to keep smaller goals, as it's a small task, think of a small Goal you can accomplish.
Write about it using this template
Have small goals and strategies to achieve them, and also have a small reward for yourself.
Thank you for reading. Happy Learning !!!😊
Subscribe to my newsletter
Read articles from Suraj barik directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Suraj barik
Suraj barik
I'm Suraj Barik Aspiring DevOps Engineer with Hands-on experience in Automating,Shell Scripting, Supporting in AWS, management, CI/CD, and DevOps processes.