DevOps Classroom Series – 27/Sept/2020

Jenkins Administrative Activies

  • Install the following Plugins

    • Dashboard View
    • Monitoring
    • Audit Trail
    • Disk-Usage Plugin
    • Backup plugin
  • Backing up and restoring Jenkins:

    • After Installing plugins. Navigate to Manage Jenkins and search for backup plugins Preview Preview Preview Preview Preview
    • Once the backups are taken then we get the restore options.
    • Also explore thin backup plugin
  • Managing disk usage

    • Navigate to Manage Jenkins and Navigate to Disk Usage Preview
    • Now Navigate to Manage Jenkins => Configure System Preview
    • Now Navigate to Jenkins Home & Select Disk Usage Preview
    • Navigate to any project where you have build the jenkins job Preview
  • Preparing Jenkins for Shutdown

    • Navigate to Manage Jenkins Preview
  • Monitoring of Jenkins Master Preview Preview

  • Configuring email notifications:

  • Jenkins needs to be used from cli by writing commands, For this we have two options

    • Jenkins CLI Preview Preview
    • Call Jenkins Rest API using curl command
      • In the Jenkins footer we have a link to jenkins REST API
      • Refer Here for jenkins remote api docs Preview Preview
  • User Management in Jenkins:

    • Jenkins Provides the following options for configuring users (Authentication)
      • Jenkins Database (Allow Signup)
      • Jenkins & OpenLDAP Integration
      • Jenkins & Active Directory Intergation Preview
    • Configuring Authorization using Matrix Based Security Preview
    • Let change authorization to Matrix Based security Preview

Scenario: Learning Thoughts Jenkins Configuration

  • Learning Thoughts has 3 Business Units
    • HRMS:
      • Hosted on Ubuntu Linux
      • Developed in Java
    • HMS
      • Hosted on RedHat Enterprise Linux
      • Has Java, Python & Node Js as this project is result of multiple acquistions
    • LMS
      • Hosted on Windows Server
      • Developed in .net
  • As a DevOps Engineer of Learning Thoughts, Don is supposed to build, provide all environments and deploy all the applications to production when needed
  • As of Now Learning Thoughts Wants to use the Jenkins for CI/CD pipelines.
  • How can Don manage this?
    • Manage Different Jenkins Masters
      • Jenkins Master for HRMS
      • Jenkins Master for HMS
      • Jenkins Master for LMS
      • But this is already sounding like a stupid approach.
    • To Solve these kind of problems Jenkins supports Distributed Builds.
  • Distributed Build Terms
    • Masters
    • Node
    • Agents
    • Executors
    • Labels Preview Preview
  • Jenkins is collection of Nodes. Each Node represents a Physical or a virtual machine. Nodes are of two types
    • Master
    • Agent
  • Master to Agent communication can happen via
    • SSH: Configure Linux, Mac & Unix Nodes
    • JNLP: Configure Windows Nodes.
  • On Every Agent we would have a Remote Working Directory

Lets Create a Jenkins Distribute Build Environment for Learning Thoughts

  • Our setup would be

    • Jenkins Master:
      • Ubunutu 20 Machine (AWS)
      • Executor: 1
      • Labels: Master
      • Software:
        • Java
        • Git
    • Jenkins HRMS QA Node
      • Ubunutu 18 Machine (AWS)
      • Software Set:
        • Git
        • JAVA 8
        • MAVEN 3.6.3
      • Labels:
        • HRMS
        • QA
      • Executors: 2
      • Project: Gameoflife
  • Master Configuration:

    • Install Jenkins
    • Navigate to manage jenkins Preview Preview Preview
  • Jenkins HRMS QA Node configuration

    • Login into the machine and create a new user called as jenkins (In your org you might be using service accounts)
    sudo -i
    adduser jenkins
    vi /etc/ssh/sshd_config
    # change PasswordAuthentication from No to yes
    service sshd restart
    # add sudo previleges with NOPASSWD if required
    
    • Install Java
    • Install Maven
  • Now lets configure this node as agent to jenkins master

    • Try logging in from jenkins user on master node to agent
    • Navigate to Manage Jenkins => Manage Nodes and add a new node Preview Preview Preview Preview Preview Preview
  • Lets create a build job for lthrmsqa Preview Preview

  • Now configure any java project to build, show test results and archive the artifacts

  • Now build the project & observe on which node & executor the project got scheduled Preview Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin