Installing the latest MongoDB package on Engine Yard’s AppCloud



by Jay Fajardo

We’ve recently moved most of our projects to Engine Yard because of its rails centric awesomeness.

While Proudcloud codes with Rails 3.0.0, Ruby 1.9.2RC and the latest builds of MongoDB/Mongoid, being on the edge does have its drawbacks when using hosting providers who need to play it safe with stable package releases.

When deploying Rails 3 Mongoid based apps on EY’s AppCloud, we discovered that;

  • EY does not support MongoDB out of the box and requires custom chef recipes;
  • You need to create a custom cluster of instances with MongoDB installed on a utility instance;
  • EY’s latest installed binary of  MongoDB version is 1.4.4 while Mongoid 2.beta.17 requires >= 1.6.0.
  • There’s no documentation anywhere to help you with this issue.

Getting MongoDB on Engine Yard

As a backgrounder, Engine Yard has custom recipes that will allow you to install MongoDB (and other packages) on AppCloud. The recipes can be found on github, with specific instructions for MongoDB here.

Remember though to un-comment the reference to MongoDB in cookbooks/main/recipes/default.rb.

The ridiculously simple solution: Portage

Trying to make various Mongoid versions and dependencies play well with 1.4.4 and Rails 3.0.0 failed miserably. EY support suggested we tweak the emerge recipes to retrieve the desired build and have the package installed during the EY deploy.

Jason Torres, who has a black belt in rails app deployment, thought otherwise and discovered a simpler approach.

Going into your utility instance’s shell, you’ll find the various Gentoo Portage package definitions for MongoDB in /engineyard/portage/engineyard/dev-db/mongodb-bin/. We wanted the latest MongoDB build which was 1.6.2 at the time of this writing.

The trick is to have Portage retrieve the latest MongoDB build. To do this, Jason merely copied the .ebuild definition for the latest build to another file, making sure that the target filename included the desired build version number.

sudo cp /engineyard/portage/engineyard/dev-db/mongodb-bin/mongodb-bin-1.4.4.ebuild /engineyard/portage/engineyard/dev-db/mongodb-bin/mongodb-bin-1.6.2.ebuild

When you run the emerge command, Portage determines the build version from the filename. Given this, the next step would be to simply execute emerge on the .ebuild file with the –digest parameter. This would add it to the Portage tree.

sudo emerge /engineyard/portage/engineyard/dev-db/mongodb-bin/mongodb-bin-1.6.2.ebuild --digest

The last step would be to restart MongoDB.

sudo /etc/init.d/mongodb restart

note If you had not yet installed any MongoDB version on your instance, you can start instead with the Portage steps (sans MongoDB restart) and then proceed to the instructions for custom recipes.

So go ahead and get rockin’ with the latest Mongodb+Mongoid on Engine Yard.

3 responses to “Installing the latest MongoDB package on Engine Yard’s AppCloud”

  1. #1. ehcache.net on March 17th, 2011 at 8:07 pm

    Proudcloud − Installing the latest MongoDB package on Engine Yard’s AppCloud…

    We’ve recently moved most of our projects to Engine Yard because of its rails centric awesomeness. While Proudcloud codes with Rails 3.0.0, Ruby 1.9.2RC and the latest builds of MongoDB/Mongoid, being on the edge does have its drawbacks when using host…

  2. #2. Brandon Hansen on July 20th, 2011 at 5:11 am

    According to The github page 1.8.1 is now supported via the chef recipe.

  3. #3. Justin on December 22nd, 2011 at 1:55 am

    I recall reading somewhere that the i686 version was not to be used (I think in one of the Chef recipes) but when I use your technique it says Saving to: `/engineyard/portage/distfiles/mongodb-linux-i686-2.0.2.tgz’.

    Concerned about that, but otherwise very helpful post.

Leave a Reply