Node.js @ UKWAUG: MS Cloud Day – Windows Azure Spring Release

The fourth session I attended was the highly energetic and speedy introduction to writing node.js and running it on Azure, presented by the author of Simple.Data and Simple.Web, and one of those voices of the developer community with a great JFDI attitude, Mark Rendle (@markrendle).

I’ve just recently got into node.js development myself and have been very much enjoying node, npm, express, stylus, and nib; there is a fantastic community and expanse of modules already and that can be a bit daunting.

During the session Mark’s short code example shows just how simple it can be to get up and running with node, and also how easy it is to deploy to Azure.

A nice comment was that we are on the road to “ecmascript harmony”! And that “Javascript is a great language so long as you ignore the 90% of it which coffeescript doens’t compile to.”

It was a very fast-paced session; hopefully my notes still make sense though..

What the various aspects of Azure do

  • compute – web, worker, vm
  • websites – .net, node, php
  • storage – blob, tables (distributed nosql, like cassandra), queues
  • sql – sql azure, reporting
  • services – servicebus, caching, acs

What are the Cloud Service types used for

  • web roles – iis, for apps
  • worker – no iis, for running anything

How to peruse the contents of blob or table

General tips for developing sites for use in Azure

  • keep static content in blob storage
  • websites commit and deploy much faster than cloud serviecs commit and deploy process
  • azure/iis needs server.js, not app.js

How to run RavenDB in Azure

  • Spin up a vm and install it!! (this used to be a much trickier process, but the recent Azure update meant that the VM support is mature enough to allow the simpler solution)

Developing node.js

Use jetbrains webstorm for debugging/ or the wonderful online editor, Cloud9IDE. Sublime Text 2 is a great editor for simple code requirements, and has great plugins for Javascript support. I also used this for taking all of the seminar notes as it has a simple “zen” zero-distractions interface

Next up – Hadoop and High Performance Computing

MongoDB @ UKWAUG: MS Cloud Day – Windows Azure Spring Release

My third session was about MongoDB and how you might implement it in Azure, presented by MongoDB’s own Gregor Macadam (@gregormacadam).

I only had limited knowledge of what MongoDB was before this session (a document based data store, much like CouchDB and other NoSQL variants), so given that this session appeared to be an intro to MongoDB as opposed to MongoDB on Azure then that suited me just fine!

Here are the basic notes I made during Gregor’s talk (although you may as well just go to MongoDB.org and read the  intro..):

MongoDB uses sharding for write throughput.
The REST interface uses JSON as the data transport format
Data is saved in BSON structure

The db structure (usually?) consists of three nodes; a single primary and two replicated secondary – these are referred to as a Replica Set.
A Replica Set has a single write node with async replicate to other set members, read from all

The write history (known as UpLog) is in the format "move from state A, to state B" so as to avoid overwriting changed data.

If write (to primary) fails, an automatic election determines which remainder is new primary; usually primary is the node with latest data.

It can be configured to write to multiple hosts, but the write won’t return until all writes are completed

An "arbiter" can be the tie breaker in determining the new primary node during election, and we can specify weighting for that process.

"Read" scales with more read nodes, "Write" scales with multiple read/write groups (replica sets) or sharding.

Need config database to define key ranges for sharding etc

MongoS process runs on another node and knows which shard to write your data to.

The updates are released on windows and Linux at same time

Within Azure

Data is persisted in blob storage
MongoDB runs in worker role
page blob is NTFS cloud drive (data drive?)

MongoS router process is required to load balance access to correct node, not the Azure load balancer; the Azure load balancer can end up sending the write request to a non-primary node.

OSdisk has caching enabled by default, data disk doesn’t

Code is Open Source and can be found on github and issues can be raised on the Mongo Jira site

You can sign up for a free Mongo Monitoring Service on 10gen

Main points that I took away from this is that it sounds like you need a large number of Azure VMs to get Mongo running; one for each node, one for each MongoS service, one for an arbiter (maybe more – I didn’t catch all of these details that were raised by a couple of good questions from the audience).

Although I have a big plan to use NoSQL for the front end of an ecommerce website, I don’t think that MongoDB’s Azure offering is mature enough yet. I’ll be looking into CouchDB and Raven initially and keeping an eye on MongoDB. (Interested in how to get Raven running on Azure? Wait for the next post!)

The slide deck from this session is here

Next up – node.js

IaaS @ UKWAUG: MS Cloud Day – Windows Azure Spring Release

Infrastructure as a Service in Azure

Unfortunately, the earlier network disaster at the conference meant that this session seemed to have been cut short. This is a shame as the Azure IaaS offering has really matured and I was looking forward to how I can utilise the improved system.

Since it was a short one, the notes taken on what Microsoft’s own Michael Washam (@MWashamMS) talked about are limited. Here goes:

You can can upload your own VHDs which must be fixed disks, not dynamic

Data disks are a virtual HD which can be attached to your VM; each data disk is up to 1TB!

Instance size/# of data disks

  • xs 1
  • s 2
  • m 4
  • l 8
  • xl 16

So a single XL instance VM can have 16TB of HA storage attached!

Data disks lives in blob storage

Using port forwarding and configuring a Load Balanced Set allows you to set up a cluster/farm.

The load balancer functionality has custom probes; these look for HTTP200 on a health check page. The health check page can be custom and do custom logic (e.g., auth/db conn) determining whether to return a 200 status or not.

Availability Sets ensure not all the VMs in a set would go down for usual updates and patches at the same time; i.e., your load balanced endpoint would always have an active VM on the other end.

The Windows Azure Virtual Network allows, as mentioned in the Keynote, a VPN to be set up which can be patched into your on-premises router to act as if it’s on-prem itself.

The VPN can be configured/defined via an xml file. The creation of the VMs and their attached data disks can be scripted from the mature Azure Powershell cmdlet library. Using these together Michael was able to show how he can run a powershell script to spin up a farm of ten servers from a pre-existing VHD, attach a 1TB data disk to each, and assign them IP addresses within the configured VPN range.

He then downloaded the VPN settings from Azure in a format specific to a possible corporate router to effectively bring that new server farm into the on-premises network.

This automatic setup and configuration was really rushed through and quite tough to follow at times, probably due to the lack of time. There were some tantalising snippets of script on screen momentarily, and then it was all over.

My big take away from this session was the ability to automatically spin up a preconfigured set of servers to create a QA/dev/load test environment, do horrible things to it, get some reports generated, then turn it back off. Wonderful.

:: Michael with the money shot

ukwaug ms cloud day MWasham azure spring release 2012 IaaS

Next up >> Mongo DB

UKWAUG: MS Cloud Day – Windows Azure Spring Release

Some notes on the recent UK Windows Azure User Group (@ukwaug) Microsoft Cloud Day held in the Vue cinema in Fulham Broadway; a place close to my heart, as Fulham was the first place I rented in London well over a decade ago. The cinema wasn’t there then. Nor was the mall which houses the cinema.

Nor, more significantly, was Azure (pretty sure Microsoft was though..)

To be fair, even though Azure *was* around a couple of years ago, it certainly was not a first class citizen in my tekky box of tricks; more of a "this is pretty cool – think I’ll wait until it’s finished first."

Now it’s pretty much ready; not quite "stick a knife in it, comes out clean" ready, but more "better give it five more minutes" ready.*

The first Azure attempt had a reasonably complex and confusing Silverlight interface that attempted to convey the full capabilities of Azure. If you really gave it your attention then you could develop some really complex and clever solutions via cloud-based computing.
:: Silverlight portal

If you already had a chance to catch the recent Azure keynote then you’ll probably already know that Azure has a wonderful new HTML5 portal (tata Silverlight – though you can still get that version if you want), WebSites (sort of an extension/simplification of the Web Role cloud service), git support, tfs support, and loads more; I’m not going to list and explain everything new here as I just wanted to cover some of the notes I made during the UKWAUG MS Cloud Day.
:: HTML5 portal

Given that the Spring release has been out a couple of weeks now I’ve already had a chance to play with what I found to be the more interesting changes namely: git support, tfs support, websites (sort of lightweight web roles), and support for non-.net languages, such as Node.js.

Keynote

After a short intro from Andy Cross of Elastacloud (and co-founder of UKWAUG) we are presented with the trademark red polo shirt of Scott Guthrie, ready to show off the great new developments in the Spring Azure release.

Interesting points:

  • The Azure SDKs are published on github, they take pull requests, which actually makes Azure SDKs actual OSS! Amazing!
  • The azure servers themselves are, located close to hydroelectric generators or wind powered generators. They are site managed by 1 person per 15k servers.
  • There is a 99.95% SLA, with a money back guarantee
  • The new release supports node.js, java, php, and python
  • The Azure SDKs run on linux, mac, and windows
  • There is a much simplified pricing calculator
    :: Old
  • :: new

VMs

With regards to licensing for software installed on VMs in Azure (such as SQL): you can use the standard licensing from vendor, volume licensing/SA is also supported.

You can attach a "data drive" to vm, which is a virtual fixed disk of 1TB. You can attach multiple data drives and these can be RAID-ed should you want. The data stored on these is persistent and will survive a restart.

The VMs all have a D drive which is just temporary swap file drive; the data on these is temporary and will not survive a restart.

One interesting point was raised by an audience member: why does the Windows Server 2012 VM in Azure have a floppy drive listed in "My Computer"?.. Scott couldn’t answer that one!

All endpoints on a VM are locked down initially and have to be explicitly opened up.

You can create an Availability Set; these are multiple VMs which will be guaranteed to be deployed on separate servers, separate racks, etc. This gives a sort of automatic "High" Availability.

There’s a great blog post by Maarten Balliauw about using Azure VMs to create a cloud-hosted web farm!

Since the VMs support other OSs which will also support these data drives etc, they can be formatted to whatever file format is required (such as EXT3 for example).

Scott then proceeds to use git bash to ssh into his unbuntu server VM.

Within the new portal there is a "My Images" section under the VM area; you can upload your own VM image or use a capture/snapshot created from within Azure itself.

One thing that was wonderful for a real nerd like me (whose degree was based on Unix) is the Azure cmd line support!

From the command line you can run "azure vm list" which executes a REST query against your Azure management portal. Adding a "–json" flag returns json formatted data.

VPN support

From within the portal a VPN can be created by simply selecting New -> Network -> Address Range. This is virtualised so no conflicts exist between customers using the same address range.

It is then possible to download these VPN settings to make the Azure VPN link with your local network, making it work as if it’s just in the next room.

Supports UDP and TCP but not multicast.

There is hypervisor support for porting VMs to and from Azure.

VMs are setup with a persistent drive; these are HA drives accessing data from Azure storage. As such, they are always-on.

The High Availability is implemented with a layer of SSD & caching above the HA triplicate drives with continuous storage georeplication; this covers for natural disaster (however these are always within same geopolitical boundary). This is automatically on but can turn it off to save money.

Azure now supports Chef, the open-source systems integration framework!
http://www.opscode.com/chef/

No AV is provided on the VM image by default, but you can install it yourself on the VM.

My big take-away from this session is the plan to utilise VMs to spin up dev/test environments within the VPN and turn them off outside of office hours to save money. This could potentially be covered within a standard MSDN subscription; something to look into.

Websites

Each Azure account has 10 websites for free. These start in a shared location, but you can pay for private.

All Azure accounts include 10 websites and the MSDN subscription includes bandwidth, storage, vms, etc which can be used to enhance the website (i.e., install a SQL backend or something)

Supports git, tfs, ftp, and web deploy

supports incremental deployment; first one is big, subsequent ones are incremental/smaller

The free Azure account already includes 10 websites, 1gb bandwidth, 20gb db, and 1gb storage.

In terms of DNS, you can map cnames to websites and but would need to use a VM to map anames.

At this point there was a major network outage eventually resulting in a dodgy, insanely long RJ45 cable to be laid from the projection room at the back all the way to the front of the auditorium! Apparently this cable was actually longer than the max allowed length for a wired ethernet connection, so only worked on a couple of laptops; neither of which were Scott’s.. Note to self: always have a backup *everything*, even a backup network!

Cloud Services

When creating a website in Visual Studio you can just deploy to azure as a website; the only additions to your file system might be a web.config and a csdef file.

You can convert a website project in VS to cloud service which includes cloud services within your solution and then deploys as an Azure Cloud Service

It is possible to programmatically scale; currently this is by using the Wasabi library, but does need to be scripted. This functionality will be added as a feature in future releases.

The Azure Application building blocks for Cloud Services:

  • big data,
  • db,
  • storage,
  • traffic caching,
  • messaging,
  • id (authentication),
  • media,
  • cdn,
  • networking

SQL

  • Reporting services has been added recently for BI
  • SQL Server 2012 denali (?) is a subset of full SQL Server 2012
  • VS2012 can support data projects to target the correct SQL DB type for Azure and can identify incompatible features (remember ye olde SQL Azure’s incompatibilities? Yuck..)
  • SQL is PAYG.
  • It is possible to restore a db to a specific point via the constantly backed up transaction logs
** Unfortunately the earlier network outage during this session meant we had to cut it short here as we were already overrunning quite significantly **

:: Scott Guthrie delivering the Spring Release Azure Keynote

ukwaug ms cloud day scottgu azure spring release 2012 keynote

Next up – IaaS, Mongo DB, Node.js & git & Cloud9IDE >>

* yes, I like cooking. So?!

Find of the day: site44.com

Making and hosting a website has never been easier, thanks to the likes of AppHarbor, heroku, and github pages. Now there’s a new contender on the block and it’s possibly even easier to use that the others; if you don’t do dynamic content and just want a static website, check out site44.com

This site takes your dropbox account (if you don’t know what dropbox is, head over to their site and watch the “What is Dropbox” video; essentially it’s distributed online file storage) and uses a folder (which it creates) as the root for your website.

 

site44 homepage

Just follow those steps and you’ll find a new folder appear in your local Dropbox folder:

site44 autogenerated dropbox folder

In there you’ll find a new index.html page with the default content:

site44 autogenerated homepage

Open that file locally, edit it, save it, give Dropbox a second to sync it back up and:

site44 gordons alive

Jeepers.

 

Think I might do a compare and contrast with Appharbor, github pages, and site44 at some point. The world is a clever place.

EC2 WinSCP /var/www file upload

Since I use an Amazon EC2 Microinstance to host this blog and I noticed I had no favicon appearing (which is a bad thing) I thought I might as well make one and pop it up.

I took my usual avatar (Jiraya, the “Pervy Sage” from Naruto) and just let someone else do the hard work for me, uploading it to FavICO.com instead of even bothering to download an app to do it.

Then I opened up WinSCP and used my EC2 ppk to authenticate with my EC2 instance, took that favicon.ico file and tried to upload it to /var/www/html (the default website root if you install wordpress) only to receive the error:

ec2 var www upload permission error

Hmmm.

If you check the permissions on that folder (“stat /var/www” via SSH) you’ll see that it’s owned by the “root” group; since you’re logging on as ec2-user you’re not a member of that group.

Your options, according to the internet, appear to be;

The solution I found was much easier.

  • Upload the favicon to the ec2-user home directory via WinSCP
  • Move (mv) the favicon from the ec2-user directory to /var/www via SSH using “sudo” to get the necessary permissions

Easy.