Node.js Deployment and APM with IBM StrongLoop on IBM Bluemix containers

It sure is exciting when you get your very first Node.js application up and running on your machine. It is so simple to install Node and then run it from a commend line with a JavaScript file as a parameter. At some point though you need to host your application where it will be publicly accessible. It is at that point that you realize you don’t have a clue about what this involves.

You have the following questions running through your mind:

How will I deploy my application?
What host environment is best for my needs?
How much will cloud hosting cost me each month?
How do I do CI/CD and Application Performance Management?
Will I be able to achieve the qualities my enterprise requires?

This post will get you started thinking about what you are up against and introduce you to some of the concepts involved in deploying and managing a Node.js application.

Most of my blog posts either focus on Microsoft Azure or on Amazon AWS to illustrate concepts. This post will be a departure from that. I have chosen to feature some IBM technologies because they really capture the overall process I am explaining here. I believe IBM really has something unique in its offering that makes Node.js hosting a more complete PaaS experience.

Some deployment and scaling options

Let’s first compare a few options you might want to know about from IBM, Microsoft Azure and AWS. First off, all three companies allow you to spin up Virtual Machines or employ a container technology such as Docker. This allows you to completely manage everything down to the minutest details and install whatever you like. You could do the work to configure them with Node, add something like PM2 and Nginx, and be up and running with vertical and horizontal scaling. This obviously requires a lot of ongoing work on your part.

The next step up in offloading the infrastructure management work would be to spin up Web servers on one of these three platforms through Elastic Beanstalk, Web Application or Cloud Foundry. With that, you get some built in configurations that allow you to deployed Node.js applications and you can even take advantage of other cooperating platform capabilities for scaling (Azure traffic manager, AWS Route 53 etc.)

If you take this one step further, you can realize a more complete PaaS solution that not only manages your Web Servers or Containers but in addition offers full APM. Here is the visualization of this progression:


Now what?

Let’s talk more about this last option mentioned above. You may have deployed an application using the middle option of a PaaS managed Web Server, but this is where you hit a snag. The snag is that you don’t have a complete end to end integrated management solution that is truly focused on Node.js development. This means for example, you have to use separate tools such as CloudWatch or Application insights for monitoring. But that is just the one part of the problem. Your complete development flow requires further steps such as – build, deploy, scale and debug. You need to be able to debug, profile and do tracing of your Node application.

You would end up piecing together a patchwork of tools and be constantly switching back and forth to each of them. The business opportunity here is for one of the hosting providers to offer a single tool that integrates a full suite of capabilities for you. This is exactly the path that IBM is on with its StrongLoop offering. Take note that is in the process of being rebranded as IBM API Connect.

IBM StrongLoop to the rescue

IBM has a great tool you can install that addresses all of the operational needs we just mentioned and more. You install it on a machine of yours. Perhaps IBM will someday offer this tool as a SaaS offering that you sign up for that they host and you can subscribe to on a monthly basis.

StrongLoop will actually start you out if you like with the code creation of a Node.JS application and lead you all the way through operational management of that application. I won’t be covering all aspects of the tool here, but will focus on some of the parts that deal with what happens once you have your application code ready to host and manage.

Here is a simple diagram that illustrates the overall concepts of the management of your Node.js Application. You can see that we have our code deployed in a Docker container in IBM Bluemix. That container comes with everything you need, including the Node.js executable as well as something called strong-pm. Strong-pm is the agent that runs on each managed machine/container that your Node application is on. This is the agent that the StrongLoop application will connect up to for doing deployments and APM. You can use it in a browser UI or through a command-line interface. Here is the diagram of how it all fits together:


The diagram shows that there can be multiple managed Bluemix Containers being managed at once. The strong-pm agent also keeps your Node.js processes and clusters running and automatically restarts them if they were to crash.

Trying it out

I will now give a brief walkthrough of the steps you would go through to try this out. You will need get an IBM Bluemix account to try this yourself. Once you log in, create a container by clicking START CONTAINERS.


From there you can select the one labeled ibm-strong-node-pm. You will be asked for an identifying name. Then, make the selection to have a public IP address available. You can create two containers if you like and give each a publicly accessible IP address.

Now, you need to install the stongloop application on your local machine. You do that as follows through a command prompt:

npm install -g strongloop

I am assuming you have a Node.js application of your own already to go. If not, you can explore how to use StrongLoop to create one for you and manage the Rest API and backing data. Change directories to be in the directory where you node.js project is and run the command that will open the StrongLoop Arc console in a browser as follows:

slc arc

This second command is what you will continue to use to open up the Arc portal. The UI will now be brought up and look as follows:


The Composer tool is greyed out for me because I have provided my own Node.js application that does not follow the convention that StrongLoop requires (i.e. use of loopback).

Click Process Manager and you will be able to set up a connection to the IBM Bluematrix container you already created. Click Add PM Host and type in the public IP address of the Bluemix container and then set the port to 8701. This is the port that the strong-pm agent is listening on that StrongLoop communicates through. This is what the screen looks like after you have added it:


Now you are ready to build and deploy your Node.js application. Select from the drop down menu Build & Deploy. There are two things to take note of here to be sure you do first. Make sure you Node.js application is listening on port 3001. This is because this is one of the ports you are allowed to use through the Bluemix container configuration. The other thing I personally ran into was that I had been making use of the v8-profiler in my code. I had to remove the following line from my package.json file – “v8-profiler”: “^5.5.0”.

Press the Build button and an npm install gets run and then a compressed tgz file is produced that can be used for the deployment. When the build is done, click on the tgz file. Make sure in the deploy area of the UI, it shows up under where it says “fully qualified path to archive”. Make sure your correct Hostname is selected in that drop down. Click the Deploy button and once that completes you can open your application such as “<your public IP address>:3001”. You can also deploy from Git and accomplish versioned deployment and rollback. Here is what that UI looks like:


Now, if you go back to the Process Manager UI you can do things like scale up the number of cluster processes you are running, or add in a load balancer across your containers. Here is my application up and running and ready for APM:


Here is where you can try out some of the other selections in the drop down menu like tracing or profiling. If you were to select Metrics, you could then look at CPU, Heap, Loop Count, Loop, HTTP Count, HTTP and DB Counter. There may some day be a node module that can be used internal to your Node.js code that would send custom metric data back to be reported on. I saw reference to something called a “Metrics API”, but could not find anything official yet.


The APM you get here is not comparable to a SaaS offering such as that of Atlassian Bamboo. Bamboo is a continuously running app that will be collecting telemetry and firing alerts on threshold violations even while you don’t have the console open. Bamboo keeps a database of metrics data that you use at any time to go back and view the events, logs and metrics of the APM monitoring of your Node.js application. Strongloop is only actively listening when you have it opened and does not support alerting. Perhaps this will also be something that IBM would address if they turn this into a full SaaS offering. In the meantime, you can push the metrics out to be viewed by third party consoles such as DataDog, Graphite or Splunk.


StrongLoop is a great tool that will only get better over time. With it you can be more productive because you have a full lineup of tools that are all integrated into a single UI. This allows you to build, deploy, scale, monitor and debug.

About Bushman

Living a purposeful life.
This entry was posted in Uncategorized and tagged , , , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s