Having played with Rack some, I think I have a firm grasp on the basics of middleware. There are two more things I would like to understand before moving on: running under Passenger and testing with Rack.
Happily, the Passenger documentation includes an entire section on running with rack so this ought to be easy.
First up, I add an entry to
/etc/hoststhat I will use to access the site under Passenger:
127.0.0.1 eee.localWhen working locally with passenger, I like to keep the passenger configuration in my home directory for easy access. I tell apache where to find the local configuration by adding the following to
Include /home/cstrom/repos/eee-code/passenger.confI then create
home/cstrom/repos/eee-code/passenger.confwith the following contents, straight from the Passenger user's guide:
<VirtualHost *:80>I tend to think that public directory is required. Since
tmp/restart.txtis used to restart passenger applications, I think the
tmpdirectory is also needed:
cstrom@jaynestown:~/repos/eee-code$ mkdir publicHopefully, an apache restart will do it:
cstrom@jaynestown:~/repos/eee-code$ mkdir tmp
Hmmm... Not quite it would seem. Inspecting the apache error log, I find:
NoMethodError - undefined method `rewind' for #<IO:0xb71f84b8>:After some googling for passenger on 9.04, I find that I need to upgrade my passenger. I had been using the stock install for Ubuntu (2.0). It looks like 2.2.2 is out now:
/usr/lib/passenger/passenger-spawn-server:46127.0.0.1 - - [06/Jun/2009 21:48:43] "GET /meals/2002/04/21 " 500 30 0.0005
cstrom@jaynestown:~/repos/eee-code$ sudo gem install passengerRestarting apache and reloading the web page, I get another error:
Building native extensions. This could take a while...
Successfully installed passenger-2.2.2
1 gem installed
[Sat Jun 06 22:11:57 2009] [notice] Apache/2.2.11 (Ubuntu) DAV/2 Phusion_Passenger/2.0.3 configured -- resuming normal operationsEw. That look scary.
**** Exception ArgumentError in spawn manager (The 'app_root' option must be given.) (process 29308):
from /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:143:in `spawn_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/spawn_manager.rb:282:in `handle_spawn_application'
from /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in `__send__'
from /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:337:in `main_loop'
from /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/lib/phusion_passenger/abstract_server.rb:187:in `start_synchronously'
from /usr/bin/passenger-spawn-server:19:in `load'
After much googling and trying of various options, I finally look closer at the log output and notice that the backtrace is for Passenger 2.2.2, but apache is loading 2.0.3. That is not likely to be a good combination. So I
passenger-2.2.2gem directory and run the installer:
sudo ./bin/passenger-install-apache2-moduleOnce that is complete (and I have followed the instructions for configuring Apache), I restart Apache and find:
That was a little harder than I expected, but better to find out now than when I am deploying.