Understand Continuous Integration And Deployment With Jenkins –Life Cycle: Before You Regret

Deployment Should be…

  • Simple
  • Stable
  • Fast
  • Reliable & one click

Books

Continuous Integration and deployment with Jenkins – Life cycle:

1.Continuous integration

Continuous integration is the process of merging development works with the branch(code) several times in a day constantly. Most of the work here is done by automated.

2.Continuous delivery

Continuous delivery is the practice of delivery of code to an environment, whether it is a QA team, so they can review it. After the issues get resolved, they can deploy in production.

3.Continuous deployment

You can think of continuous deployment as the next step of continuous delivery, when each change that passes the automated tests are deployed to production. Continuous deployment relies on an infrastructure that automates and instruments the process of

> testing, integration and deployment of new features.

Most of the time testing and deployment steps do not change frequently and in order to keep the developer focus on writing code we do the automation of testing and deployment.

This automation is called continuous integration and deployment”.

Here the set up the continuous integration and deployment Application for Node.js project.

To do this I am going to use

a) Jenkins as the CI automation tool and

b) Github as source code management system.

Life cycle to work

Here is the complete flow of the system.

  • Install Jenkins and configure
  • Adding Github webhook to push events to Jenkins
  • You made some changes in your project.
  • You push those changes in Github on master or any branch.
  • Github will notify Jenkins about the new push. ( We have to configure with jenkins & Git )
  • Jenkins will then run the commands you ask it to run.

Those commands will contain following.

  • Test script.
  • Deployment script.

Deployment script will be added to Project only and Jenkins will use that to communicate to Server by ssh and perform the push.

Basically, what you do manually such as running test command, login to Server, performing Git pull and then restarting build server, Jenkins will do all of them automatically by writing the script.

Best Mobile’s Seller

1. Installing Jenkins Workflow

To install and configure please read the previous post.

2. Install Plugins

We have installed Jenkins, let’s add Github plugin in Jenkins in order to integrate the project.

Adding Github and NodeJs, Public Ssh etc as per project requiremnet plugin in Jenkins

Open Jenkins serevr in browser and click on “Manage Jenkins” and then click on “Manage Plugins”.

Click on “Install without restart” and in few seconds plugin will be installed.

3. Configuring project with Jenkins

To configure project/job with jenkins there are 6 steps have to follow see here below

a) General

Click on “New Item” and fill in the proper project name. Choose “Freestyle project” among the options.

b) Source Code Management (SCM)

Check Github project and add the Github project link. Under “Source Code Management” select Git and add the Repository URL with .git extension.

You can choose which branches you want to cover up in the deployment process or leave it blank for any branch. And add the credential of this repository.

c) Build Triggers

Under “Build Trigger” section select Build when a change is pushed to GitHub option. This is very important.

d) Build Environment

e) Build

Under “Build” section, Click on “Add build step” button and then click “Execute shell” option.

In that for instance type npm install and then click on Save. We can write a script to make a tar file of build.

f) Post Build Action (Configuring deployment process)

We have Github communicating to Jenkins, it’s time to perform the deployment to our Server. One thing, Jenkins will not directly communicate to your web server.

So let’s first list down the steps we manually perform to do the deployment to any Server.

  • Login to Server using SSH (Install Public over ssh plugin and configure Serevr with there Public key or Key.pem file to access without password).
  • Switching to project directory.
  • Extract the tar file(Artifacts which is build from the jenkins as above discussed) .
  • Restarting process manager ( say pm2 ).

We will write down all of these commands in one file and tell Jenkins to execute it.

Under “Post Build Action” section select SSH Publisher, Now you will able to build your first job with Jenkins, Navigate in left side and click on build to run and see the log to press the console O/P. 

And from here the section of Notification to build status like Failure, stable and unstable.

Build#1: Succeed

@Thank you

Mivi Thunder Beats Wireless Bluetooth Earphones with Stereo Sound and Hands-free Mic (Gun Metal) INR 2,999.00
 

17 thoughts on “Understand Continuous Integration And Deployment With Jenkins –Life Cycle: Before You Regret

  1. shopping online says:

    I believe that is one of the such a lot important information for me. And i’m satisfied studying your article. But should remark on some normal things, The site style is wonderful, the articles is in point of fact great : D. Good process, cheers

    Like

  2. online business says:

    hey there and thank you for your information – I’ve definitely picked up something new from right here. I did however expertise several technical points using this web site, as I experienced to reload the website many times previous to I could get it to load properly. I had been wondering if your hosting is OK? Not that I am complaining, but sluggish loading instances times will very frequently affect your placement in google and can damage your high quality score if ads and marketing with Adwords. Well I’m adding this RSS to my e-mail and can look out for a lot more of your respective exciting content. Ensure that you update this again very soon.

    Like

  3. cancer says:

    Awesome blog! Is your theme custom made or did you download it from somewhere? A design like yours with a few simple tweeks would really make my blog stand out. Please let me know where you got your theme. Bless you

    Like

    • Gaurav Srivastava says:

      sure, you can download it from “WordPress” it is free you can download and customise as per your wish….

      Have good day… Thank you

      Like

Leave a comment