Path To Pid File Not Valid

The location of PID files has changed in recent versions of Rails. This can occasionally cause problems with mongrel_cluster when you try to deploy your application. During deployment you may see errors such as “Path to pid file not valid” or you may see an error creating a symbolic link to /var/www/apps/yourapp/shared/pids.

In either case, we’re going to fix it by installing the latest version of mongrel_cluster and updating your deploy.rb file to put mongrel pid files in /var/run/mongrel_cluster.

On your server:

sudo su -
gem install mongrel_cluster
cp /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.2/resources/mongrel_cluster /etc/init.d/
chmod +x /etc/init.d/mongrel_cluster
chkconfig --levels 235 mongrel_cluster on
mkdir -p /var/run/mongrel_cluster
chown deploy.deploy /var/run/mongrel_cluster

Now on your local system add this line to config/deploy.rb:

set :mongrel_pid_file, "/var/run/mongrel_cluster/#{application}.pid"

And then run:

svn commit -m "updated pid_file location"
cap app:setup deploy

Meta