Switching over to Azure

I’ve officially and finally moved away from a traditional web host, and over to Azure for my main sites:

Where do I start? There are a LOT of cool things I’ve learned – but there are a lot of pieces to this! Let me first summarize what I did:

What is Azure?
Azure is “the cloud” for websites, databases, services, and the like. Azure is similar to a traditional “web hosting” provider, except it’s much, much more than that – and that idea, taken to the next level.

For example, if you were starting a business, you could host your website, database and even all of your internal business critical applications in Azure, securely. It’s Microsoft’s far-more-robust competition for Amazon’s cloud services (a.k.a. EC2).

Why Host in Azure?
There are two significant reasons. Azure is one of the top-two cloud-hosting vendors out there, so professionally it doesn’t hurt to get familiar. Secondly, they have a really powerful, really useful web console for managing your hardware and software resources.

image

Getting BizSpark, to get MSDN and Azure for free:
I’ve had my eye on Azure for quite some time but have hesitated in switching over because of cost. Although “cloud hosting” scales remarkably well, the barrier-to-entry is a tad high. When I say a “tad” high, I mean that I currently pay ~$5/month for web hosting and the Azure equivalent would be around ~$15/month. Not breaking the bank, but that is 3x times as much!

It came up today that since I have BizSpark and MSDN, I also get a basic Azure account too. See:

Windows Azure for BizSpark members
http://www.microsoft.com/bizspark/azure/

So, I activated this subscription. The screens were all very intuitive and simple. Once set up, I started by by creating a “Web Site” for my www and my blog site. You click the “+” in the bottom left of the screen, on the portal (https://manage.windowsazure.com/)

image

I think I need to “sign up” to activate the “web site” feature because it is in beta, maybe? Anyhow, so this creates a free website on a shared server. You are limited to [mydomainname].azurewebsites.net

If you want your own domain to be hosted there or if you need SSL, then you MUST upgrade to a “reserved instance”. With your BizSpark account, you can do that.

Click “Scale” menu at the top, then change to “Reserved” and choose 1 small instance – that is what you get with BizSpark.

image

If you don’t have BizSpark – then this is where Azure would start costing money. Now, for the WordPress part…

Porting Your WordPress site:
I logged into my old site (http://robseder.wordpress.com) and you can go to /wp-admin/export.php?type=export on your own site to start this. From there, you can export all posts, categories, comments, tags, etc to one XML file.

Now, in Azure, I created a new “web site” from a “gallery”

image

image:

Again, this was very intuitive – just follow the prompts. This will create a new mySQL database for it and prompt you to create the admin login.

Once your site is up and running, navigate to it in a browser (log in to the new WordPress site) and navigate to /wp-admin/admin.php?import=wordpress

There are two catches here. First, you will see that the maximum size of the import file is 2MB. In my case, my import file was 3.5MB. If you try to do it anyway, you will get an error message that says you can up the limit by modifying the php.ini file.

As it turns out, you don’t have access to the php.ini file in Azure. However, in the same message board I found that, I found the solution too:

http://social.msdn.microsoft.com/Forums/pl-PL/windowsazurewebsitespreview/thread/06e57c7d-187f-4468-8ab3-2fe7e28f1aa4

The answer is:

basically, upload a .user.ini file to root folder of your web site which contains following line:

upload_max_filesize = 10M

Umm… How do I upload a file? For a regular, deployed site I could – but with WordPress, Azure manages that. Well, when you have the blog website selected in the Azure portal, choose “WebMatrix” in the bottom bar:

image

WebMatrix is a ClickOnce app that let’s you manage the file system. So, I created a .user.ini file (note the LEADING “.” is needed) – and then clicked “Publish”.

image

It somehow knew how to update the site. It only pushed what it needed too:

image

Earlier, I said there were two catches. The first is you need to upload that file. The second is that the import kept timing out. So, I would kick it off again. It turns out, the importer is smart enough to see a specific item was already added. So, after re-running the import probably 10 times, I eventually got everything imported.

Configuring DNS:
OK, next I need to both update my DNS to point to Azure, and I need to configure Azure to know that traffic will be heading to it. I started with Azure. When you have a site selected in the Portal, choose Manage Domains in the bottom bar:

image

from here, it tells you exactly what to do:

image

So, I logged into Network Solutions and created CNAME entries:

image

and then also set the A records too:

image

Back in Azure, you can now put in those entries and it configures what it needs to inside of Azure. On your LOCAL machine, if you need to refresh your DNS cache so that you can pick up the new addresses, you can always do “ipconfig /flushdns” and “nbtstat –R”:

image

Using tfs.visualstudio.com to do CI and continuous-delivery:
In addition to having a WordPress site that hosts my blog, I also want a regular website to host “www”. Why not use Visual Studio + TFS + Azure all together? This is crazy-simple and very cool!

Navigate to http://tfs.visualstudio.com and create an account if you haven’t already. Create a new project. I called mine RobertSeder.PublicSite.

Now, in Azure, in the portal, choose the www site. Look at the navigation on the right:

image

Click “Set up TFS publishing”.

image

So, this uses OAuth and has you log in, you choose the project and voila! When you check in files into TFS, it will do a build and push out changes to this site!

image

Bottom Line:
Well, this is sort of a lot of work. However, I am now basically hosting my websites for free, and I’ve learned a ton about Azure and the TFS (http://tfs.visualstudio.com) – this all works together quite nicely.

I think I covered everything I did – if not or if you have questions, let me know!

Posted in Uncategorized

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

Archives
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 5 other followers

%d bloggers like this: