24 Hours with AppHarbor

So yesterday morning I finally got around to using AppHarbor. I figured out an app I would like to attempt to deploy there and see what I thought about it after messing around with it for a day or so.

What is AppHarbor?

At the moment on their home page they have in very large letters “Azure Done Right”. AppHarbor is cloud deployment for .NET applications. You can spin up more instances of your app if you are having issues with load, you can create workers that do stuff, you can configure databases (first is free). If you have used Heroku and think this sounds familiar, you are right. It reminds me of Heroku as well.

How Does It Work?

Okay, so this is where it gets CRAZY. If you are a Git user, you will be very happy. Let’s say you have a repo hosted up on Github. Pushing things to that repo generally involves this command:

git push origin master

But you know that. Here is where AppHarbor rocks. If you want to deploy your application, you set up your repo with a new remote and do this.

git push appharbor master

I love that. The more deployment equals checking in to source control, the more awesome deployment is.

What Have You Done?

So I started with AppHarbor yesterday. The first thing I did is create an ASP.NET MVC project, check it into source control and pushed it. Worked like a charm. That was yesterday morning before work.

At lunch I took the time to see if I could get a database setup. So I went into the console and created a db. That was easy. To figure out connection string stuff I used lazytwitter and @JohnSheehan pointed me to their support site which I should have read first. I shouldn’t be so lazy. So with connection strings, if you check in your connection string to your repository, when you push it to AppHarbor they will replace it automagically with the one for prod. Cool beans. Anyway, so I then wrote some codez that hit the db, pushed it to AppHarbor (like I showed above), used Sql Management Studio to open the remote db and push my schema and boom, everything was working like a charm. So that was lunch.

After work I decided to push an image so I could get a logo (at Content/logo.jpg) up on the page. I hit my first snag. For some reason on the remote machine it was blowing up because it was trying to find a controller for “Content”, which doesn’t exist. I messed around with trying to get it to ignore the route but to no avail. I must have tried 20 things last night (my commit log makes me look like an idiot) but couldn’t get it working, so I asked a question on the support site. By the time I woke up this morning there was an answer. I am glad Troels answers questions in the middle of the night. Anyway, I solved it by adding the image to my project and re-pushing as he suggested. I still don’t understand why this is necessary but I don’t mind it. Still waiting on the "why" with that question.

So the last thing I did this morning was to add a class library and configure two NUnit tests, one passing, one failing. I wanted to see if their claims to deploying only if the tests pass was true. I checked those in, pushed and looked at my online dashboard. Sure enough, my last check-in had a big fail and didn't get deployed. Awesome.

And The Conclusion Is…

So I was able to create a basic site, with source control database and testing and then deploy on a platform I hadn’t used before in just a few hours. Putting it simply, I LOVE that. Oh, and it doesn’t cost me anything :)