Windows Azure Accelerator for Web Roles (Year of Azure Week 2)

Tired of it taking 10-30 minutes to deploy updates to your website? Want a faster solution that doesn’t introduce issues like losing changes if the role instance recycles? Then, you need to look into the newly released Windows Azure Accelerator for Web Roles.

The short version is that this accelerator allows you to easily host and quickly update multiple web sites in Windows Azure. The accelerator will host the web site’s for us and also manage the host headers for us. I will admit I’m excited to start using this. We’re locking down details for a new client project and this will fit RIGHT into what we’re intending to do. So the release of this accelerator couldn’t be more timely. At least for me.

Installation

I couldn’t be more pleased with the setup process for this accelerator. It uses the web platform installer complete with dependency checking. After downloading the latest version of the Web Platform Installer (I’d recently rebuilt my development machine), I was able to just run the accelerator’s StartHere.cmd file. It prompted me to pull down a dependency (like MVC3, hello!) and we were good to go. The other dependency, Windows Azure Tools for VS2010 v1.4 I already had. Smile

I responded to a couple y/n prompts and things were all set.

Well, almost. You will need a hosted Windows Azure Storage account and a hosted service namespace. If you don’t already have one, take advantage of my Azure Pass option (to the right). If you want to fully use this, you’ll also need a custom domain and the ability to create a forwarding entry (aka c-name) for the new web sites.

Creating our first accelerated site

I fired up Visual Studio and kicked off a new cloud project. We just need to note that we now have a new option, a “Windows Azure Web Deploy Host” as shown below.

image

Now to finish this, you’ll also need our Azure Storage account credentials.  Personally, I set up a new one specifically to hold any web deploys I may want to do.

Next, you’ll be asked to enter in a username and password to be used for administering the accelerator via its web UI. A word of warning, there does not appear to be any password strength criteria, so please enter in a solid, strong password.

Once done, the template will generate a cloud service project that contains a single web role for our web deploy host/admin site. The template will also launch a Readme.htm file that explains how to go about deploying our service. Make sure not to miss the steps for setting up the remote desktop. Unfortunately, this initial service deployment will take just as long as always. It also deploys 2 instances of the admin portal, so if you want to save a couple bucks, you may want to back this off to 1 instance before deploying.

You’ll also want to make sure when publishing the web deploy host, that its setup for remote desktop. If you haven’t done this previously, I recommend look at Using Remote Desktop with Windows Azure Roles on MSDN.

NOTE: Before moving on to actually doing a web deploy, I do want to toss out another word of caution. The Windows Azure storage credentials and admin login we entered were both stored into the service configuration for the admin site role. And these are stored in CLEAR TEXT. So I you have concerns about security of these types of things, you may want to make some minor customizations here.

Deploying our web site

There are two steps to setting up a new site that we’ll managed via the accelerator, we will have to define the site in the accelerator admin portal, and also create our web site project in Visual Studio. Its important to note that its not required that this site be a Windows Azure Web Role. But not using that template will limit you a bit. Namely, if you plan to leverage Windows Azure specific features you will have a little extra work to do. It could be a simple as adding assembly references manually, to having to write some custom code. So pick what’s right foimager your needs.

I started by following the accelerator’s guidance and defining my web site in the accelerator host project I just deployed. I enter a name and description and just keep the rest of the fields at their defaults.

A quick check of its status shows that its been created, but isn’t yet ready for use. You’ll also see one row on the ‘info’ page for each instance of our service (in my case only one because I’m cheap *grin*).

One thing I don’t get about the info page is that the title reads “sync status”. I would guess this is because it shows me the status of any deployments being sync’d. I agree with the theory of this, but I think the term could mislead folks. Anyways… moving on, we have a site to create.

I fire up Visual Studio 2010 and do a file->new->project. Unless the accelerator documentation, I’m going to create a web role instead (I use the MVC2 template). Next, we’ll build and publish it. You will get prompted for a user name and password, so use the remote desktop credentials you used when publishing the service host initially.

Things should go fairly smooth, but in my case I get a 500 error (internal error in the service) when trying to access to the MSDEPLOYAGENTSERVICE. So I RDP’d into the service to see if I could figure out what went wrong. I’m still not certain what is wrong, but eventually it started working. It may have been me using the Windows Azure portal to re-configure RDP. I could previously RDP into the box just fine, but I couldn’t seem to get the publish to work. I just kept getting a internal server error (500). Oh well.

Once everything is ok, you’ll see that that the site’s status has changed to “deployed”.

image

Its fast, but so what?

So, within 30 seconds, we should be seeing the new site up and running. This is impressive, but is that all? Actually no. What the accelerator is doing is managing the IIS host header stuff, making it MUCH easier to do multiple web sites. This could be just managing your own blog and a handful of other sites. But say you have a few, or a hundred web sites that you need to deploy to Azure, this can make it pretty easy. ISV’s would eat this up.

I could even see myself using this for doing demos.

Meanwhile, feel free to reverse engineer the service host project. There’s certainly some useful gems hidden in this code.

About these ads

One Response to Windows Azure Accelerator for Web Roles (Year of Azure Week 2)

  1. Pingback: JrzyShr Dev Guy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 1,147 other followers

%d bloggers like this: