Showing posts with label Jenkins. Show all posts
Showing posts with label Jenkins. Show all posts

Tuesday, June 29, 2021

Jenkins Learning Task 10 - How to add Slave Nodes in Jenkins

How to add Slave Nodes/SSH build agents in Jenkins


1. Add Git server(mnode01) and App server(mnode02) as SSH build agent/slave nodes in Jenkins. The slave nodes name must be Git_mnode01, App_mnode02 respectively.

2. Add labels as below
    Git_mnode01: mnode01
    App_mnode02 : mnode02

3. Remote root directory for Git_mnode01  must be /home/kumar/jenkins and App_mnode02 must be /home/john/Jenkins 

4. Make sure slave nodes are online and working properly.

Pre-Requisite

* This Task based on the Learning LAB, which I have set up with 3 servers.
mnode01 is my git server, mnode02 is my app server and master is my Jenkins server.
* Should have ssh connection between servers.
* You might need to install some plugins and restart Jenkins service. 

Solution

Step 1: Install Java on all Node servers ( app, git servers)
Step 2: Install SSH build agent plugin in Jenkins,
Step 4: Setup the slave nodes in jenkins.


Verification:
    Refresh the nodes list. You should see the newly added nodes with the system statistics details.

Check below the sample solution video for the above task.


PLEASE SUPPORT ME BY
LIKE || SUBSCRIBE || COMMENTS  on MY YOUTUBE CHANNEL AND BLOG 

STAY TUNED FOR MORE VIDEOS.......

#Learn    #Practice    #Re-Learn    #Improve    #Motivate
#Continue-Learning    #Apply    #Get-Help    #Help-Others

Tuesday, June 22, 2021

Jenkins Learning Task 09 - Schedule a job in Jenkins

 Schedule a job in Jenkins


1. Create a Jenkins job named logs-copy.

2. Configure it to periodically build every 5 minutes to copy the Apache logs (both access_log and error_logs) from mnode02 (from default logs location) to location /data on mnode01 Server.

Note: * This is a learning task and you can try to do it in your own learning environment. I have done a sample solution using VirtualBox with Ubuntu OS.

Pre-Requisite

* This Task based on the LAB which I have set up with 3 servers.
mnode02 is my app server mnode01 is my git server and master is my jenkins server
* Should have ssh connection between servers.
* You might need to install some plugins and restart Jenkins service. 

Solution

Step 1: Enable password-less sudo in-app server and git server
Step 2: Enable password-less SCP 
Step 3: Install SSH Plugins in Jenkins
Step 4: Setup Credentials for SSH users
Step 5: Add SSH Hosts in Jenkins
Step 6: Create a Scheduled Build Job


Verification:
ssh to  mnode01  server and got to /data dir and check the logs are available.

Check below the sample solution video for the above task.




PLEASE SUPPORT ME BY
LIKE || SUBSCRIBE || COMMENTS  on MY YOUTUBE CHANNEL AND BLOG 

STAY TUNED FOR MORE VIDEOS.......

#Learn    #Practice    #Re-Learn    #Improve    #Motivate
#Continue-Learning    #Apply    #Get-Help    #Help-Others

Jenkins Learning Task 08 - Upstream and Downstream build jobs in Jenkins

 Upstream and Downstream build Jobs in Jenkins (chained build)

1. Create a Jenkins job named chain-app-deployment and configure it in a way that if anyone pushes any new change to the origin repository on master branch then the job should auto build and deploy the latest code on app server(mnode02) under /var/www/html directory. 

2. Create another Jenkins job named services and make it a downstream job for chain-app-deployment job. Things to take care about this job:
        a. This job should restart httpd service on all app servers.
        b. Trigger this job only if the upstream job i.e chain-app-deployment is stable.

3.create repo in gitea named chainweb and create an home.html file under it.

4. SSH into gitea Server(mnode01) using user credentials which you used to create the gitea repo (chainweb) mentioned above.  cloned Git repository chainweb. update home.html content to Welcome to my chain-app-deployement and then push the changes to the origin into master branch. This push must trigger your Jenkins job and the latest changes must be deployed.

===================================================

Note: * This is a learning task and you can try to do it in your own learning environment. I have done a sample solution using VirtualBox with Ubuntu OS.

Pre-Requisite

* This Task based on the LAB which I have set up with 3 servers, one for Jenkins, one for the App server and another one for Gitea.
* Should have ssh connection between servers.
* You might need to install some plugins and restart Jenkins service. 


Solution:
Step 1: Enable password-less sudo in App server.
Step 2: Install GiteaSSH, publish over SSH, authorization token root Plugins in Jenkins.
Step 3: add Gitea user with credentials in jenkins
Step 3: Add sudo users and their SSH credentials in Jenkins
Step 4: Add SSH Hosts in Jenkins
Step 5: Configure publish over SSH on jenkins
Step 6: Create the upstream build job.
Step 7: Create the downstream build job.
Step 8: Setup Gitea Webhooks
Step 9: Commit changes to home.html

Verification:

Check below the sample solution video for the above task.



PLEASE SUPPORT ME BY
LIKE || SUBSCRIBE || COMMENTS  on MY YOUTUBE CHANNEL AND BLOG 

STAY TUNED FOR MORE VIDEOS.......

#Learn    #Practice    #Re-Learn    #Improve    #Motivate
#Continue-Learning    #Apply    #Get-Help    #Help-Others

Wednesday, June 16, 2021

Jenkins Learning Task 07 - Install packages on remote server using Jenkins

 Install packages on remote server using Jenkins

1. Create a Jenkins job named httpd-php and configure it to accomplish below given tasks.

    a. Install httpd  and php-fpm and along with their dependencies on mnode01 App server.

    b. HTTPD should serve on port 8081 on mnode01  app server.

===================================================

Note: * This is a learning task and you can try to do it in your own learning environment. I have done a sample solution using VirtualBox with Ubuntu OS.

Pre-Requisite

* This Task based on the LAB which I have setup with 2 servers, one for Jenkins and one for the App server.
* Should have ssh connection between 2 servers.
* No slave node has been added under Jenkins so you can simply accomplish the task using SSH within your job config.
* You might need to install some plugins and restart Jenkins service. 

Solution:

Step 1: Enable password-less sudo in APP server 
Step 2: Install SSH Plugin in Jenkins
Step 3: Add sudo users and their SSH credentials in Jenkins
Step 4: Add SSH Hosts in Jenkins
Step 5: Create the build job.
Step 6: Run the build job

Verification:
check default apache2 webpage loading on port 8081.

check below the sample solution video for the above task.


PLEASE SUPPORT ME BY
LIKE || SUBSCRIBE || COMMENTS  on MY YOUTUBE CHANNEL AND BLOG 

STAY TUNED FOR MORE VIDEOS.......

#Learn    #Practice    #Re-Learn    #Improve    #Motivate
#Continue-Learning    #Apply    #Get-Help    #Help-Others

Monday, June 14, 2021

Jenkins Learning Task 06 - Folders in Jenkins

 Folders in Jenkins

1. Create two jobs httpd and services.

2. Create a new folder under Jenkins UI which should be named WebService.

3. Move the above-mentioned two jobs under WebService folder.

* This is a learning task and you can try to do it in your own learning environment. I have done a sample solution for this task on Ubuntu OS.

Solution:

check below the sample solution video for the above task.



PLEASE SUPPORT ME BY
LIKE || SUBSCRIBE || COMMENTS  on MY YOUTUBE CHANNEL AND BLOG 

STAY TUNED FOR MORE VIDEOS.......

#Learn    #Practice    #Re-Learn    #Improve    #Motivate
#Continue-Learning    #Apply    #Get-Help    #Help-Others

Friday, June 11, 2021

Jenkins Learning Task 05 - Configure Security Settings in Jenkins

 Configure Security Settings in jenkins

1. Create a Jenkins job named Packages. ( No worries about configuration now) 

2. Create users named kumar with password kumar@1234 and user raja with password raja@1234.

2. Grant permissions to these users to access Packages job as per details mentioned below:

    a.) Make sure to select Inherit permissions from parent ACL under inheritance strategy for granting permissions to these users.

    b.) Grant mentioned permissions to kumar user : build, configure and read.

    c.) Grant mentioned permissions to raja user : build, cancel, configure, read, update and tag.

Note:
Please do not modify/alter any other existing job configuration. If  Project-based Matrix Authorization Strategy not available then you need to install the below plugin.
Plugin Name: Matrix Authorization Strategy
You might need to install some plugins and restart Jenkins service.

* This is a learning task and you can try to do it in your own learning environment. I have done a sample solution for this task on Ubuntu OS.

Solution:

check below the sample solution video for the above task.



PLEASE SUPPORT ME BY
LIKE || SUBSCRIBE || COMMENTS  on MY YOUTUBE CHANNEL AND BLOG 

STAY TUNED FOR MORE VIDEOS.......

#Learn    #Practice    #Re-Learn    #Improve    #Motivate
    #Continue-Learning    #Apply    #Get-Help    #Help-Others


Jenkins Learning Task 04 -Create Views in Jenkins

 Create Views in Jenkins

1. Create a Jenkins job which should be named jenkins-pipeline-job.

2. Configure this job to run a simple bash command to echo Hello Jenkins!!.

3. Create a view named jenkins-crons (should be a List View) and make sure Jenkins-pipeline-job under this new view.

4. Schedule this newly create job to build periodically at every minute i.e '* * * * *' (please make sure to use the cron expression exactly the same how it is mentioned here)

5. Make sure the job builds successfully.

* This is a learning task and you can try to do it in your own learning environment. I have done a sample solution for this task on Ubuntu OS.

Solution:

check below the sample solution video for the above task.



PLEASE SUPPORT ME BY
LIKE || SUBSCRIBE || COMMENTS  on MY YOUTUBE CHANNEL AND BLOG 

STAY TUNED FOR MORE VIDEOS.......

#Learn    #Practice    #Re-Learn    #Improve    #Motivate
    #Continue-Learning    #Apply    #Get-Help    #Help-Others


Thursday, June 10, 2021

Jenkins Learning Task 03 - Create Users in Jenkins

Create Users in Jenkins

1. Make sure that job available from the previous task that we created a job called parameterized-job. IF NOT Create a new job called projet httpd-job under admin user.
( No worries about configuration, this task focus on users)

2. Create a jenkins user john with password Abc@Def and full name should be John (its case sensitive).

3. Using Project-based Matrix Authorization Strategy assign overall read permission to john user. Also, make sure john only has read permissions to the newly created job/already existing job (we are not worried about other permissions like Agent, SCM, etc.). 

4. login with the newly created user and see he has read-only access to the job.

Note:

You might need to install some plugins and restart Jenkins service.  If  Project-based Matrix Authorization Strategy not available under authorization then you need to install the below plugin.
Plugin Name: Matrix Authorization Strategy

* This is a learning task and you can try to do it in your own learning environment. I have done a sample solution for this task on Ubuntu OS.

Solution:

check below the sample solution video for the above task.


PLEASE SUPPORT ME BY
LIKE || SUBSCRIBE || COMMENTS  on MY YOUTUBE CHANNEL AND BLOG 

STAY TUNED FOR MORE VIDEOS.......

#Learn    #Practice    #Re-Learn    #Improve    #Motivate
    #Continue-Learning    #Apply    #Get-Help    #Help-Others

Wednesday, June 9, 2021

Jenkins Learning Task 02 - Parameterized build in Jenkins

Parameterized build in Jenkins

1. Create a parameterized job which should be named as parameterized-job.

2. Add a string parameter named Stage; its default value should be Build.

3. Add a choice parameter named env; its choices should be Development, Staging and Production.

4. Configure job to execute a shell command, which should echo both parameter values (you are passing in the job).

5. Build the Jenkins job at least once with choice parameter value Development.


* This is a learning task and you can try to do it in your own learning environment. I have done a sample solution for this task on Ubuntu OS.

Solution:

check below the sample solution video for the above task.



PLEASE SUPPORT ME BY
LIKE || SUBSCRIBE || COMMENTS  on MY YOUTUBE CHANNEL AND BLOG 

STAY TUNED FOR MORE VIDEOS.......

#Learn    #Practice    #Re-Learn    #Improve    #Motivate
    #Continue-Learning    #Apply    #Get-Help    #Help-Others

Docker Learning Task 02 - How to create a basic docker network

 How to create a basic docker network 1. Create a docker network named  mynetwork . 2. Configure it to use bridge drivers. 3. Set it to use ...