Day24 of #90DaysOfDevOps Challenge

Day24 of #90DaysOfDevOps Challenge

??Project:

Containerise and deploy a node.js application using Jenkins Job.

??Step 1

Fork the repo - https://github.com/Aishwarya-Portfolio/node-todo-cicd

??Step 2

Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration.

We can use SSH keys or PAT tokens to integrate the GitHub repo into Jenkins.

Here I am using SSH keys.

  1. Generate SSH key pair in your Jenkins instance.

ssh-keygen        

I already have the key pair.

No alt text provided for this image

2. Create a new SSH key in GitHub and save the public key of Jenkins Instance.

No alt text provided for this image
No alt text provided for this image

3. Save the Private key in Jenkins credential.

No alt text provided for this image
No alt text provided for this image

4. Create a new Freestyle Jenkins Job -

No alt text provided for this image


5. Add source code GitHub Repo with added credential -

No alt text provided for this image

6. Now run the pipeline to check if the source code is checked out through Jenkins -

No alt text provided for this image

The repo files are present in Jenkins Workspace -

No alt text provided for this image

7. Now we need to set up a webhook for an automatic trigger from GitHub.

-- Install the GitHub integration plugin in Jenkins.

No alt text provided for this image

-- Create a Webhook.

The payload URL should be in the below format

https://jenkins_URL/github-webhook/        
No alt text provided for this image

8. Do not forget to open port 8080 to Anywhere so that the GitHub webhook can reach Jenkins on port 8080.

The green tick shows that the connection is established.

No alt text provided for this image

9. In your Jenkins Job, enable GitHub Hook to trigger in the build trigger section.

No alt text provided for this image


10. To test the webhook, make some changes to the code and commit it.

Check if the Job was triggered by a push event.

No alt text provided for this image

??Step 3

In the Execute shell run the application using Docker compose.

  1. Create a Dockerfile to install all the dependencies and containerize the application.

No alt text provided for this image

2. Add a build step - Execute shell to build the docker image.

No alt text provided for this image

3. Docker image is created successfully.

No alt text provided for this image
No alt text provided for this image

4. Create a docker-compose file to run the container using this image.

No alt text provided for this image

5. Add the docker-compose up command to run the container.

No alt text provided for this image

6. The build is successful.

No alt text provided for this image

7. The container is up and running.

No alt text provided for this image

8. Since I want to run the application on Port 8100, I made changes in the app.js file.

No alt text provided for this image

9. Now my application is running.

No alt text provided for this image

Thank You for Reading! ??




要查看或添加评论,请登录

Aishwarya keshri的更多文章

  • Day26 of #90DaysOfDevOps Challenge

    Day26 of #90DaysOfDevOps Challenge

    Jenkins Pipeline: Jenkins Pipeline is a suite of plugins that supports implementing and integrating continuous delivery…

  • Day23 of #90DaysOfDevOps Challenge

    Day23 of #90DaysOfDevOps Challenge

    CI/CD Continuous integration and continuous delivery help in automating the software development lifecycle stages…

    2 条评论
  • Day22 of #90DaysOfDevOps Challenge

    Day22 of #90DaysOfDevOps Challenge

    ??Jenkins Jenkins is an open-source tool that helps in creating pipelines and automating the software development…

  • Day21 of #90DaysOfDevOps Challenge

    Day21 of #90DaysOfDevOps Challenge

    Important interview questions and Answers for Docker: 1. What is the difference between an Image, Container and Engine?…

  • Day20 of #90DaysOfDevOps Challenge

    Day20 of #90DaysOfDevOps Challenge

    Docker Cheat Sheet: ??Docker images- Show all locally stored top-level images: docker images Pull an image from a…

  • Day 19 of #90DaysOfDevOps Challenge

    Day 19 of #90DaysOfDevOps Challenge

    Docker Volumes When we are working on docker, the data we store gets lost when the container is destroyed. So, to…

    2 条评论
  • Day 18 of #90DaysOf DevOps Challenge

    Day 18 of #90DaysOf DevOps Challenge

    ?Docker Compose Using docker commands, we can only run and manage a single container at a time, but there can be…

  • Day17 of #90DaysOfDevOps Challenge

    Day17 of #90DaysOfDevOps Challenge

    Dockerfile: Instead of manually creating docker images by running multiple commands one by one, we can write a script…

    1 条评论
  • Day 16 of #90DaysOfDevOps Challenge

    Day 16 of #90DaysOfDevOps Challenge

    ?Docker: Docker is a containerization tool that helps us create a lightweight container with all the required packages…

  • Day15 of #90DaysOfDevOps Challenge

    Day15 of #90DaysOfDevOps Challenge

    ?Python Libraries: The collection of modules used in Python while writing different programs is known as libraries…

社区洞察

其他会员也浏览了