capistrano / rails

Official Ruby on Rails specific tasks for Capistrano
http://www.capistranorb.com/
MIT License
870 stars 269 forks source link

Capistran/Rails doesn't work with rvm #207

Open Deimos620 opened 7 years ago

Deimos620 commented 7 years ago

I am trying to deploy Rails app with capistrano. Ruby version is managed by rvm. I am using ruby 2.2.3, created gemset manually.

set :rvm_type, :user
set :rvm_ruby_version, '2.2.3@cardlove-api'
...
with RAILS_ENV: fetch(:environment) do
execute :rake, "webpacker:install"
end

So, it seems worked. But when Rails > 5.0, webpack should be installed by this command: bundle exec rails webpacker:install (instead of bundle rake)

with RAILS_ENV: fetch(:environment) do
execute :rails, "webpacker:install"
end

But it doesn't work for me. I've installed bundle in the gemset I am using, but getting error:

01 bundle exec rails webpacker:install
  01 bash: bundle: command not found
 (Backtrace restricted to imported tasks)
  cap aborted!
  SSHKit::Runner::ExecuteError: Exception while executing as user@IP: rails 
  exit status: 127
  rails stdout: Nothing written
  rails stderr: bash: bundle: command not found

Of course, I included capistrano/rails in my capfile.

...
capistrano/rvm
capistrano/rails
...

I am not sure why I am getting error. I think I configured correctly , but... Anyway, Would you like to help me to fix this issue?

Thanks.

will-in-wi commented 7 years ago

Do you have capistrano/bundler in your Capfile?

mensfeld commented 6 years ago

I would close it. No activity and for me works as expected with this combination.

Deimos620 commented 6 years ago

Yes. I have it in my Capfile.

mattbrictson commented 6 years ago

I would try execute :rake, "webpacker:install" (i.e. rake instead of rails)