Tuesday, April 20, 2010

Engine Yard vs Heroku: Getting Started


Today we evaluated Rails cloud hosting offerings from Heroku and Engine Yard. Each company claims you will have your app up and running in minutes. I thought I would take a moment to share our experiences with each vendor.

Here is the Heroku narrative.
Signup was simple. Just confirm your email address and you are in. Free rails hosting without a bunch of BS. And it is a good service. You can't beat Heroku for that. Deployment is simple if you run a vanilla application, but you can run into all sorts of problems if you don't. Heroku applications run in a sandbox where your filesystem is readonly (except tmp). We ran into 2 problems. First, we are using bundler. Normally you gitignore your .bundler directory in your application, but because of the heroku readonly filesystem you have to commit your .bundler directory so when heroku runs bundle install there is a environment.rb file already in place. Another gotcha is that we use sass, which compiles to css. You have to check in the compiled css files for the same reason. There is a gem called hassle (hilarious) that has been created to get around this problem. Finally, we got the app up and running on Heroku. I still give heroku high marks becuase of the free service and the possibility of a simple deployment. My Heroku pro tip: If you plan to go Heroku, deploy the moment you create the skeleton rails application and make deployment a nightly step in your CI server. That way when you introduce some dependency that Heroku hates, you know immediately.

Now for the Engine Yard narriative. Signup is again pretty easy with EY, but you have to have a credit card to do anything because creating an app instance costs 11 cents an hour. Move along freeloaders. No free rides at Engine Yard! Deployment is very customizeable, yet simple. Give them the URL to yout git repo and click "deploy". EY pulls your app and does the rest. While using bundler at Heroku was major ass pain, with EY it is a big benefit becuase you don't have to manually specify the gems on your server. Simply install the bundler gem. Then create a file called deploy/before_migrate.rb in your application. In that file you can call "bundle install", and you are all done! The beauty of EY is that you can use a fancy web interface to do nearly everything, or you can drop down to SSH and hack around at the command line. So though it looks harder because there are more levers and knobs, in the end deployment at Engine Yard is easier than Heroku because the environment is alot like your development environment. There are no magic readonly filesystem or special remote rake tasks. If I want to see what's up with the app I can just tail a log file or run script/console. Overall high marks for EY's customizeability, and ease of deployment. My EY pro tip: go look at "chef" the deployment tool that EY uses on github. If your app has any custom tasks that you need to run before it starts up you can specify them there.

What about cost?
Heroku offers a free service, which is a totally awesome resource for the Rails community. Hats off to Heroku for that. On the downside, with Heroku everything is an add on. 20$ a month to send emails, 100$ a month for SSL, 200$ a month for a dedicated DB. That adds up! EY's cheapest option runs about 70$ a month. A dedicated DB system costs 170$ a month, but there aren't lots of add on hidden costs. The big kicker is that with Heroku you pay lots of money to run a single application. With EY you pay lots of money and get a server which means you can run as many applications on that one server as you like. I think you get more bang per buck with EY.

I know. Blah blah blah, what is the verdict? Well, sorry to dissappoint, but as usual, it depends. If you want it to be free Heroku is the only game in town. If your application is very, very simple or doesn't have any of these constraints, Heroku is probably the way to go. But, if you are willing to pay for it you get more bang for your buck with EY.

Both companies have great offerings. I'd say use both of them. The great thing about being in the cloud is that you are paying on a hourly or per cpu cycle basis. Just turn the server on when you need it. If you aren't using it, you don't pay.

10 comments:

Ezra Zygmuntowicz said...

Thanks for the non biased article. Of course I am sightly biased towards Engine Yard because I built it but I also think heroku is doing wonderful things.

This is one of the most fair and balanced comparisons I have seen so kudos for that. And do let me know if you need any hep getting settled in to engine yard cloud or just want to chat about architecture or how to do things properly on our system.

Cheers-
-Ezra

glenngillen said...

I wouldn't call this entirely fair and unbiased, I'm no Heroku fanboy but I've used it enough to be able to call bull on a few of these points:

- You specify your gems in a .gems file and not in Gemfile. This approach was around way before Bundler and until recently was much better than all the other shoddy gem management solutions out there.
- Sending emails is free (it's $20/month only if you need to send more than 200 day)
- You can access logs and console with "heroku console" and "heroku logs" which personally I find quicker and easier than SSHing onto a server, chdir, etc.

Personally I'd advocate Heroku as a first option, as other factors almost always get in the way of "launching" properly (merchant accounts, testing, whatever) and with EY you're paying for all those cycles if you want to keep your site up. With Heroku you can probably run on the free account until the site is popular enough to actually start covering it's own costs.

Douglas F Shearer said...
This comment has been removed by the author.
Douglas F Shearer said...

As an alternative, one of Heroku's engineers created a plugin that allows sass to compile CSS to the /tmp directory and serve it from there.

http://github.com/heroku/sass_on_heroku

A project I'm currently working on uses this, not had any problems with it.

Unknown said...

I love both of the options, and I love the competition even more. I think it's important to also compare App Engine, as it's now capable of running production Rails apps (2.3.5), as well as Sinatra.

App Engine is closer to Heroku than Engine Yard, as it intends to build a Platform for your applications, without the customization that Engine Yard provides.

App Engine really shines in that it offers all of the services you'd expect (email, caching, blobs, queues, cron, etc) with generous free limits. You can easily run a production app, with all the trimmings, and not a pay a dime.

What's also cool about App Engine: you only pay for resources consumed (literally down to the CPU second utilized). This is different than both Engine Yard and Heroku, which incur charges regardless if anyone is actually using the site (not counting Heroku's free single Dyno, of course).

+1 for options! And I whole heartedly agree with the author... there is no one best option.

Daniel Huckstep said...

I host my personal blog on Heroku, and we host two applications on EngineYard at my work.

Overall, I enjoy Heroku more, because it's even less that I have to think about. I literally drag a slider to scale. Granted this wouldn't work for something like Github, but I'm not working on a Github level app, so who cares. Programming to the Heroku environment isn't a big deal I found. Dealing with gems is no longer a problem either since they support bundler, and it just works.

EY gives you more control because you have a server (or many). EY also supports bundler in that you put a before_migrate.rb file in the deploy directory and tell it to bundle, and it works (as you pointed out).

When it comes down to it, I would honestly try to work my app so I could host it on Heroku, but if that wasn't possible, EngineYard is the way to go for everything else. Those EY guys are smart and if you have a specific itch with your app, they can scratch it.

I really don't want to manage EC2 stuff or physical servers myself.

Shlomo said...

glenngillen,

Thanks for being more specific on some of the points I made. I wasn't trying to say Heroku didn't have a good way of managing gems. I was just mentioning that I had run into problems with using bundler (0.9.19 i think). Bundler is new and changing really fast. I'm sure Heroku will have good support for it when the dust settles from rails 3.

You make a good point about Heroku being great for throwing stuff against the wall to see what sticks. I think it is a fantastic resource for the Rails community and I hope Heroku makes piles of cash so they can keep making it a place where rails developers can get creative and innovate without worrying about the money.

Shlomo said...

sethladd,

+1 for app engine... but I've not kept up to date with it. I didn't realize rails was supported. I assume you run atop Jruby? I've used app engine to deploy a python app called shellsink and it has had great uptime and even though I've exceeded the free quota for disk space the pricing is cheap. I love the simplicity of it, and the challenge of using big table. One nice thing about heroku is the migration path is simple. If I ever want to take my rails app somewhere else there are no constraints, but with app engine you have to develop to the bigtable api, which means some work down the road if I want to move somewhere else because I probably have to port to a relational DB.

Blue Skies!

Jim Van Fleet said...

One other note-- having started a new application on Heroku that definitely had .bundle in .gitignore and no trouble with it-- I recently worked with another application that had the problems this blog post described.

Heroku has a beta "stack" called Bamboo for 1.8.7 and 1.9.1 that addresses this problem (and shouldn't be subject to some of the problems described in the first paragraph. That is present in the documentation, but it's pretty easy to miss. Migrating to bamboo with those docs was no problem.

Anonymous said...

Hi Josh,

Just came across this comparison of yours between Heroku vs Engine Yard. Great article. Wanted to know if you'd like to feature this post on getcomparisons.com? A project we’ve started to house all the best product comparisons on the web under one roof. You can back-link to this original article of course. Check it out, and if you're interested, I will send you an invite.

Cheers,
Akshay Arabolu, Founder