Phusion’s One Year Anniversary Gift: Phusion Passenger 2.2.0

Tháng Tư 17, 2009

Source: http://blog.phusion.nl/2009/04/16/phusions-one-year-anniversary-gift-phusion-passenger-220/

This month is a very special month for Phusion. Not only was it one year ago that we posted our ideas on getting Ruby to work on all PHP platforms (RAHP) as an April fools joke, but it was also the month that Hongli and I officially founded Phusion, the Computer Science company at the Dutch chamber of commerce. Needless to say, seeing as this is Phusion’s first year anniversary as a company, we felt strongly inclined to go the extra mile and make this one count. Instead of making yet another April fools joke, we wanted to take the opportunity to announce a long-awaited addition to our Phusion Passenger line-up. In a way, I guess the joke would be that this really isn’t a joke. :-D

We are glad to announce…

Phusion Passenger for Nginx

Ever since the first release of Phusion Passenger for Apache, some people have been asking us to create a Phusion Passenger for platform XYZ. Well, it may come to you as no surprise but we’ve been playing with similar ideas for quite some time. In fact, we’ve architected Phusion Passenger to be as independent from any specific web server as possible to make something like this an option to consider to begin with.

For us however, maintaining a product to live up to the high quality standards that you’ve come to expect of our products requires a lot of time and effort. Maintaining multiple versions of a project won’t exactly lower this amount of required effort and with limited resources in mind, this made us a bit reluctant on doing something like this from the start. Instead, we chose to focus our efforts on polishing up one version before ever deciding to make the jump to another server platform, a choice from which we’d be able to reap the fruits from in tenfold. Not only in terms of experience, but also in terms of having a more robust and solid code base to work from.

Even though we would be able to share a lot of code between different server versions from an architectural point of view, this would only be a small benefit compared to the work that would still be required. Not only would a fair deal of specific code need to be written but also maintained and documented. This process in particular is painful if the server software you’re writing it for doesn’t have any documentation itself, which became all too apparent for us in some particular cases.

Despite being able to successfully create several versions, we weren’t able to infer significant benefits over the Apache version, both from a technical point of view as well as from an ease of use point of view. In fact, in past articles we’ve elaborated on both points quite a deal and had decided not to pursue its release in favor of polishing the core foundations of Phusion Passenger first and foremost. However, reasons like these usually only play a small part in the choice of technology. Company policies and dependencies of other software usually play a bigger part in deciding this, and with this in mind, Apache might not always be an option. In this regard, we’ve always wanted to accommodate the largest denominator and it is for this reason that the initial version of Phusion Passenger and the ones that followed were exclusively for Apache. Until today that is.

A few weeks ago, as you may still remember from the comments in this article, Ezra of Engine Yard contacted us on the possibility of financially sponsoring a first release of Phusion Passenger for Nginx. Even though we had already written the majority of the code for Nginx Passenger quite a few months ago, we didn’t feel it was the right time to release it back then.

By the time of this writing however, Phusion Passenger is almost one year old and as mature as it has ever been thanks to all the contributions people have made during this time. With this in mind, we decided to accept Ezra’s offer.

After spending weeks on further development and intensive testing, we’ve now come to the point wherein we have the distinct honor to announce Phusion Passenger for Nginx as an addition to the Phusion Passenger server line-up.. Our thanks goes out to Engine Yard for financially sponsoring this first release of Phusion Passenger for Nginx, as well as all the people who have in some way donated in the past for making this release possible in the first place.

Great, how do I get started?

Geoffrey Grosenbach of Peepcode fame has kindly created a screencast for us. This screencast covers everything you need to get started with deploying a Rails/Ruby web application on Nginx using Phusion Passenger.

Nginx screencast by Geoffrey Grosenbach

In a nutshell, you first need to install the Phusion Passenger gem:

sudo gem install passenger

(Note: Rubyforge might still be updating their mirrors. If the above command didn’t install 2.2.0 for you and you can’t wait, then download the 2.2.0 gem from Google Code)

Both the Apache and the Nginx version are contained in the same gem, which keeps things nice and simple!

Next, you need to run the passenger-install-nginx-module command, similar to what you’re used to when installing the Apache version:

sudo passenger-install-nginx-module

Nginx doesn’t support loadable modules like Apache does, so it needs to be compiled from scratch. But the installer can do this for you as well! You can of course also choose to compile Nginx manually. Once Nginx has been compiled and installed, the installer will tell you how to configure Nginx and how to deploy a Rails application on Nginx. A typical deploy server bock looks like this:

server {
    listen 80;
    server_name www.foo.com;
    root /webapps/foo/public;   # <--- notice the 'public' part
    passenger_enabled on;       # <--- don't forget this!
}

We’ve also spent a lot of effort on documenting Phusion Passenger for Nginx. For detailed installation instructions and usage instructions, please refer to the users guide for Nginx.

If you prefer to install Phusion Passenger via the source tarball instead, then that’s also possible. Please read the included README for installation instructions.

Where to report bugs

If you’ve found a bug, please do not post it in a comment, but file an issue on our issue tracker instead.

Other changes

In addition to bringing you an Nginx version of Phusion Passenger, we’ve also made improvements in the Apache version. The most important changes are:

Support for chunked file uploads
Resource-limited HTTP clients, such as mobile devices, often send HTTP file uploads using the “chunked” transfer encoding in order to save resources. Previous versions of Phusion Passenger didn’t support this, but now it does! Please note that chunked file uploads is only supported in the Apache version; the Nginx version doesn’t because doesn’t support chunked file uploads.
Support for Capistrano-style deployments
Whenever you deploy a new release with Capistrano, previous versions of Phusion Passenger will leave the application processes of the last release running until they idle timeout. This includes the old release’s ApplicationSpawner server process. This is caused by the fact that Phusion Passenger uniquely identifies an application based on its canonical path, meaning that any symlinks in the paths are fully resolved. In Capistrano-style deployments, the ‘current’ directory is actually a symlink to a release directory, so every time you deploy a new release, Phusion Passenger thinks that it’s a totally different application. 

This issue has now been fixed, and Phusion Passenger no longer resolves symlinks anymore. So whenever you deploy a new release with Capistrano, Phusion Passenger will properly detect it as being the same application. If you had any hacks in your deploy.rb for killing off old processes, then you can remove them now!

Ability to load application_controller.rb from non-standard directory
In some applications, application_controller.rb is located in the search path, though not in app/controllers. Support for this kind of setup has been fixed.
Worker process event hooks for Rack
The :starting_worker_process and :stopping_worker_process event hooks have been implemented for Rack as well. Thanks to Saimon Moore.

Some final words

We initially planned to announce this release at the coming Railsconf, but the temptation was just too big to announce this on our very first anniversary. Also, if all goes as scheduled, we may have an even bigger announcement at Railsconf, so stay tuned! ;) Follow us on Twitter too to stay in the loop ( @phusion_nl )

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s

%d bloggers like this: