The essence of Cloud Computing

Lately, I have been doing a lot of thinking, and talking, about Cloud Computing. Describing it to technical and non-technical people alike can be hard. One great resource I have used is Graham Weston’s post on Cloud Confusion, which gives a great analogy to help clarify the definition of cloud computing.

Today, few of us generate our own power. Instead, we buy it from power companies. These companies generate and distribute electricity from massive centralized power plants that can cost over $1bl to build. Once created, the power travels at the speed of light over the power grid to your home. Cloud computing works the same way, but it comes from companies like Rackspace instead. And, the “power” is the power of computing…

The analogy helps to to describe what Cloud Computing is, but why does cloud computing matter? Graham says because “it’s cheaper and better”. I think there is one more reason why cloud computing matters though.

To steal a line from Now, Discover your Strengths and adapt it to technology, focus on your strengths and outsource your weaknesses.

Every minute devoted to a weakness, is taking a time away from your strengths. The goal of every business should be to minimize the things that take you away from the core of your business. For Mailtrust, it was backups. For your business, it might be email or web hosting.

The funny thing is, this argument has been the main selling point for Mailtrust for a while. Here is a quote straight from the hompage.

As an extension of your IT department, Mailtrust manages and maintains your entire email service in our carrier-grade Rackspace data centers. Our business email hosting solutions free up your internal IT resources, allowing them to focus more on your core business strategies. We strive to alleviate your email system burdens, with reliable email and webmail services at a fraction of in-house costs.

Today’s cloud computing ecosystem has really just expanded on the SaaS services we have grown to love, and included more services, that reach even lower level computing needs that weren’t possible 10 years ago (stupid dial-up modems).

I love not having to worry about backups or web hosting. I want to focus on using my data, not how it is backed up. I want to focus on blogging, not what version of Apache I am running.

What is taking you away from your focus?

New Home – Mosso and Cloud Files

Yesterday, I took the plunge, changed my DNS, and am now on Mosso. Dreamhost was getting slow, and having intermittent outages, so I needed the switch. Not to mention Mosso is another division of Rackspace, just like Mailtrust.

I am super happy with Mosso so far. The blog is faster than ever, and I have had almost no problems. What’s even crazier is I am using CDN Tools to host a lot of my static content on the Cloud Files CDN. I could have done this while on Dreamhost, but it was easier since I already have a Mosso account.

Automation

Setting up Mosso is quite different than Dreamhost, since SSH access isn’t permitted. FTP or SFTP is really the only means to get your code uploaded, so automation is a must. Luckily I love automation, so I got to work on an MSBuild script.

Just to give some background on how my WordPress blog works. I have a SVN checkout of the latest WordPress tag. I also have a few custom files that I want uploaded, in addition to to the WordPress code. Instead of interminginly the custom code with WordPress, I created a custom directory.

My idea for the build was to follow a fairly simple workflow.

  • Update WordPress
  • Export WordPress checkout to a deployment directory
  • Copy custom files to deployment directory
  • SFTP deployment directory

Here is how the majority of the build script came out. You will need MSBuild Community tasks as well as SVN installed somewhere.

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Upload">
  <Import Project="lib\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
  <PropertyGroup>
    <!-- Fill this in with all your info -->
    <CloudSiteFtp></CloudSiteFtp>
    <CloudSiteDbHost></CloudSiteDbHost>
    <CloudSiteDb></CloudSiteDb>
    <CloudSiteDbUser></CloudSiteDbUser>
    <CloudSiteDbPass></CloudSiteDbPass>
    <CloudSiteFtpUser></CloudSiteFtpUser>
    <CloudSiteFtpPass></CloudSiteFtpPass>
    <SvnSource></SvnSource>
    <SvnToolPath></SvnToolPath>
    <DeploymentDir></DeploymentDir>
    <CustomSourceDir></CustomSourceDir>
    <CloudSiteDir></CloudSiteDir>
  </PropertyGroup>
 
  <Target Name="DeleteDeploymentDir">
    <Message Importance="normal" Text="Deleting directory $(DeploymentDir)" />
    <RemoveDir Directories="$(DeploymentDir)" />
    <Message Text="Done." />
    <Message Text="" />
  </Target>
 
  <Target Name="UpdateSource">
    <Message Text="Updating $(SvnSource)..." />
    <SvnUpdate LocalPath="$(SvnSource)" ToolPath="$(SvnToolPath)" />
    <Message Text="Done." />
    <Message Text="" />
  </Target>
 
  <Target Name="ExportSource" DependsOnTargets="DeleteDeploymentDir">
    <Message Text="Exporting $(SvnSource) to $(DeploymentDir)..." />
    <SvnExport LocalPath="$(DeploymentDir)" RepositoryPath="$(SvnSource)" ToolPath="$(SvnToolPath)" />
    <Message Text="Done." />
    <Message Text="" />
  </Target>
 
  <Target Name="MergeCustomSourceCode">
    <Message Text="Copying custom files..." />
    <Exec Command="xcopy $(CustomSourceDir) $(DeploymentDir) /E /Y" />
    <Message Text="Done." />
    <Message Text="" />
  </Target>
  <!-- Upload, BackupDb, and ImportDB targets should go here -->
</Project>

Uploading the data from a Windows machine required a tool for SFTP or FTP. MSBuild Community Tasks have FTP tasks, but I wanted to make sure my data was transfered securely, so I chose SFTP. pscp was the obvious tool because it is the simplest solution to SFTP file transfer on Windows, in my opinion.

<Target Name="Upload" DependsOnTargets="UpdateSource; ExportSource; MergeCustomSourceCode">
  <Exec Command="lib\pscp -r -pw $(CloudSiteFtpPass) $(DeploymentDir)\* $(CloudSiteFtpUser)@$(CloudSiteFtp):$(CloudSiteDir)" />
</Target>

The next step was getting the database working. The database and database user have to be created from the web interface before anything can be done from the client. Once it is created, you can execute commands remotely, so automation is pretty easy. Word of warning, I am one of those crazy’s that run MySQL on my laptop, so access to mysql and mysqldump is required for these tasks to work.

<Target Name="ImportDb">
  <Error Condition="'$(ImportFileName)' == ''" Text="No ImportFileName specificed (msbuild /p:ImportFileName ...)" />
 
  <Exec Command="mysql -h $(CloudSiteDbHost) -u $(CloudSiteDbUser) -p$(CloudSiteDbPass) $(CloudSiteDb) &lt; $(ImportFileName)" />
</Target>
 
<Target Name="BackupDb">
 
  <Error Condition="'$(BackupFile)' == ''" Text="No backupfile specified" />
 
  <Exec Command="mysqldump -h $(CloudSiteDbHost) -u $(CloudSiteDbUser) -p$(CloudSiteDbPass) $(CloudSiteDb) > $(BackupFile)" />
  <Zip Files="$(BackupFile)" ZipFileName="$(BackupFile).zip" />
  <Delete Files="$(BackupFile)" />
</Target>

What next…?

I am still somewhat unhappy that my upload process. It uploads everything, each time. rsync, or something similar, would be awesome if SSH access was allowed. I am pretty sure I can accomplish a dumb rsync over SFTP, but I haven’t devoted enough time to it. The other downside to this is wordpress’s automatic upgrade feature will get overwritten with the next upload. So be wary about automatically upgrading through the wordpress interface.

After that, I want to incorporate data backups before the upload and allow for easy rollback if something fails. After that, I should be set.

DateTime.ParseExact()

Today I used this function for the first time. Somehow, I have never needed this before. It is super simple and very useful though. It is basically the inverse of DateTime.ToString(“yyyy-mm-dd”). It allows you to parse a custom date/time format.

So, for example a Pound proxy log has a date in the format 12/Mar/2009:05:00:36 -0400, which isn’t a standard format in .NET. Using ParseExact, parsing it was a piece of cake.

$provider = New-Object System.Globalization.CultureInfo "en-US"
[DateTime]::ParseExact($line.date, "dd/MMM/yyyy:hh:mm:ss zz00", $provider)

Why I now Twitter?

There are a million reasons someone might start using Twitter. For the longest time, I stayed away from it. Now I am a fairly active Tweet’er. Why you might ask?

I was the outsider.

I know, I am a wuss. I am fine with it. Cameron and Pat finally convinced me I was missing out on something big, and I was.

I signed up, and started Twittaling. To my surprise, I started liking it. In a few hours, I was able to quickly start joining groups (or Tribes as Seth Godin would call them). Interaction within these groups is why I am now a believer. For example, I already blogged about attending Code Camp. I mentioned something huge in that post.

Through Code Camp, blogging, and Twitter I have joined a community of developers much larger than Mailtrust’s.

I am now actively participating in a new group after this weekend. If all the presenters just had blogs (which many of them did), I don’t think this would have happened. Why? Because most people don’t blog often. And second, when people do write something it is usually a few minute committment to read.

I blog to teach and learn.

I Twitter to participate.

Don’t worry though. I love blogging, and still plan on blogging the same amount. Where blogging lacks in interaction, it has much richer content. I can’t learn what DDD is on Twitter. I can by reading some good blogs.

Re: Roanoke Code Camp

I attended my first Code Camp this past weekend. Overall, it was a great experience, although for a few reasons you might not expect. I learned a little about new .NET features, but the biggest benefit for me was the networking. My code community, for the most part, revolves around Mailtrust. Through Code Camp, blogging, and Twitter (I will blog on this later, since you might remember my last Twitter post) I have joined a community of developers much larger than Mailtrust’s.

This is a good thing.

With that being said, I did really enjoy learning a few things.

  • WPF is pretty wild, especially with Blend. Let designers design interfaces directly, and developers just make it work. This isn’t the first time this concept has been tried out, but it works pretty damn well from what I saw.
  • .NET 4.0 – Oh ya. I loved that stuff. Learning about dynamic, DLR, and language enhancements is my crack.
  • PEX and Code Contracts – Good concepts (but some things I didn’t like)

What could be improved on?

  • Don’t shun open source. NHibernate and NUnit are great tools, and we shouldn’t ignore them because Microsoft is competing with them ( Entity Framework and Unit Testing Framework).
  • More code. Powerpoint should be banned.
  • Don’t trivialize the importance of good testing. Pex is really an amazing concept, that can complement testing, not supplement (Yes, I love trig).

It was a great experience though. I am looking forward to more RVNUG involvement, as well as my next Code Camp.