Many customers are choosing the MEAN (Mongo, Express, Angular, and Node) stack as an efficient and powerful approach to building web applications. In this two-part blog, I’ll detail why and how to use Microsoft Azure to host a Linux-based MEAN stack, leveraging Azure’s enterprise features like high availability, scalability and fault tolerance to run web applications at hyperscale.

MEAN 101

Microsoft Azure is a great choice of platform for both the LAMP and MEAN stacks. Both LAMP (or LEMP, if you replace Apache with Nginx) and MEAN have their own strengths and certain situations demand one over the other.

mean
Figure 1: The MEAN stack

I won’t spend much time discussing the pros and cons of MEAN and LAMP. LAMP has been a traditional favorite for website developers for good reasons. However, what attract many to MEAN are:
Isomorphism of the ubiquitous JavaScript – it is easy, and it makes clients and servers look and feel the same. This also means that more can be accomplished by JavaScript experts – both front and back ends can potentially leverage a single pool of developers.
Simplified server management – Apache and Nginx are extremely powerful, but Node.js trumps them with simplicity and quicker learning curve. Because Node is event-based and asynchronous, it can also scale seamlessly with the right architecture.
MEAN is modern – MongoDB is built for the cloud. Its NoSQL structure, as opposed to the relational nature of MySQL, brings in native support for big data. Also, the MEAN framework (see figure 1) understands JSON from end to end, making it easier for a modern application to “talk” to other applications – especially in this mobile-first cloud-first world that we live in.

Node, Express and Angular on Azure – the IaaS approach

In part one of this two-part blog, I will focus on the “EAN” in the MEAN stack. Microsoft has done a lot of work to make Azure a great place for Node and Node-enabled frameworks like Express. This Node experience extends well beyond Azure’s Platform as a Service (PaaS) offering, which many of you may have heard about, to both Infrastructure as a Service (IaaS) and hybrid scenarios. We will focus on the IaaS experience today, and discuss what it takes to run the MEAN stack on Azure VMs that you are managing yourself.
While PaaS solutions like Web Apps may make sense for certain scenarios, IaaS makes its very easy to “lift and shift” existing code to the cloud with network, storage, compute and security constructs like Virtual Machines, data disks, virtual networks, firewalls, etc.
Microsoft Azure fully supports Linux IaaS deployments today – you can quickly spin up a Linux VM with a free trial. Not only can you stand up your entire Linux-based infrastructure on Azure, you can also automate deployment and installation by using a wide array of tools, ranging from fully POSIX compliant Azure CLI to third party tools like Terraform or Packer. Also, Azure PowerShell is now open sourceand runs on Linux and Mac, adding another great option for automation.
The IaaS approach on Azure can be incredibly powerful, especially given Microsoft’s support for hybrid scenarios, where customers have the choice and flexibility to move certain workloads to the cloud, while keeping others in their datacenters. Microsoft’s hybrid support spans both IaaS and PaaS, allowing customers to seamlessly connect their on-premises applications to managed services in the cloud.
Customers like mPharma (IaaS, automated prescription services) and zilyo (IaaS, vacation booking in Canada), and KPMG (PaaS, accounting services) have deployed MEAN on Azure with great results. Click on the full case studies to learn more.
Here is a summary of why customers are choosing Azure for their MEAN stacks (as well as resources to learn more and get started):
Enterprise website features: Microsoft Azure provides the perfect platform for running MEAN workloads because it is designed to host websites, web applications and mobile applications. Enterprise-grade features like scalability, high availability, fault tolerance, traffic management and routing, security and firewall appliances – all coupled with the massive global presence across continents – help website owners reach more consumers, replicate their data in real time, and spread their reach across wider regions with lower latency and improved user experience.
Easy for developers: The Microsoft Azure cloud makes it very easy for JavaScript and Node developers. I would redirect my developer friends to this excellent starting point for Node, Express and Angular on Azure hosted on Channel 9. It’s a series of videos created by my colleague Daniel Egan. Episodes 1, 5 and 8, in particular, walk through the setting up of an end-to-end development environment, as well as how to unleash the power of Node frameworks like Express on Azure. Additional resources:

  • A vast amount of resources for Node and MEAN development on Azure are available at the revamped Node.js Developer Center.
  • The Node SDK for Azure page on GitHub provides a Node.js package for consuming and managing Azure services and infrastructure components – this makes consuming Azure easy for node developers.

Hybrid solutions: As noted above, Microsoft’s hybrid cloud approach provides great power, choice and flexibility in phasing cloud deployments, especially if large transactional databases are involved. Microsoft’s hybrid support spans both IaaS and PaaS solutions, and it’s easy to connect services in the cloud to on-premises applications.
Pre-configured stacks in Azure Marketplace: The Azure Marketplace has many pre-configured Node.js stacks, including Mean.io, Jelastic Hybrid PaaS, and Bitnami MEAN stack. Developers can start playing around with these and deploy a fully configured stack on Azure within minutes! This is great for developer productivity, as not much time is wasted in set-up and ramp-up – you can click through a free trial to see how easy it is.
Robust mobile services: Node plays an important role in Microsoft Azure’s Mobile Services as well. Whether it is SDKs for different mobile platforms exposed as REST APIs, or accessing authentication, push notification and storage services on Azure, it is easy to access these services with the Node.js and Express framework.

Up Next: MongoDB on Azure – the IaaS approach (Part 2 of 2)

In the second part of this blog post, I will discuss MongoDB on Azure. The basic difference between discussing the “M” in MEAN and discussing the “EAN” is that the “M” needs a deeper architectural dive. Note that while Express, Angular and Node all run very well on Azure, there are some additional considerations if you want to stand up a highly available, fault-tolerant n-way-sharded, n-way-replicated MongoDB cluster on Azure. Check back on the blog later this week for Part 2, when we’ll address these topics and more!
We would love to hear from you! If you have any questions or other topics you’d like to see us address on this blog, just let me know in the comments.
Want to try Azure in the meantime? Sign up for a free trial.