Update:
- the basic installation can be done via “passenger-install-apache2-module –auto”
- a better script that does the whole job can be found in cap-recipes
Took me some minutes to figure this out, so here for your laziness-pleasure (for Ubuntu):
Usage
To install passenger or update to the newest release:
cap install_passenger
Install
#deploy.rb desc "Install Passenger" task :install_passenger do install_passenger_module config_passenger end desc "Install Passenger Module" task :install_passenger_module do sudo "gem install passenger --no-ri --no-rdoc" input = '' run "sudo passenger-install-apache2-module" do |ch,stream,out| next if out.chomp == input.chomp || out.chomp == '' print out ch.send_data(input = $stdin.gets) if out =~ /(Enter|ENTER)/ end end desc "Configure Passenger" task :config_passenger do version = 'ERROR'#default #passenger (2.0.3, 1.0.5) run("gem list | grep passenger") do |ch, stream, data| version = data.sub(/passenger \(([^,]+).*/,"\\1").strip end puts " passenger version #{version} configured" passenger_config =<<-EOF LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-#{version}/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-#{version} PassengerRuby /usr/bin/ruby1.8 EOF put passenger_config, "src/passenger" sudo "mv src/passenger /etc/apache2/conf.d/passenger" end
Source
Basic recipe
Thanks for the script… made a couple small changes to get it to work in our system in case anyone was having the same problems:
First, used the unix “yes” command to unlock the run in module install as follows:
run ‘yes ”
” | sudo passenger-install-apache2-module’ do |ch, stream, out|
next if out.chomp == input.chomp || out.chomp == ”
print out
ch.send_data(input = $stdin.gets) if out =~ /(Enter|ENTER)/
end
Second,
Maybe the gem list has changed – had to slightly modify regex
version = data.sub(/passenger \(([^,]+).*\)/, “\\1”).strip
Finally, SCP was failing so just made it simple:
put passenger_config, “/root/passenger”
sudo “mv /root/passenger /etc/apache2/conf.d/passenger”
Thanks again! This was great…
Chad
great, i added the simpler instructions from the google groups site you posted to and a link to cap-recipes which I use atm