Hey there, DevOps enthusiasts! Today's mission is to create a seamless CI/CD pipeline for your Node.js application using Jenkins. It's time to blend your Docker and Docker Compose expertise into a live project. Excited? Let's dive in and make it happen! ๐๐ป
Task-01: Setting Up GitHub Integration ๐ ๏ธ
Step 1: Fork the Repository
Start by forking the repository: https://github.com/davender-singh1/node-todo-cicd
This will create a copy of the project in your GitHub account.
Step 2: Connect Jenkins to Your GitHub Repository
Navigate to your Jenkins dashboard.
Go to "Manage Jenkins" > "Manage Plugins" and install the "GitHub Integration" plugin.
Once installed, go to "Manage Jenkins" > "Configure System" and scroll down to the "GitHub" section.
Add your GitHub credentials and save the configuration.
Next, create a new Jenkins job for your CI/CD pipeline and link it to your GitHub repository using the GitHub integration.
Step 3: Configure GitHub Webhooks
In your GitHub repository settings, navigate to "Webhooks" and add a new webhook.
Set the payload URL to your Jenkins server URL followed by
/github-webhook/
.Make sure the content type is set to
application/json
.Save the webhook configuration.
Task-02: Runningthe Application with Docker Compose ๐ณ
Step 1: Create a Docker Compose File
Create a
docker-compose.yml
file in your project directory.Define services for your Node.js application, specifying the Docker image, ports, environment variables, etc.
Step 2: Configure Jenkins Job
In your Jenkins job configuration, add a build step to execute a shell command.
Write a shell script to run the application using Docker Compose.
Step 3: Run the Project
Trigger the Jenkins job to run the CI/CD pipeline.
Once the pipeline completes successfully, access your Node.js application in the browser using the specified port.
Treat yourself to the sight of your beautifully deployed application! ๐
Task-03: To verify the webhook functionality, we'll modify our code in the GitHub repository and observe how it automatically triggers our pipeline.
The pipeline ran smoothly in Jenkins without needing any manual input.
Changes were accurately reflected.
The successful execution of this task boosts our confidence in deploying complete projects using Jenkins pipelines.
There you have it โ a fully functional CI/CD pipeline for your Node.js application using Jenkins and Docker Compose. Enjoy the fruits of your labor and keep innovating! ๐ #Jenkins #CI/CD #DevOps #TechJourney #DockerMagic โจ
You can connect with me at: https://www.linkedin.com/in/davendersingh/