LanguagesNamedAfterCofee
LanguagesNamedAfterCofee

Reputation: 5952

Capistrano rvmsudo

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

Upvotes: 3

Views: 2051

Answers (3)

PliTeX
PliTeX

Reputation: 41

Try to use this:

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

It worked for me!

Upvotes: 3

Tiago
Tiago

Reputation: 2966

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.

Upvotes: 1

Allyl Isocyanate
Allyl Isocyanate

Reputation: 13616

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

Upvotes: 3

Related Questions