Skip to navigation

Merb → Mongrel, not Mongrel → Merb

Published May 30, 2008

It might have been blazingly obvious to others but I only just got my head around what a production setup of Merb involves. After wrecking my head dreaming up custom rackup files to run vendor’d edge Merb I finally realised I was thinkin old-skool.

Your typical Rails stack goes balancer → mongrel → Rails.

I naively went upon setting up something similar for a production Merb app: balancer to thin to Merb. This actually works just fine thanks to thin’s baked-in support for Merb… but it’s not really what you want. You’ll also find it hard to use frozen Merb.

Thanks to geniuses that are ezra and yehuda, to run merb in production is actually the same as development—you use merb!

Merb itself hooks up to which ever adapter you want it to speak to the web through… whether it be mongrel, thin, ebb or mycoolnewrackhandler.

so… what you really want to do is: balancer → Merb → thin.

A nice Merb deployment recipe that’s ticking along for me nicely at the moment:

  • nginx for vhosting, asset serving and proxying to the merb instances
  • merb booted using merb-manage
  • the thin merb adapter

Soon I’ll chuck in haproxy for load balancing across merb instances.

Archived comments

Comments were previously allowed on articles. Though no new comments are being accepted you can see the old comments below.

  1. Dr Nic

    Bahumbug. Nothing related to deployment is “blazingly obvious” :) All articles on the topic are justified.

  2. Hugh

    Would thin’s support for unix socket connections still work in this setup do you think?

  3. marcournoyer

    @hugh you can use unix socket w/ thin form the merb script by specifying a path to a socket file for the -h option:

    merb -a thin -h /tmp/thin.sock

  4. Hugh

    @marcournoyer awesome, thin rocks. Thanks :)

  5. Sam Nardoni

    I know this comment is side tracking a little, but passenger (mod_rails) now supports rack. Have you thought about using that?

Thoughts

toolmantim

I’m Tim Lucas, a user experience developer currently in Sydney Australia.

I occasionally write, snap photos, present on various technical topics, tweet my going-ons, share teh codes and post tidbits to the scrapbook.

Most recently I published Simplifying ticket sales on sydneyoperahouse.com (February 16, 2010)

Work with me via Agency Rainford, or shoot an email to and say hello.

Powered by salt water