Mr_LinDowsMac
Mr_LinDowsMac

Reputation: 2702

Problems with sudo when deploying RVM with Capistrano

I would like to use Capistrano to deploy my app in my server I have the deploy.rb file with the following content:

set :user, "deploy"
set :use_sudo, true
set :deploy_to, "/webapps/#{application}"
#set :deploy_via, :remote_cache #Using this option avoids to do a full repository clone


#RVM
set :rvm_type, :system  #System Wide installation
set :rvm_ruby_string, 'ree@K2'
set :rvm_install_shell, :bash

before 'deploy:setup','rvm:install_rvm'
before 'deploy:setup', 'rvm:install_ruby'

# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts

# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
   task :start do ; end
   task :stop do ; end
   task :restart, :roles => :app, :except => { :no_release => true } do
     run "touch #{File.join(current_path,'tmp','restart.txt')}"
   end
 end

Everything works fine when i set the root user, installs RVM (system-wide installation) and even a Ruby Enterprise, but when I run 'cap deploy:setup' setting the use_sudo option and deploy user, get this:

$ cap deploy:setup
  * executing `deploy:setup'
    triggering before callbacks for `deploy:setup'
  * executing `rvm:install_rvm'
  * executing "bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)"
    servers: ["myserver.com"]
Password: 
    [myserver.com] executing command
    [myserver.com] bash -c 'bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)'
*** [err :: myserver.com] bash: line 304: /usr/local/rvm/RELEASE: Permission denied
    command finished in 564ms
failed: "bash -c 'bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)'" on myserver.com

What I have to do to make this work? Do I have to adjust some settings in sudoers file?

Upvotes: 0

Views: 1090

Answers (1)

mpapis
mpapis

Reputation: 53158

please test with 1.1.0:

gem install rvm-capistrano

Upvotes: 2

Related Questions