Even better RVM and Bundler on Dreamhost

So, you have a Dreamhost account, and you want to run a modernish Rack-based application on it. You can do it, but it takes a little work. You don't have root access, and you have to use a few tricks, but it can be done.

I had an old post detailing my setup, but recently something changed on my Dreamhost server, and my setup stopped working. I've fixed things and here's an updated process, as a gist so you can fork it and twiddle if needed. The main thing I needed to change was that I started putting my gems in a vendor/ directory when running bundler. This is the RVM/Bundler setup that I use on to run WhalePail and a few other random project sites. None of them are major sites – they are very low-traffic – so if you're looking for a really good production setup, this probably isn't it. Anyway, here's the setup process:

First, setup RVM and use it to install a version of Ruby essentially equal to what is setup on Dreamhost – 1.8.7 for now. You'll also install bundler here:

Second, in your Gemfile you will need to match the version of Rack currently installed on Dreamhost:

Next, you need to setup your config.ru file along these lines:

Once this is all done, you can install your gems via bundler. I've switched to doing a vendored bundle along these lines:

Finally, if you need to run commands in cron, you might want to do something like this:

Here's the whole gist for your gisty convenience.

Filed under: Code, dreamhost, ruby