Archive for August, 2009

* Passenger on Rails Playground

Posted on August 29th, 2009 by Dave Johnson. Filed under Uncategorized.


I finally setup Passenger (mod_rails) on my Rails Playground server the other day so that I can quit worrying about Mongrel and it is super easy. The main problem that I found was that I had a spelling mistake in my httpd.conf file in the PassengerRuby config line. The error that this produced in the Apache error_log file seemed to be referring to starting the spawn server.

Could not start the spawn server: /usr/local/lib/ruby: Permission denied (13)

So I spent a long time trying to find info about Passenger spawn server settings, but the problem in the end was that the path shown in the error did not exist - it should have been pointing to bin obviously :S

The other part of using passenger is the slightly different Capistrano recipe. With Passenger there is no spinner task and you need to put in an empty restart task. Here is my recipe:

########################
# Application
########################

set :application, “example.com”
set :deploy_to, “/var/rails/#{application}”

########################
# Settings
########################

default_run_options[:pty] = true
ssh_options[:forward_agent] = false
set :runner, “user”

########################
# Servers
########################

set :user, “user”
set :domain, “example.com”
server domain, :app, :web
role :db, domain, :primary => true

########################
# Subversion
########################

set :repository, “http://svn.example.com/trunk/server”
set :scm_username, “user”
set :scm_password, “password”

########################
# Passenger
########################

namespace :passenger do
desc “Restart Application”
task :restart do
run “chown -R apache:apache #{current_path}”
run “touch #{current_path}/tmp/restart.txt”
end
end

after :deploy, “passenger:restart”

deploy.task :start do
# nothing
end

The other thing that I found I had to do was the chown call since Passenger runs the Rails app with the same user as is running Apache, in this case the apache user and apache group.

Now on to try out Cassandra.

.