Windows Azure Web Sites
Posted on June 8, 2012 by Chris Koenig
- Windows Azure Web Sites
Similar to the way I went about learning Windows Phone, I’m going to use my blog as a place to chronicle my experiences with the newest Windows Azure capabilities, as announced recently at our MEET Windows Azure event. Hopefully everything will be clean, crisp and clear, but as with all emerging technologies, sometimes there are always slight bumps in the road, and I’m sure I’ll hit most of them. I’ll do my best help you navigate around or through the bumps as best I can based on my own learnings and (hopefully) your comments.
So as my first post, I’ll provide a brief tour of the new HTML-based UI and show how to deploy a new application – based on a template – into the new (and very exciting) Windows Azure Web Sites feature. For this demo, I’m going to pick on WordPress, because I use it for my blog, as well as the GiveCamp.org website and have become a fan of its features over the past couple of years.
I realize most of you won’t have the luxury of starting with File->New and many of you won’t necessarily want to deploy something out of the gallery, but this is a good, simple place to get started introducing the tools. Watch for more “real world” scenarios later on in this series.
As with all the demos in this series, you’ll have to have a Windows Azure account in order to follow along at home. There are a couple of ways to get started with your Azure account – but the easiest way is to sign up for a FREE 90-Day trial. The 90-day trial is completely FREE and even comes with a convenient “Spending Cap” (initially set to $0.00) to prevent you from accidentally spending money 🙂 If you really like the services provided by Windows Azure, and want to take on some more features or usage levels beyond the scope of the free trial, just remove the spending cap and you’re good to go!
Once you get your account all set up, navigate over to the new Management Console to get started by visiting http://manage.windowsazure.com. If you somehow ended up at the old management site (http://windows.azure.com) you’ll need to “opt in” to the new management portal as it’s not currently the default (as of this writing). It’s easy to do this – just click on the “Visit the Preview Portal” link at the bottom of the existing Silverlight portal UI:
Also, as of the time of this writing, you’ll have to specifically ask for access to the Web Sites feature. You do this by clicking on the New button at the bottom (the great big + symbol) and hovering over the greyed-out “Web Sites” link. This link will take you to the Azure Account Management page and allow you to request access for the preview features:
Click the “Try it Now” button to request access to the features you want.
New HTML5-based Management Portal
OK – Now that we’re in the new portal, let’s talk about that for a minute. Although I was a big fan of Silverlight (and I’m sure you were too) we actually got some comments from users of Azure about the Silverlight UI for managing your account. With the way technology trends are shifting these days, we agreed with those comments, and decided that it made much more sense for us to migrate this management console over to HTML5. HTML5 gives us much broader reach in terms of browser and platform support, since not everyone had Silverlight installed, and is especially important now that Windows is no longer a requirement for building and deploying applications into Windows Azure! (more on that in future posts).
Here’s a screen shot of the new HTML5-based Management Console
Right off the bat you’ll notice that the Management Console is much cleaner, and more Metro-ified than its predecessor. Down the left-hand side, you can see all of the choices you have for utilizing the various Windows Azure services including Web Sites (which we’ll dive into more detail here), Virtual Machines, Cloud Services (which is what you’re all previously used to as Windows Azure Web Role and Worker Roles), Storage and Networks. You can view everything all-up from with “All Items” option, or select an individual service to see just those items. My list is empty because I just set up my account, so let’s go in and create a new Web Site!
Windows Azure Web Sites
In addition to the dedicated Web Role infrastructure that you can deploy with Windows Azure, Windows Azure Web Sites provide a simple, low-cost way to get your applications up and running in what is the equivalent of a Shared Hosting environment.
To get started, just select “Web Sites” from the primary navigation, and choose the “Create a Web Site” link.
When the link is clicked, a data entry window will jquery up from the bottom and give you the options to create a new blank site (Quick Create), create a blank one with database support (you can pick from SQL Server or MySQL) or create from the Gallery. For this demo, we’ll pick the 3rd option (we’ll look at the others in future posts).
When you select “From Gallery”, the following dialog pops up to allow you to pick open of the open source applications that we support natively in Windows Azure Web Sites.
Like the Web Platform Installer, which was the inspiration for this process, the Find Apps for Azure dialog shows all the available web apps that you can install. You can scan through the entire list, or filter based on Blogs, CMS, etc. For our purposes, we’ll scroll down to the bottom of the ALL list, click on WordPress and press the right arrow button in the lower-right corner of the dialog. This will take us to the following “Configure your App” page.
You’ll need to enter a unique endpoint to use, but you can always use custom DNS settings to hide this very technical-looking URL from your users. You also have the chance to select an existing database (if you have one) and a deployment region. As per Windows Azure Web Roles, you will want to select a region that makes sense for the users of your application – if you know that all your users are located in Texas, for example, pick South Central US.
Once you have the details entered, press the right arrow button to go to step 3. This takes you to the New MySQL Database page:
From here, you can select the name of the database as well as the Region. Name is up to you, but it does need to be unique. I would also not change the Region, except to make sure that it’s located in the same region as your Web Site. Putting these in different places will increase the network latency between your app and its database, so it almost never makes sense to have these names differ. On this page, you also have to agree to the ClearDB’s legal terms. IANAL, but I took a glance at it and it looks pretty straight forward to me. YMMV, and all those other terms…
Once you’re done accepting the terms, click on the check mark to begin provisioning your app. You can watch the status go from creating, to deploying to (hopefully) running in less than a minute! Take THAT, Windows Azure Web Roles!
Remember the name of the unique endpoint you first entered when creating your app? Well, it’s listed here and serves as a button, complete with navigational arrow, to take you to the details of your service. Click on it (mine is “ChrisKoenig”) and see the following details page.
This page deserves some explaining.
Section 1 at the top is a graph that will show a bunch of statistics related to your application including CPU time, number of requests, data in and out and HTTP server errors. This is LIVE data, so if you press the refresh button at the top/right, you’ll see the data change as your site gets visitors and activity.
Section 2, under “usage overview”, shows additional details around your account’s resource consumption with data points that highlight the current app, but show data for all your web sites.
Section 3, under “quick glance” has a bunch of links to helpful information such as connection string settings, publish profiles, and Git/TFS publishing settings as well as status, details and other useful information.
I will discuss more on the Git/TFS stuff in future blog posts, but for now it means this – deploying your Azure Web Site application can be as simple as “pushing” to an Azure-hosted Git or TFS repository. The command “git push azure master”, for example, will deploy a new version of your website directly to Azure – live and in color.
You can click through the other items on the toolbar including Monitor, Configure, Scale and Linked Resources.
- Dashboard is the current (default) view.
- Monitor gives you a more detailed view of the real-time monitoring for Windows Azure Web Sites.
- Configure allows you to specify the version of the framework you’re using, turn on and off diagnostics, control default documents and more.
- Scale allows you to “scale up” your website beyond the shard hosting model provided out of the box. You can switch to a “Reserved” mode as well as increase the instance count of your web site from 1 to 2 or 3 servers. Beyond this, I suspect that you’ll have to migrate to a Web Role in Azure.
- Lastly, the Linked Resources page shows any referenced resources, such as a Storage Account, or (in this case) a database.
These configuration settings are a great new addition to the Azure environment and make it a LOT easier to manage your web sites than ever before.
Show me the Site!
At this point, all of your configuration settings should be complete (even though it’s worth pointing our that we didn’t actually need to change anything – we left all the defaults in place) you can view the results of your work by clicking back on the Dashboard tab, and clicking on the Site URL link under the “Quick Glance” section:
From here you should see a new browser window open with the WordPress configuration page launch just as if you’d installed it the hard way.
From here, you enter the Site Title, User Name, Password, etc. just like you would for any new WordPress installation. When you’re done, you have a working Azure-based WordPress site ready to go! You can update the code via Git/TFS, FTP or Web Deployment tool in Visual Studio or Web Matrix! SO SIMPLE even I could do it 🙂
In the next installment of this series, I’ll look at taking an existing WordPress application and migrating it over to Windows Azure Web Sites without using the Gallery. We’ll have to save off and script our old site, create a new Azure-based MySQL database and manually publish to Azure through FTP or GIT.
Should be fun – so see you next time!