If you’re looking for a cloud platform to build and deploy highly scalable Node.js applications and services, Windows Azure is a good fit. It supports a wide variety of programming tools, frameworks, and development tools, including Node.js.
In this post, we’ll take a look at various options for building and deploying Node applications on Windows Azure. If you’re new to Windows Azure, you can sign up for a free trial to get started. Windows Azure development is a vast topic, and here we’ll just focus on the basics of getting up and running with Node.js. To dive deeper, take a look at Chapter 1: Windows Azure Platform Overview in Windows Azure Platform.
There are three ways to deploy Node applications and services on Windows Azure:
- Windows Azure web sites – highly scalable sites that can be provisioned and deployed quickly. You can deploy your code via FTP, or configure your site for continuous integration with a GitHub repo, Dropbox folder, or TFS repository.
- Infrastructure services – a scalable on-demand infrastructure that you can use to bring existing workloads to the cloud as-is, or spin up new Windows or Linux virtual machines in minutes.
- Cloud Services – a rich PaaS environment with automated provisioning, load balancing, auto-scaling, and OS/security management, so that you can concentrate on writing code.
As a rule of thumb, you’ll want to use Web Sites for simple projects. For more complex scenarios, you can use Infrastructure Services if you want maximum control of configuration details, or Cloud Services if you want to minimize your ongoing operational responsibilities. Regardless of which you choose, you have two options for deploying and managing your site:
- For those who prefer the GUI approach, there is a web interface (the Windows Azure management portal) that provides options for provisioning, starting, stopping, or deleting your applications and services.
- For those who prefer the command line, a set of PowerShell cmdlets is available for managing cloud deployments from Windows. In Mac or Linux environments you can use the cross-platform command line interface, which is written in Node.js and will run on any OS that supports Node. These tools, as well as Node.js SDKs for Windows, Mac, and Linux, are available for free download from the Windows Azure download center.
When you create a Windows Azure Web Site there are two options for Node developers. The Node JS Empty Sites is a pre-built website set up with Node.js, and the Node JS Starter Site also includes the popular Express MVC framework.
For spinning up a virtual machine to host your Node applications on Windows Azure Infrastructure Services, there are several options. One is to simply deploy a base OS and then build your preferred Node environment on top of it. This is the quick create option in the Windows Azure management portal, and current OS options include: Windows Server 2012, Windows Server 2008 R2, openSUSE 12.3, SUSE Linux Enterprise Server 11 SP2, OpenLogic CentOS 6.3, or Ubuntu Server versions 12.04 LTS, 12.10, or 13.04.
An even faster way to get a Node.js development environment up and running on Infrastructure Services is to take advantage of the pre-built virtual machine images available on VM Depot, a community-driven catalog of preconfigured operating systems, applications, and development stacks that can easily be deployed on Windows Azure. Current options on VM Depot include Node.js 10.5-0 on Ubuntu 12.10.
Note that Windows Azure Web Sites and Cloud Services provide automated tools for deploying and managing your applications, but with virtual machines you’ll need to use SSH to manage your deployments. This is another factor to take into account when choosing among the Azure options for Node developers.
To get started with Windows Azure cloud services, see the Build and deploy a Node.js application to a Windows Azure Cloud Service tutorial. The New-AzureServiceProject cmdlet sets up the structure for deploying a Cloud Service, and the Add-AzureNodeWebRole cmdlet generates scaffolding for a basic Node.js application. After editing the generated server.js as desired, you can run your application locally in an emulator, which you launch with the Start-AzureEmulator cmdlet.
The entire dev/test/deploy process is automated through the cmdlets, so that you can concentrate on building your application. Similar options are available for Mac and Linux users via the cross-platform command line interface. And regardless of how you create it, your Node.js-based Cloud Service has full access to Azure’s APIs for services such as compute, storage, caching, and messaging (Service Bus). For an overview of the Azure APIs you can use from a Node application, see the GitHub repo for the SDK.
That’s a high-level overview of the options for getting started with Node.js on Windows Azure. See below for books covering Windows Azure as well as Node.js. In future posts we’ll take a closer look at how to take full advantage of Azure services and how to monitor performance of your Node.js applications on Windows Azure.
You can find a wealth of information on Node.js and Windows Azure in the eBooks referenced below.
Safari Books Online has the content you need
|In Windows Azure Platform is divided into three key parts: Windows Azure, SQL Azure, and Windows Azure AppFabric. Each of these plays a unique role in the functioning of your cloud service. It is the goal of this book to show you how to use these components, both separately and together, to build flawless cloud applications as well as hybrid architectures that fit in alongside your business’ existing systems.|
|Windows Azure Programming Patterns for Start-ups is an incremental guide that will take you from the essentials of the Windows Azure platform up to the realization of your own cloud services running on the platform. You will learn how to apply different technologies of the Windows Azure platform with the help of examples all focusing on one single fictitious start-up scenario.|
About the author
|Doug Mahugh is lead technical evangelist at Microsoft Open Technologies, Inc., a wholly owned subsidiary of Microsoft Corporation responsible for advancing the company’s investments in interoperability, open source, and open standards. He can be reached at email@example.com, or on Twitter at @dmahugh.|