Complete Jenkins CI/CD Project - Continued with Documentation (04) : Day - 42
Table of contents
I can imagine catching up will be tough so take a small breather today and complete the Jenkins CI/CD project from Day 24 and add documentation.
Task-01: Freestyle CI/CD Jenkins project with GitHub Webhooks: 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 Jenkins
ii) Install Java
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 requirement.
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 mentioned port in the inbound rules of the EC2 instance.
Make sure mentioned port is free, and not used by other applications.
If you encounter other errors, Google it and try to understand what mistake have you done also don't hesitate to ask with TWS community.
Thank you for reading. Happy Learning !!!๐
Stay tuned for more DevOps articles and follow me on Hashnode and connect on LinkedIn (linkedin.com/in/namratakumari04 for the latest updates and discussions.