capistrano / rvm

MIT License
140 stars 47 forks source link

Rails and rvm integration not working #35

Closed nikita-v closed 10 years ago

nikita-v commented 10 years ago

Hi all! Installed gems:

capistrano-bundler (1.1.1)
capistrano-rails (1.1.0)
capistrano-rvm (0.0.3)

I get this error: bash: bundle: command not found

cap aborted!
rake exit status: 127
rake stdout: Nothing written
rake stderr: bash: bundle: command not found
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/command.rb:98:in `exit_status='
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:142:in `block (4 levels) in _execute'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `call'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:551:in `do_request'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:561:in `channel_request'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:269:in `wait'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:164:in `block (2 levels) in _execute'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `call'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/channel.rb:514:in `do_open_confirmation'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:545:in `channel_open_confirmation'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:465:in `dispatch_incoming_packets'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:221:in `preprocess'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:205:in `process'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `block in loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/net-ssh-2.7.0/lib/net/ssh/connection/session.rb:169:in `loop'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:166:in `block in _execute'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:123:in `tap'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:123:in `_execute'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:66:in `execute'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:63:in `block (6 levels) in <top (required)>'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/abstract.rb:89:in `with'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:62:in `block (5 levels) in <top (required)>'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/abstract.rb:81:in `within'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/gems/capistrano-rails-1.1.0/lib/capistrano/tasks/assets.rake:61:in `block (4 levels) in <top (required)>'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/backends/netssh.rb:54:in `run'
/home/nikita/.rvm/gems/ruby-2.1.0@ebashim/bundler/gems/sshkit-130211e882a9/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'

ps Sorry for my bad english

kirs commented 10 years ago

Are you sure you have gem Bundler installed on the server under ruby-2.1.0?

kirs commented 10 years ago

"ebashim"! :christmas_tree:

nikita-v commented 10 years ago

server@dhcppc4:~$ rvm 2.1.0@ebashim server@dhcppc4:~$ bundle -v Bundler version 1.5.1

mpapis commented 10 years ago

Have you tried updating this gems (+sshkit) to latest version? - there was change in how commands are built.

nikita-v commented 10 years ago

Yes. Gem sshkit updated to latest version (from gihtub)

mpapis commented 10 years ago

How about capistrano-bundler and capistrano-rvm?

nikita-v commented 10 years ago

With capistrano-rvm from github all works. =)

mpapis commented 10 years ago

it would be enough to use 0.1.0 - it was released a month ago with a fix for your problem.

nikita-v commented 10 years ago

Thanks. Happy new Year!

niksan commented 10 years ago

I have similar proplem

  gem 'capistrano', '~> 3.2.0'
  gem 'capistrano-rails', '~> 1.1'
  gem 'capistrano-rvm', '~> 0.1.0'
  gem 'capistrano-bundler', '~> 1.1.2'
  gem 'sshkit', '~> 1.4.0'
cap production unicorn:start
rvm 1.25.23 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
ruby-2.1.1@project_name
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
 INFO [a152c2d4] Running /usr/bin/env /srv/projects/project_name/shared/bin/unicorn -c /srv/projects/project_name/current/config/unicorn.rb -D -E production on [server ip here]
cap aborted!
SSHKit::Command::Failed: /srv/projects/project_name/shared/bin/unicorn exit status: 127
/srv/projects/project_name/shared/bin/unicorn stdout: Nothing written
/srv/projects/project_name/shared/bin/unicorn stderr: Nothing written
/home/username/.rvm/gems/ruby-2.1.1@project_name/gems/sshkit-1.4.0/lib/sshkit/command.rb:98:in `exit_status='
mpapis commented 10 years ago

127 means the command to run was not found, are you sure that unicorn is available in /srv/projects/project_name/shared/bin/unicorn?

niksan commented 10 years ago

This task from deploy.rb

namespace :unicorn do

  def run_unicorn
    execute "#{fetch(:bundle_binstubs)}/unicorn", "-c #{release_path}/config/unicorn.rb -D -E #{fetch(:stage)}"
  end

  desc 'Start unicorn'
  task :start do
    on roles(:app) do
      run_unicorn
    end
  end

If i run "/usr/bin/env /srv/projects/project_name/shared/bin/unicorn -c /srv/projects/project_name/current/config/unicorn.rb -D -E production" on the server manually, all works fine. "/srv/projects/project_name/shared/bin/unicorn" exist

mpapis commented 10 years ago

instead of:

execute "#{fetch(:bundle_binstubs)}/unicorn", ...

try:

execute :bundle, :exec, :unicorn, ...
niksan commented 10 years ago
execute :bundle, :exec, :unicorn,  "-E #{fetch(:stage)}", "-c #{fetch(:unicorn_conf)}"
 INFO [06a18687] Running /usr/local/rvm/bin/rvm default do bundle exec unicorn -E production -c /srv/projects/project_name/current/config/unicorn.rb on [server ip here]
cap aborted!
SSHKit::Command::Failed: bundle exit status: 10
bundle stdout: Nothing written
bundle stderr: Nothing written
mpapis commented 10 years ago

does any other command that needs RVM to work? please open a new ticket including your details .... also have you tried rvm1-capistrano3 - it is "improved" version of this gem and there is even a PR to merge this projects.