I am trying to setup capistrano to deploy my rails3 app easily. I'm pretty new to rails.
Everything is working as it should except that I am trying to restart the standalone passenger server.
I am running redmine on the same server, so I followed http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/ to get multiple versions of ruby/rails to run. This works fine until I try and get capistrano to restart the passenger server.
The problem is the 'sudo' doesn't pass environment settings through (as found on: sudo changes PATH - why? )
Everything works if I can use 'rvmsudo' instead of 'sudo', since rvmsudo passes along the correct environment information. But, if I use 'rvmsudo' in my Captistrano deployment, it hangs waiting for my sudo password.
I would like to implement a try_rvmsudo that works exactly like try_sudo does, where it sends the password if it is asked for. but I can't seem to find any information on doing this.
here is the restart command that I am trying to use:
desc "Restart Passenger server"
task :restart, :roles => :app, :except => { :no_release => true } do
run <<-CMD
if [[ -f #{release_path}/tmp/pids/passenger.#{passenger_port}.pid ]];
then
cd #{deploy_to}/current && #{passenger_path}passenger stop -p #{passenger_port} --pid-file #{release_path}/tmp/pids/passenger.#{passenger_port}.pid;
fi
CMD
# restart passenger standalone on the specified port/environment and as a daemon
run "cd #{deploy_to}/current && rvmsudo #{passenger_path}passenger start -e #{rails_env} -p #{passenger_port} -a 127.0.0.1 -d --pid-file #{release_path}\
/tmp/pids/passenger.#{passenger_port}.pid"
end
And it hangs saying:
** [out :: snapshotroulette.com] [sudo] password for deployer: