# Jenkins Project

Hello Readers its my #day28 blog of #90daysofdevops

Today's Topic

✅Jenkins Master Server

✅ Jenkins Agents

✅ Deploy the web app using Jenkins master and worker node

### **Jenkins Master Server**

The main Jenkins Server is the Master Server of Jenkins. This acts as a control server that arranges the defined workflow of the pipeline. The jobs of this Master are as follows:

* scheduling jobs
    
* sending builds to slaves to execute the job
    
* keeping track of the slave's states (online/offline)
    
* can also directly execute build jobs
    
    Slave- The slave is a part of the Jenkins environment that runs in a remote environment. The characteristics of slaves include:
    
    it listens to the Master instance
    
* its job is to do as they are told to, which includes executing build jobs conveyed by the Master
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684760686684/4f292543-dd73-429a-9c69-298b72b3006e.png align="center")
    

### **Jenkins Project**

Project Overview-

**Project - Depoly the web app using Jenkins master and worker node**

GitHub Repository- [https://github.com/shreyakhangan/node-todo-cicd.git](https://github.com/shreyakhangan/node-todo-cicd.git)

1\. Create an EC2 instance

Jenkins\_Agent

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684771661920/e2ed28c4-a7c6-40fb-adc0-2930823fba6b.png align="center")

Jenkins\_server

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684771814751/8c80e392-d05e-40b8-877d-ca2b53316ed6.png align="center")

1. We need to install the Java and docker in both the master and agents also
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684772971712/b40c83e5-b993-4f64-8c64-4e168154a6c9.png align="center")

1. We need to generate the keys in the master Server
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684827779949/396babce-ded8-49a0-aad5-659feb2729c2.png align="center")
    
    1. Now we need to go to .ssh directory we will see the public and private keys.
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684827920484/f2c560c2-7460-4e72-b8fe-613d7b88adff.png align="center")
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684828153562/26f10286-83d6-42db-bfea-fa6ffc32d708.png align="center")
        
    2. Now we need to add the Public keys from Jenkins-Server to Jenkins- agent
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684828296114/3c90601e-2532-4c05-ba85-2f9bb959135e.png align="center")
        

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684828401824/26f1a1e3-cdad-4bc4-8de3-d86801158ade.png align="center")

5\. Now we need to go Jenkins Dashboard --&gt;Manage Jenkins---&gt;Manage Nodes and Clouds---&gt;Click on New Node

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684829578103/98d6169f-7b54-44b0-8411-ece804f09749.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684829793647/b75e1432-34cd-4707-9a56-d8fde025e4ea.png align="center")

Let's understand a few terms:-

Number of executors-Number of CPU.

Remote Root Directory-Its is the Workspace for the Jenkins

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684830764336/d0b05b5e-f067-4ed3-98cc-abcdf570cf6e.png align="center")

We need to pass the Instance IP address into Host.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684831389177/566c66e5-5afc-44d5-9422-1cf5c43a0e3f.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684831491008/1492df0a-0dab-4145-b4e7-c159123fcd58.png align="center")

Non-Verifying Verification Strategy is used when we tried to ssh between public and private keys.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684832529648/d226a7f7-6dfe-4f81-95ec-2139226b1366.png align="center")

**Task-02-**

Run your previous NodeJS on the new agent.

We need to build a new Pipeline

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684842512816/8350215e-f0a3-42cc-ae31-eb124ab68031.png align="center")

1. • Create a new pipeline
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684842632069/18770b4c-5f61-4578-b5e1-78ab5b1d5294.png align="center")
    
    1. • Needs to add the details
        
        GitHub Project Link-[https://github.com/shreyakhangan/node-todo-cicd](https://github.com/shreyakhangan/node-todo-cicd)
        
        ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684842702185/5c3901d6-0e4a-4e8c-87d7-18e04cd24dc4.png align="center")
        
        • Needs to add Pipeline Code
        

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684842886468/2785da28-afa3-452e-9c4d-8c1e3e74345d.png align="center")

1. • Save and try to Build the Pipeline
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684842342483/309b8935-658f-445a-8f9c-e2eda4126649.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684842412835/44ff1b9f-11ef-4ef0-b24f-9332a5b31f85.png align="center")

• To access the todo app agent IP address followed by the port.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684843458846/aa2509aa-1707-4be5-9a87-b231c0559458.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684843704567/0d7152ee-ff73-4771-bccf-7abf8955943b.png align="center")

I appreciate you taking the time to read my blog, and I hope you found it informative. If you found the content useful, please consider giving it a like, sharing it with others, and following me for more similar posts in the future. Thank you for your support!

Linkedin Profile-[**https://**](https://www.linkedin.com/in/shreyakhangan/)[**linkedin.com/in/shreyakhangan**](http://linkedin.com/in/shreyakhangan)
