Introducing Passenger for Ruby on Rails
May 13, 2008 on 10:56 am | In Insider View, New Features by Dallas Kashuba | 46 Comments
As of right now all DreamHost customers have a new option for hosting Ruby on Rails applications.
Awhile back I asked for a better way to host Rails applications on a shared server, and the answer has come in the form of Passenger (also known as mod_rails)! From now on, deploying a Rails application may very well be as simple as ‘Upload’. Passenger automatically detects the presence of a Ruby on Rails application and launches it for you in the background, leaving it running for the subsequent requests. It provides the dynamic process management that FastCGI provides but it’s ‘Rails-smart’ and (gasp!) actually works.
After I wrote my Ruby on Rails rants back in January, stirring up the pot and getting people talking about the deployment issues involved with Ruby on Rails applications, I was contacted by a few smart people who were all interested in helping work on the problem. The guys behind Passenger were among those people (the guy who came up with the also excellent Switchpipe was another), and they described their software concept to me via email. On ‘paper’ it sounded excellent but honestly I expected to never hear from them again. I didn’t think these random people with a graffiti logo would manage to get it finished and working.
I’m so glad to have been proven wrong!
The Phusion team contacted me with a working test version of Passenger a couple of months ago and since then DreamHost has been helping out with testing and ironing out lingering deployment issues. The Phusion team has been very helpful and responsive throughout the process and I think we will see a lot more great things from them in the future.
Now to the important part… how do you use Passenger on DreamHost?
Briefly, all you do is enable the Ruby on Rails Passenger (mod_rails) option for any existing or new web domain in the DreamHost web control panel. When you then point that domain’s web directory to the public directory of an existing Ruby on Rails application it will work automatically. For more detailed information, check out our Passenger wiki page.
46 Responses to “Introducing Passenger for Ruby on Rails”
Powered by WordPress. Pool theme by Borja Fernandez, modified by DreamHost.
Like WordPress? Consider attending WordCamp LA.
Entries and comments feeds.
^Top^

May 13th, 2008 at 11:08 am
How arrogant are you.
May 13th, 2008 at 11:31 am
I was waiting for this ever since I heard you guys were part of the Alpha. I’m a very, very happy customer now. :-)
May 13th, 2008 at 11:47 am
As someone who’s been through most of the deployment options on dedicated servers and having tried various things on DreamHost, this is a JOY to see.
I’ll be testing it out this weekend, but my experience with dedicated servers and mod_rails thus far has been just upload and go. It really works.
May 13th, 2008 at 12:42 pm
That logo is a clusterf*** of ugly
May 13th, 2008 at 1:05 pm
I do have a quick question (and I know this isn’t support area, but perhaps someone will know or happily reply):
I really dig the idea of being able to deploy a Rails app. However, I wouldn’t mind being able to do that not at the root of my domain.
So, for example, my hosted site with dreamhost is randomthink.net – which is currently a wordpress blog.
if I wanted to push out a Rails app under randomthink.net/somedir – can I do that with passenger? Or do I have to create somedir.randomthink.net and put the rails app there directly under the web root?
May 13th, 2008 at 1:15 pm
Works fine for one of my toy apps in melrose. Congrats!
May 13th, 2008 at 1:49 pm
@Brian: Yes that is possible. I did exactly that when I wanted to test Passenger on my local machine. I don’t think it’s possible right now on Dreamhost, but you never know.
In theory, you should be able to specify that a subdir is a Rails app inside a simple .htaccess.
May 13th, 2008 at 1:59 pm
Once we get mod_rack I’ll be a double-happy camper.
w00t
May 13th, 2008 at 3:49 pm
I just tested it and it works find.
It’s easy, fast, and stable.
I love DreamHost.
May 13th, 2008 at 5:49 pm
Some excellent news, working painlessly for me now.
Just one silly question. On the wiki page it mentions a “tmp/restart.txt” file. How do we create that, is it possible to see an example?
May 13th, 2008 at 5:50 pm
Does anyone have any info on how to get passenger to work with my custom gems (.gems) in my user home directory?
Seems like this could mean more stability at the cost of loss of gem customization…
Any tips greatly appreciated!
May 13th, 2008 at 6:08 pm
@Brian #5 : It is possible to do that with Passenger but we have not exposed that functionality in our web panel. Our support team can set it up by hand for you if you like. Passenger is new to them so be patient, though.
@ #10 : You just create the file through FTP/SFTP/SSH within the base of your Ruby on Rails application. Create a directory called ‘tmp’ if one isn’t already there and then create a file called ‘restart.txt’ within it. The restart.txt file doesn’t need to contain anything.
May 13th, 2008 at 6:34 pm
One problem I’ve found. Accessing the analog web stats no longer works with this rewrite rule
Posted an example of the fragment here
http://www.suture.net/files/htaccess_fragment.txt
May 13th, 2008 at 7:58 pm
@11 : you basically install them somewhere then change some variables in your environment.rb so that you use the new gems.
ref:
http://www.bluehostforum.com/showthread.php?t=9838
http://helpdesk.bluehost.com/kb/index.php?x=&mod_id=2&id=418
kind of describes it,
May 13th, 2008 at 9:09 pm
These instructions are too simple for me to understand, please explain…
I have an existing rails site running with fastcgi, so I have my .htaccess file already setup to pass all requests over to dispatch.fcgi. Simply enabling passenger in the webadmin panel doesn’t visibly change anything, is it supposed to?
The passenger wiki page isn’t too helpful either. Is there a “for dummies” version?
May 13th, 2008 at 10:23 pm
This is GREAT NEWS. Really. I mean. It’s one of the best things I’ve ever heard from you guys, and I’ve heard a lot of good things.
May 13th, 2008 at 11:25 pm
This is great! Thank you, Dreamhost! :)
May 13th, 2008 at 11:49 pm
Is it just me, or is this faster now? Or does it just feel faster to me because I want to think that it’s faster?
May 14th, 2008 at 12:54 am
Rails is always just a part of a Rails website tho. I always wondered about the rest of the installed gem ecosystem for stuff like image uploads etc on Dreamhost. Is there some sort of more in depth FAQ that I’m missing describing what to do about this?
TIA!
May 14th, 2008 at 7:01 am
@14:
Roger, I have this set up already in my environment.rb (it’s how I have the site running behind FastCGI already), and switching to passenger broke my dependencies… so seems like there is some other magic involved in getting passenger to play nice with user-local gems…
May 14th, 2008 at 7:24 am
This is AWESOME guys and gals!!! Thanks ever so much for taking this on!
May 14th, 2008 at 8:59 am
@11, 14, 20
I used the “Vendor Everything” technique to include Haml for my app (just tested & works with Passenger). It’s really painless and you don’t have to custom install gems. I had done that in the past and it gets hairy.
http://errtheblog.com/posts/50-vendor-everything
Thanks Dreamhost for getting this up!
May 14th, 2008 at 9:59 am
Awesome! The Phusion guys are definitely shaking some ground here :-)
May 14th, 2008 at 10:10 am
Not working for me, unfortunately. Got a 500 error…
Regarding this part of the documentation:
This feature does require that your domain is being hosted on an Apache version 2 server. If that is not already the case our web panel will migrate it for you. If that is necessary it will take a few extra hours for the necessary DNS change to take effect.
How does one determine if they are on Apache2?
Also, should I disable FastCGI and rip out the things in there to make it work? I don’t see anything about that in the 2 step process…
May 14th, 2008 at 10:35 am
by the way, the error i’m getting is this:
[Wed May 14 10:42:40 2008] [error] [client xx.xx.xx.xx] *** Unexpected error in Passenger: write() failed: Broken pipe (32)
Can’t really find much documentation on this…
May 14th, 2008 at 10:37 am
By the way, the error I’m receiving is this:
[Wed May 14 10:42:40 2008] [error] [client xx.xx.xx.xx] *** Unexpected error in Passenger: write() failed: Broken pipe (32)
Not able to find much documentation on this just yet…
May 14th, 2008 at 11:24 am
Good news for Dreamhost.
Considering how much financial gain this type of solution could mean to Dreamhost, I certainly hope that Dreamhost has done right by Phusion in terms of compensation.
All of us have a responsibility to support open source developers but companies who make money off of their work have an extra special moral imperative.
May 14th, 2008 at 1:00 pm
That’s awesome guys! Thanks for playing beta tester!
May 14th, 2008 at 1:16 pm
Awesome. Now idiots like me can deploy Rails apps themselves!
May 14th, 2008 at 6:10 pm
GOOOOOOOOO DREAMHOST, HURRAY!
Chance of the mod_rewrite rules that won’t be followed with mod_rails is activated being posted to the wiki?
May 15th, 2008 at 11:27 am
Just to follow up, the broken pipe error was taken care of via a DH ticket. Seems like I wasn’t the only one affected. Working smoothly now. Nice job!
May 15th, 2008 at 11:51 am
Thanks for adding this.
With Passenger, will the Rails setup ignore the dispatch.fcgi directives that I had already set up to allow smooth operation of my Rails site?
And how do I know the site is serving under Passenger?
May 15th, 2008 at 1:45 pm
i like your sketch animation its very street which is always good.
Thanks for the update on the information not sure what the guy calling you arrogent is all about :S
May 16th, 2008 at 6:15 am
Josh!
Dreamhost. best host i’ve had yet and have transferred 14 domains over here so far. But I’m getting nervous about having all my eggs in one basket. ’specially since all of a sudden my ftp isn’t working right.
When you just gave your schpeel on the “other” host it was all about customer service. So far, I’ve not been over impressed with the customer service here. It’s average. I’m not complaining, I’m just not bragging about it.
Many other hosts give there customers 24/7 phone or chat tech support included in ther hosting package. They don’t prevent certain named files from being ftp’s to the server because it appears that it may be a risky file and cause problems.
Now I have to pay $9.95/month to talk with someone to get all my problems straightned out because I’m not good at reading and following directions. I’m better at visually/listening and doing the steps.
So, while Dreamhost dominates in many areas, it is just average in others. You want bragging rights all across teh board? Keep working at it.
Thanks
May 16th, 2008 at 12:16 pm
We will update our documentation as questions come up, but just for everyone asking, Passenger completely disables mod_rewrite rules itself (by default) so your existing dispatch.fcgi setup will be ignored. It will also have some side-effects as one of the other commenters noticed. We can re-enable the processing of mod_rewrite rules manually for you but you will have to be more cognizant of using only mod_rewrite rules that will not break your Rails app. Contact our support team if you need that set up for you.
May 18th, 2008 at 9:51 pm
Their logo is unfortunately the least ugly thing on their site.
May 19th, 2008 at 1:06 am
Yesterday, my shared hosting was upgraded to PS.
The first page of mod_rails on PS takes 10 seconds to load.
It was only 3 seconds on shared host.
Is it because I have only 150MB RAM?
I also wonder why the mod_rails process is killed on PS as it is on shared host.
If I visit the rails site after hours idle, it takes 10 seconds to load.
I am seriously considering to return to shared hosting.
May 19th, 2008 at 12:28 pm
@Sam Kong: Please refer to the ‘RailsPoolIdleTime’ configuration option in the manual.
May 20th, 2008 at 4:40 pm
@Sam Kong: We have not yet fine-tuned the Passenger settings for DreamHost PS servers. We’ll be making some adjustments there very soon. Please feel free to contact our support team to provide more information about your particular situation.
May 21st, 2008 at 6:31 pm
I’ve enabled Passenger and Fast CGI on my website and I have major problems with the load time of it. Most of the time, it takes from 20-30 seconds (!) for the site to load after it’s been idle. It runs *okay* after that, but I don’t know for how long before rails goes idle again.
Help!
I’m running Radiant CMS.
May 25th, 2008 at 8:51 am
I have tried running under Passenger for a few days but have found that sometimes my website suddenly becomes totally unresponsive. Looking at the top of my server i see a rapidly growing list of apache2- processes and the only way to fix it has been to reboot the server.
Seems like i am going to revert to fcgi until these issues are fixed.
June 1st, 2008 at 1:07 am
Once we get mod_rack I’ll be a double-happy camper.
w00t
June 22nd, 2008 at 3:28 pm
Dallas,
First off, I would just like to thank you guys for working with the Phusion team to get this working. Once you guys decided on this I finally saved up the $500 to host with you guys for 5 years.
So far thing have been so incredibly easy for me. It takes me nothing to get an app to production. I am currently in the process of converting all my domains over.
One quick question/request… I have tinkering around with Merb and Datamapper lot lately. I was wondering if you guys are going to help test Phusion’s Passenger 2.0 release? You know the release with mod_rack support! I would love to jump on this boat with you if possible.
I really think it would be a benefit to Dreamhost, if more people used Merb. Its just a more efficient framework, and will save valuable resources in a shared hosting environment.
Please let me know, or at least direct me in the right place to stay up-to-date and informed for this process.
Thanks
taelor
July 15th, 2008 at 2:23 pm
vote_passenger2 += 1
I to would be very happy if dreamhost would support Passenger 2.0.1. And I’m sure dreamhost would be happy to see its customers user fewer resources by switching to merb.
Win – Win
October 15th, 2008 at 2:45 am
Thank you.
December 21st, 2008 at 9:53 pm
@mod_rack fella: wish granted with latest releases. mod_rails just goes and goes…