re you at the Jenkins conference this week? We’re excited to be there as a sponsor and meet many of you who work on continuous deployments (CD). Our goal is to help you achieve CD without writing scripts or doing manual grunt work. To that end, we want to showcase full CD automation for your use-cases using Jenkins and Cloud Application Manager. A simple Todo Node.js application tutorial demonstrates the CD automation in this post.
After this demo, you may want to check out other Cloud Application Manager videos we have on our Getting Started page.
Let’s quickly review some basics. Cloud Application Manager, as you may know, enables self-service deployments. It’s where DevOps define app automation as microservices so that developers and QA can self-service deployments in development, staging, and production on any cloud. For end-to-end CI/CD, Cloud Application Manager integrates with Jenkins and your choice of SCM like GitHub. To get started, install Jenkins server with the Cloud Application Manager plugin from the free public box catalog.
Without further ado, let’s jump into the demo.
Node.js tutorial overview
I’m going to demonstrate the most challenging parts of continuous deployments for multi-tier applications. They are often the roadblocks to most continuous deployments in an enterprise:
Defining multi-tier app automation as reusable microservices. Without component level microservice automation, preserving change history and managing updates even on a small scale quickly becomes a macro nightmare.
Setting up hybrid cloud continuous deployments. Most of the time, plugins for a cloud service only support deployments to that particular cloud whereas you want the flexibility to deploy anywhere.
Automating continuous deployments. Continuous deployments are hard because of the level of complex automation involved at every stage. Automation doesn’t have to be so hard. It can be simple, and we show how.
Defining Multi-Tier App Automation as Reusable Microservices
To demonstrate full CD automation, I use Todo, a simple Node.js multi-tier app for managing tasks. It has three layers. Each layer is defined in Cloud Application Manager box automation as independent, reusable components.
Nginx load balancer Bastion. It forwards HTTP client traffic to the application and acts as a Bastion host to route traffic securely from the outside. This box can launch Nginx to any cloud on a Linux machine. It configures Nginx to listen on port 80 and then forward requests to the app instances in a load balancing pool.
Todo task application built on top of Node.js. This box first installs Node.js, then installs the Todo app from a Git repo, and finally links the app to a MongoDB database through a binding. It’s the binding that helps generate a connection string to be able to connect to the database.
MongoDB as the database. This box pulls MongoDB from Git, then installs and configures it using Puppet.
Setting up Hybrid Cloud Continuous Deployments with Jenkins and Cloud Application Manager
To setup a hybrid cloud deployment that ties together all the components of the multi-tier Node.js application, I rely on two things: Jenkins integration with Cloud Application Manager plus bindings. Let’s go ahead and set up the continuous deployment flow.
In Jenkins, I first add my Cloud Application Manager account with an authentication token.
Next, I create a Jenkins job to deploy in production a particular sequence of steps. Each step deploys a layer of our multi-tier application stack. In the Jenkins job, Cloud Application Manager build steps let me pull up any box automation from my account.
Step 1: Launch the MongoDB Server
A deploy build step in the Cloud Application Manager plugin allows me to select the MongoDB box. Here I tag the instance mongodb-production because it’s the glue that will let me bind to other components later. I also select a deployment policy that lets me deploy the database more securely in a vSphere private datacenter, a scenario that a lot of enterprises desire.
Step 2: Launch the Todo Node.js Application
Again, I use the deploy Cloud Application Manager plugin build step in Jenkins to set up the Node.js app launch. Here also I use tags (todoapp, production) for binding purposes. And I bind to the database by simply entering the mongodb-production tag from the previous step. Because this is a hybrid cloud deployment, I will host the Node.js app on AWS. Accordingly, I select an AWS deployment policy.
Next, I repeat this same setup for another Node.js application instance so that I can load balance between the two to handle all client requests.
Step 3: Launch the Nginx Bastion Load Balancer
Finally, I ask Jenkins to deploy the Nginx Bastion load balancer from the box. And I bind it to the Todo Node.js application instances tagged todoapp and production from the previous build step. When an instance matching the tags launches from my Cloud Application Manager workspace, it gets added to the load balancing pool. Remember how we configured the Nginx box to load balance Todo instances?
Since I’m going to launch the Nginx Bastion in AWS, I select the same AWS deployment policy.
As you can see, in just a few minutes I was able to set up the full continuous deployment of a simple Node.js multi-tier application using Jenkins plus Cloud Application Manager.
Automating Continuous Deployments
Of course to make all this magic happen, I used some box automation help:
- IT Ops made it easy for me not to worry about all the murky infrastructure details or instance types, storage, VPCs, and networking. They simply enabled the clouds for my Cloud Application Manager account, carved out AWS and vSphere infrastructure resources through the deployment policy boxes, and shared them with me.
- Secondly, we saw that binding tags associate components together; however we still need to leverage connection data from a binding to establish connectivity. Here again, my IT Ops configured bindings in the box definition.
See Continuous Deployment in Action
At last, it’s time to deploy! Watch the entire deployment and get a peek at the box setup. It only takes me one click to kick off the entire deployment end to end. And voila, I have an Nginx Bastion load balancing two Node.js Todo app instances both pointing to the same MongoDB instance.
What’s next? Did you try out the Node.js tutorial? Tell us what you think. It’s easy to extend this same flow to any of your large-scale application deployments. We’re excited to see what we can help you deploy next!
Want to Learn More About Cloud Application Manager and ElasticKube?
Cloud Application Manager is a powerful, scalable platform for deploying applications into production across any cloud infrastructure – private, public or hosted. It provides interactive visualization to automate application provisioning, including configuration, deployment, scaling, updating and migration of applications in real-time. Offering two approaches to cloud orchestration — Cloud Application Manager and ElasticKube — enterprise IT and developers alike can benefit from multi-cloud flexibility.
Visit the Cloud Application Manager product page to learn more.