Deployment Should be…

  • Simple
  • Stable
  • Fast
  • Reliable & one click



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.


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.


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.


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.

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

Like what you read? Give Gaurav Srivastava a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.