Blog Post RSS ?

Blogs » Ruby on Rails » Smooth your deployment with Passenger
 

Smooth your deployment with Passenger


  • Save to
    Del.icio.us

by Myles Eftos

I alluded to the release of Phusion’s Passenger (AKA mod_rails) - an Apache module that can run multiple Rails sites, just as PHP does. The significance of this is pretty huge. Up until now, running rails has required running Mongrel behind an Apache proxy or using FastCGI (or preferably fcgid).

Although Mongrel did a sterling job, I have never been a big fan of having two points of failure - problems with either Apache or Mongrel would render your site unreachable. Not only that, adding capacity to your system required adding a number of mongrel instances, each with it’s own port and each with it’s own memory overhead, which can get very messy for shared hosting providers.

Passenger will allow hosting providers to install one Apache module, requiring the client to simply upload their application - no permission issues, or troublesome configurations files. However, it is also very useful for a developer - instead of having to run script/server when testing your application, you can install a local version of Apache, setup a few virtual hosts, and have instant access to your test sites.

Currently, Passenger only runs on *NIX type environments, eg Linux and OSX. The Phusion team have worked pretty hard to make the installation as simple as possible. Here are the basic steps:

  1. Install Apache (check with your vendor for instructions)
  2. Run gem install passenger
  3. Run passenger-install-apache2-module

Passenger should now ask you a few questions, which if you answer correctly, should complete the installation.

Restart Apache and create a virtual host file, which points at your Rails application, and you are away! The following virtual host file will tell Apache to respond to the url http://test.localdomain with the Rails application in /home/sites/test.

<VirtualHost 127.0.0.1:80>
    ServerName test.localdomain
    DocumentRoot /home/sites/test
</VirtualHost>

If you are using passenger for development, make sure your apache2.conf file has the line RailsEnv development.

Tags: ,

This post has 6 responses so far

  1. Hey Myles — any chance you know anything about when they might have a version for Windows available?

     
  2. Although mentioning PHP or Python is a good publicity for Ruby, I think mod_rails should not be compared to mod_php. Harry Fuecks explained this a couple of years ago, but there’s still some confusion about it.

    “PHP is optimized to that environment. By contrast Perl, Python and Ruby are general purpose languages and optimized to different requirements. The web is just another platform they support, compared to PHP where the web is the primary platform.”

    Learn more about the execution model. With a good execution model, your can develop large-scale applications.

     
  3. jdl: Not sure - All I’ve heard is “it’s coming”.

    php_impact: I disagree. Ignore the fact that PHP is a language and Rails is a framework for a moment (remember that mod_rails only works with Rails, not general Ruby making it a fair comparison), how is PHP any more web-centric than Rails?

    Rails has been designed to make building database-driven web applications, and now with mod_rails it is as easy to deploy as PHP is. I think this is very significant step towards Rails becoming a mature platform.

     
  4. Yes, I completely agree, it is a very significant step towards becoming a more mature platform, no doubts about that.

    I was referring to this article.

     
  5. phpimpact: That is exactly what mod_rails brings to rails :)

    Admittedly, the model modrails uses is probably closer to the ASP.NET Application Pool model - there is a live rails process always running.

     
  6. (Note: I’m from Phusion => I’m one of the Passenger/mod_rails developers)

    Hi Myles. It’s good to know that we’ve caught Sitepoint’s attention. Passenger was written with shared hosts in mind. I’d like to let you know that we’re going to publish a series of articles about memory usage and startup time in Rails, and what Passenger does about that in order to make Rails more suitable for shared hosts. We think that you might be interested that, so please keep an eye on our blog for updates. :)

    @madpilot, @jdl:
    It’s not “it’s coming”. Actually, it won’t be “it’s coming” for a long time. We have no plans to support Windows for the forseeable future. This is not because we’re ***holes who want to screw over Windows users, but because Windows lacks the infrastructure and capabilities to implement Passenger efficiently.

     

Sponsored Links

Leave a response

You are not logged in, log in with your SitePoint Forum username and password.

-OR- Post Anonymously

* Make sure any code samples are escaped (i.e. ‘<b>’ becomes ‘&lt;b&gt;’).

If not logged in, your comments will be placed in a moderation queue. This means your comment may not appear until one of our moderators approves it.

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Logo Design, Web page Design and more!

99designs

  • Custom logo designs created ‘just for you’.
  • Pick the design you like best.
  • Only pay if you’re satisfied with the result.

Want More Traffic?

Get up to five quotes from qualified SEO specialists, with no obligation!

Get A Free SEO Quote Now!