Passenger @ RailsConf

Posted 2 months ago by jacques | 20 comments

At their RailsConf session this morning, the Phusion team had some big announcements.

- Passenger version 2.0 will be releasing today

- Ruby Enterprise version 1.0 will be releasing today

The biggest news so far is the immediate availability of support for Rack in Passenger. This means Merb, Sinatra, and any other ruby framework with an adapter now has a braindead easy way to deploy and host with Apache. Since Passenger is now framework agnostic, they have dropped the name “ModRails”, even though I suspect it will be referred to by this name for a long time to come.

Ruby Enterprise is the other big news of the day. It’s a tweaked Ruby MRI (with a terrible name) that vastly decreases memory usage (around 25%) for your hosted app. It uses a strategy called copy-on-write which he explains in his slides (should be available soon). Since memory is at a premium on VPS installations, this is a huge benefit and should allow you to save a decent amount of money right off the bat. The coolest part is their slick installer which takes care of all the setup for you so its a dead simple replacement, and it is perfectly happy to install alongside the normal Ruby MRI installation.

I worked with the Phusion team this afternoon and installed the new Passenger 2.0 and Ruby Enterprise on my SliceHost. Everything worked like a charm as the installer scripts are extremely robust and newbie friendly. I’ll follow up next week with detailed instructions and some stats for memory usage of the new server compared with the old.

With my experience with Passenger so far, I’m finally convinced it’s the best of breed deployment solution for Ruby on Rails apps large and small. Start reading up on it and give it a try.


Add a Comment

or cancel

Reader Comments

  1. Mirko Froehlich 2 months ago
    Pixel

    This is very cool! I was hoping they would add Rack support, but I am surprised that they were able to implement this so soon. My guess is that they were surprised, otherwise I don't know why they would have prominently branded their app as mod_rails. Either way, great news, and I look forward to trying this with Merb and DataMapper.

  2. ActsAsFlinn 2 months ago
    Pixel

    I am amazed by the simplicity that Passenger brings to Rails deployment. I was very skeptical at first but after putting it into production I am a believer. It was simple to install and runs as good or better than what I was seeing with mongrel. I'm psyched and I can't wait to see what 2.0 and Ruby EE brings.

  3. Pixel

    This is the best news I've heard all year! (Rack support for Passenger)

    My only problem is ... I wish you had posted this later. Tomorrow, perhaps? Because I've been refreshing Phusions' site, github tags, rubyforge project, etc every 5 minutes or so since you posted this. I wanna be cryogenically frozen until Passenger 2.0 comes out ... please, let the pain and suffering of impatience end!

    This is _so_ exciting ... I love Rails, but it's simply overkill for so many things ... I love writing little Rack and Camping apps or using Rack middleware for apps, etc etc.

    You bring good tidings, Rails Jedi.

  4. Pixel

    Could someone please convert the slides to a non-proprietary format for the rest of us?

    Seems to be a Keynote file, part of iWork. Can't seem to view it with anything. I would really love to see the slides ... anyone know howto open them without iWork? I would rather not read XML :)

  5. Pixel

    Ninh Bui posted on the Passenger google group that they're still traveling and will release when back in the Netherlands. Public release of the new Passenger and Ruby Enterprise Edition should be in about 4 days: http://groups.google.com/group/phusion-passenger/browse_thread/thread/a2b63650c1b9394

    Meanwhile, the 'trunk' of Passenger of github already supports Rack and WSGI: http://github.com/FooBarWidget/passenger

    Here's the latest documentation which includes howto host Rack apps: http://www.modrails.com/documentation/Users%20guide%20latest.html

  6. Sam Livingston-Gray 2 months ago
    Pixel

    Any chance of getting a PDF export of those slides for those of us not blessed with Keynote?

  7. Phusion dudeski's 2 months ago
    Pixel

    Hi guys, thanks for the support, we're currently standing in the applestore right now to check your responses ;)

    As for the slides, those are not the slides, those are just a mockup of the real slides :-)

    We'll upload the 'accurate' ones later on! So stay tuned.

  8. Wiktor 2 months ago
    Pixel

    pdf version of slides:
    https://dl.getdropbox.com/u/26205/railsconf.pdf

  9. Pixel

    The Passenger currently available on github works great for me except they didn't fully implement rackup files (#use wasn't available for middleware and #map wasn't available for url mapping)

    I fixed it so normal rackup files should work properly via Rack::Builder on my fork ( http://github.com/remi/passenger ), which they'll hopefully pull upsteam.

    AWESOME work by the Phusion folks ... ridiculously easy Rack app deployment :)

  10. Wiktor 2 months ago
    Pixel

    Is it possible to create multiple apps on one domain?
    http://localhost/app1
    http://localhost/app2
    http://localhost/app3

  11. Pixel

    @Wiktor yes. See RailsBaseURI and RackBaseURI in the documentation for howto run full apps at different paths on one domain. If you have a virtualhost setup with the documentroot of /var/www/mydomain.com, you can symlink an app's directory to /var/www/mydomain.com/app and add Rack/RailsBaseURI /app to your virtualhost.

    http://www.modrails.com/documentation/Users%20guide%20latest.html#deploying_rails_to_sub_uri
    http://www.modrails.com/documentation/Users%20guide%20latest.html#deploying_rack_to_sub_uri

    You can specify a BaseURI multiple times ( example just added by Hongli: http://github.com/FooBarWidget/passenger/commit/228d035024e2c4143bf6eb4244e6911b8cb775d4 )

    Now, if you have a few tiny Rack apps that you don't want to require a whole new Passenger process worth of memory for, Rack has its own URL mapping via URLMap or the #map rackup command ... example config.ru:

    require 'my_camping_app'
    app1 = lambda { |env| [200,{},"Hello!"] }
    app2 = Rack::Adapter::Camping.new(MyCampingApp) # in Camping 2.0 you can simply say app2 = MyCampingApp

    map '/hello' do
    run app1
    end

    map '/there' do
    run app2
    end

    map '' do
    run app1 # run app1 for any paths that don't match /hello or /there
    end

    ^ this does the same thing as using BaseURIs with Passenger except it does it at the Rack level so you can run multiple Rack apps in one process. Be warned though, it can be unsafe as the applications have access to one another's constants and may be incompatible with one another. You can use _why's Sandbox to make apps run in their own environments, but then they lose access to your file system and database, etc ( http://macournoyer.wordpress.com/2008/03/21/how-many-applications-does-it-take-to-fill-a-vm/ )

    Rack mapping isn't highly recommended for big Rails/Merb apps, but it should be fine for lots of little Rack/Camping/Sinatra apps, so long as their constants don't overwrite one another, etc.

  12. Wiktor 2 months ago
    Pixel

    Thanks remi,
    I was thinking about setting up a development enviroment this way, as changing virtualhost file, restarting Apache and adding vhost every time I create a new app seem to be a bit complicated. At least I can skip the vhost part this way :-)

  13. Pixel

    @Wiktor yeah, it's a super simple way to get a few applications up and running fast.

    be warned, though. the current official passenger repo doesn't fully support rackup (doesn't support #map/#use) ... I've been in touch with Hongli and he should be pulling the full rackup support from my repo soon ... I think the Phusion guys are traveling.

    If you want to be able to use #map in your rackup file (config.ru) immediately, you can use my fork: http://github.com/remi/passenger

  14. Pixel

    remi,

    Have you actually put a camping app up using passenger and rack? A simple rack proc runs fine, but my camping rackup file just produces a blank page, which work fine using the rackup bin. I'm using the latest passenger and camping off of github and have everything configured according to the latest documentation you linked. Any gotchas you can think of?

  15. Pixel

    @adam

    I'm currently on vacation but I was concerned when I saw your post ... so, over an hour later, I got Apache and mod_rails running on my EEE so I could test a Camping app :P

    Works great for me. Are you using the latest from github? ( @ http://github.com/FooBarWidget/passenger )

    I haven't done any web development on my EEE before tonite, so it's a pretty fresh system. All I did was something like this:
    $ sudo gem install camping fastthread rack
    $ git clone git://github.com/FooBarWidget/passenger.git
    $ ./passenger/bin/passenger-install-apche2-module
    $ ... copy/paste what it says to into apache config & reload apache ...
    $ ... made a quick my_camping_app.rb
    $ ... create config.ru as:

    require 'camping'
    require 'my_camping_app'
    run Rack::Adapter::Camping.new( MyCampingApp )

    Works great for me. I'd love to reproduce your error, tho, so ... a few questions ...

    * What version of camping are you using?
    * Does a super crazy basic camping example work for you? (eg. with 1 simple controller)
    * Are you using the latest Passenger from github? (if not, try again with the latest, and lemme know if it doesn't work ... also, if you're not, did you use the gem? i'm thinking of making a github-compatible gemspec so it's easier for people to get the latest 'trunk' of passenger as a gem ...)

    Thanks! (i'm gonna sleep soon ... if you reply soon, i _might_ not catch it til morning)

  16. Pixel

    @remi

    Thanks for your response. I don't currently have access to the box I was trying to this working on, but I think tomorrow I'll just try starting from scratch like you suggested with a barebones camping app. I noticed you added a gemspec to your fork of Passenger just a little while ago. Awesome! I appreciate your help trying to sort this out. I guess I could just be patient and wait for this all to become official but I just can't resist the urge to serve up my camping apps with the same ease as my rails apps.

    Oh and I was indeed using the latest passenger from FooBarWidget on github and the latest camping on _why's repo. I was able to get some semblance of an app running, but it seemed like all of my problems were routing related. For instance I had my RackBaseURI set to /foo which was a symlink in the DocumentRoot pointing to my camping app. This means http://localhost/foo/bar should go to the controller I configured like this: class Bar < '/bar'
    However, all I receive are 'Camping Problem!' errors for any route I configure.

    In your virtual host did you try the RackBaseURI or just the DocumentRoot directive?

    Thanks again for all your help and insight. I'll post an update if/when I get it working.

  17. Pixel

    @adam

    I've been having the same trouble with RackBaseURI :(

    I tried tracking it down for a little while and it looked to me to be an issue with the application spawner not chdiring propely to the Rack app's root, which was getting passed along as nil ...

    I might give this a try: http://groups.google.com/group/phusion-passenger/browse_thread/thread/c51eb9e220ae499c

    If that doesn't work for you, I'm gonna try tracking this down later tonite as well as looking into the Passenger tests and making sure there's a failing test for this issue we're seeing, so we can red/green/[refactor] it :P

  18. Pixel

    @remi

    Well that is actually good to hear. I am not going totally insane. I think I found the cause for the hairpuller problem I was experiencing all yesterday.

    sudo a2enmod rewrite

    Totally kicking myself for that one...I think this would explain why simple apps would work and apps with more complex controllers/routes wouldn't. When I started setting this up yesterday I did a clean install and totally skipped over this obviously essential step.

    No more routing problems, just some pathing issues with static content, but I know I can figure that out.

    Thanks for all your help. I think I'll start following passenger even though I have no clue how to actually work on it.

  19. Pixel

    @remi

    Looks like I spoke too soon.

    The same old errors are creeping up, but the good news is that it only seems to happen with RackBaseURI. If I use DocumentRoot to point directly to the camping's public folder then everything seems to work fine. So I'm sure RackBaseURI is causing some problems and they might be purely related to the Camping Rack Adapter since when I do use RackBaseURI I receive Camping Problem! errors.

    I'll keep blackboxing this since I'm a complete noob. Thanks again for the help.

  20. Pixel

    This interesting..