Project 3: Deploy web app using Jenkins master and worker node.

Table of contents

No heading

No headings in the article.

Here we will deploy a web app through Jenkins master to Jenkins worker node.

  1. Create EC2 instances as

· jenkins-server

· Jenkins-agent-1

No alt text provided for this image

No alt text provided for this image

  1. Generate SSH keys on “Jenkins-server” by running

“ssh-keygen”

  1. Now goto “.ssh” folder and there will be public and private key in Jenkins-server.

No alt text provided for this image

  1. Add public key from “Jenkins-server” to “Jenkins-agent-1” under location “.ssh/authorized_keys”

No alt text provided for this image

No alt text provided for this image

  1. Now, go to the Jenkins dashboard, and click on “Manage Jenkins”.

No alt text provided for this image

  1. Now, click on “Manage Nodes and Clouds”

  2. Now, click on “+ New Node”

No alt text provided for this image

  1. Add details of your second node, accordingly.

No alt text provided for this image

No alt text provided for this image

  1. Now click on “Ok”, and the node will be connected and online.

No alt text provided for this image

  1. Now, go to configurations in your task or project scheduled in Jenkins, and add the Label as same with the name of Node.

No alt text provided for this image

  1. Click on Save, and your project will be tied to Agent2.

No alt text provided for this image

  1. Now, build your project.

No alt text provided for this image

  1. Now, the web app will be up and running on “Jenkins-agent-1” and can be accessible via:

<ip of Jenkins agent:8001>

No alt text provided for this image