Monday, December 31, 2012

TypeScript Node.js Development Part 6 - AppFog Deployment

It's been a long and exciting journey, but we now have a pretty good foundation of a Node.js app, tested and debuggable, deployed to Azure. That's great, but I quickly ran into a problem. Apparently the way that Azure Web Site processes are handled means that long-running processes are not allowed, and are automatically killed after about half an hour. What I was trying to write required a timer going off at a certain interval indefinitely, but there was just no way to get this to work in an Azure Web Site. My only option if I was going to stick with Azure was to use a Cloud Service rather than a Web Site, but that would take me out of the free tier, which is quite unacceptable.

After a bit of searching around, I found out about a service called AppFog. AppFog is a "Platform as a Service" or PaaS provider, which basically means that, like Azure, they take out all the hassle of deploying code to "The Cloud". The way it works is simple, you sign up for an account, and create an app by choosing from a template (Node app, etc) and a hosting provider (AWS, etc). Behind the scenes, AppFog will provision the host and deploy the template code and in minutes you'll have a skeleton website ready to go. And best of all there is a generous free tier.

Once set up, all you need to do is download the template source code from the AppFog console, overwrite it with the code that we've been using in Azure, update the environment variables again using the console, then upload the code using a few simple commands:
gem install af
af login
af update [sitename]

There isn't the nice git integration and ability to view and rollback deployments like in Azure, but it does allow long-running processes, and it seems to be a bit easier to use and much more adaptable than Azure.

And I'll leave this series of posts at that, hopefully someone has learned something from all this and decides to give TypeScript Node.js development a go, it's been fun!

Previously: TypeScript Node.js Development Part 5 - Unit Tests and Debugging.

No comments:

Post a Comment