I recently started using Capistrano on a personal project, which is hosted on a relatively plain Ubuntu box.
Capistrano wouldn’t do much, I kept getting errors about “bundle” not being found. Seems the newer versions of Rails and Capistrano prefix everything with “bundle” so the right Gems etc. are used.
Turns out there’s a problem with the path that my Capistrano scripts get when they ssh into the Linux machine. Seems there’s a different environment for interactive SSH sessions, and the non-interactive SSH sessions that Capistrano uses.
To diagnose this, I added this to my deploy.rb:
desc "Echo environment vars"
namespace :env do
task :echo do
run "echo printing out cap info on remote server"
run "echo $PATH"
Which when I do
cap env:echo tells me the path that my Capistrano scripts see – which crucially doesn’t include
Turns out you set the environment in
~/.ssh/environment, adding a PATH line in the normal way.
But then you need to edit
/etc/ssh/sshd_config and add a line
And restart SSH.
After that your Cap deployments will be smooth…