3

Capistrano does not work with rvmsudo in my deploy.rb.

I tried

set :sudo, 'rvmsudo'
set :sudo_prompt, 'password: '

And then running commands with:

sudo "god -c config/unicorn.god --log-level debug"

But Capistrano gets stuck on the password prompt.

This solution here says to use sudo "whoami" and then rvmsudo because it will remember your password for 5 minutes, but my password is not remembered.

context:

desc "Start unicorn"
  task :start, :except => { :no_release => true } do
  sudo "god -c config/unicorn.god --log-level debug"
end
Community
  • 1
  • 1
LanguagesNamedAfterCofee
  • 5,782
  • 7
  • 45
  • 72

3 Answers3

3

Try to use this:

task :do_something do
    run "cd #{latest_release} && rvmsudo -p '#{sudo_prompt}' some_command"
end

It worked for me!

PliTeX
  • 41
  • 5
3

Are you doing

require 'bundler/capistrano'

?

Its hacky, but you could try:

after "deploy:update_code", :do_bundle_install

task :do_bundle_install do
  run "cd #{current_release} && rvmsudo bundle install --gemfile #{current_release}/Gemfile --path {path to install}/bundle --without development test cucumber"
end
Allyl Isocyanate
  • 13,306
  • 17
  • 79
  • 130
1

Try using sudo inside the run command, but calling the sudo from the set:

task :do_something do
  run "#{sudo} root task"
end

This way if you change your mind, you dont need to rewrite all tasks, only remove the set :sudo.

Tiago
  • 2,966
  • 4
  • 33
  • 41