Updates from July, 2012 Toggle Comment Threads | Keyboard Shortcuts

  • Richard 7:39 pm on July 13, 2012 Permalink |  

    365 days at 210 degrees 

    It’s been roughly a year since I joined Two10 Degrees, the Windows Azure consultancy based in the UK (I started just before the official launch). It’s been an amazing year, here are some numbers to illustrate what I’ve been up to:

    • Hosted 9 Acceleration Labs in 5 different countries
    • Helped over 50 software businesses adopt the cloud
    • Created 11 open source projects on GitHub
    • Spoken at 3 public events
    • Written 58 blog posts, attracting >9,000 visitors (200/month this time last year, now 1,500/month)
    • Used countless hours of Azure compute time
    • Recorded two podcast episodes (more to come)
    • Broken 1 Windows Phone 7
    • Consumed 660 cups of tea (estimated)

    I have had the opportunity to work with all kinds of software technologies including Java, PHP, .NET and Qt. I have worked alongside some of the biggest software businesses in the world, and some smallest startups on the bizspark programme.  I’ve grown my knowledge both deeper and broader, using technologies like node.js, Kinect for Windows, and starting to look as Haskell.

    Two10 have been a very supportive employer. Giving me the opportunity to speak at events, encouraging open source projects and being open minded to ideas and suggestions are just a few examples. I’m very fortunate to work alongside some incredibly intelligent and talented people, who like a good challenge,  push boundaries, and have fun at the same time. We’re a small team, but I think small is good. Like a wise man once said, “We’re a small dog, but we know how to wag our tail”.

    Thanks guys, I can’t wait to get cracking on some of the projects scheduled for year 2!

  • Richard 8:44 am on July 13, 2012 Permalink |  

    NGINX + Node.js + Windows Azure 

    I recently did a talk showing how you can easily get a node.js server up and running in Azure, fronted by NGINX using my AzurePluginLibrary. Here’s how it works.


    This is really a demonstration of the plugin library, rather than the capabilities of Azure. Azure will run node.js using Websites and Cloud Services, using IISNode. However, there are a couple of scenarios where you might not want to use IISNode; 1) it adds an overhead, thus reducing the capacity of your server, 2) if you want node to act as a socket server – IIS currently doesn’t support raw sockets. Using a reverse HTTP proxy like NGINX is a fairly common, it’s quickly becoming one of the top web servers on the internet.  NGINX will handle things like SSL, GZIP compression, load balancing, URL rewriting and serving static content with some simple configuration.

    1. Installing the plugins

    Download APM, a command line tool for installing plugins, which extend the capability of the Azure SDK. Then run APM elevated, with these commands (it’s case sensitive):

    > apm install Node
    > apm install nginx

    This will install the plugins for Node and NGINX in your Azure SDK plugins folder. You only need to do this once.

    2. Create the worker role

    In Visual Studio, create a new Cloud project, and add a Worker Role. Add a server.js file to the Worker Role project, which looks something like this:

    var http = require('http');
    http.createServer(function (req, res) {
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end('Hello World\n');

    Notice that the web server is started on port 210.

    Set the properties of the server.js file to ‘Copy if newer’ to ensure it is included in the Azure package. The Node plugin will run a server.js file if it finds it in the e:\approot\ folder.

    Now create a ‘conf’ folder in your worker role, and add an nginx.conf file to that directory. I used a file like this:

    worker_processes  1;
    events {
        worker_connections  1024;
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        server {
            listen       80;
            location / {
               proxy_pass  http://localhost:210;
               proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;

    This forwards requests from port 80 to port 210. It doesn’t do much else, but you can alter this configuration to include the features you want. This gist is a good example.

    Set the properties of the nginx.conf file to ‘content’ and ‘copy if newer’. This will ensure the file is included in the package, with the sub-directory preserved. The nginx plugin will inspect the conf folder in e:\approot\ and use any configuration files placed there.

    The last thing to do is to alter the ServiceDefinition.csdef file in your Cloud Project, to include the two plugins, and expose port 80. It should look something like this:

    <?xml version="1.0" encoding="utf-8"?>
    <ServiceDefinition name="WindowsAzure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-05.1.7">
      <WorkerRole name="WorkerRole1" vmsize="Small">
          <Import moduleName="nginx"/>
          <Import moduleName="Node"/>
          <InputEndpoint name="Endpoint1" protocol="tcp" port="80" localPort="80" />

    3. Deploy Your Project

    With any luck you’ll be able to browse to your *.cloudapp.net address, and see Hello World!

Compose new post
Next post/Next comment
Previous post/Previous comment
Show/Hide comments
Go to top
Go to login
Show/Hide help
shift + esc