I'm on a CentOS VPS and using RVM and Capistrano to deploy. for some deployments I need to use sudo, but when I deploy with something like:
desc "Restart the application services"
task :restart, :roles => :app do
run "#{sudo} cd #{current_path} && bundle exec foreman export upstart"
end
I get: sudo: bundle: command not found
. that happens even if I run it manually through SSH. I run all of this under a non root user with sudo privileges and root group.
My sudoers file is like:
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
root ALL=(ALL) ALL
deploy ALL=(ALL) ALL
I tried changing secure_path
to:
/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/root/bin
Doing that makes the bundle exec
part work but now it says sudo: cd: command not found
I'm not sure what to do at this point, any one knows why?
which sudo
get you on the machine, both in the working and non-working states? It sounds like yoursudo
might be in a weird place./usr/bin/sudo
sudo
is found; it'sbundle
that's missing. Make sure you have Bundler installed on the machine.Doing that makes the bundle exec part work