I want to deploy my simple rails 4.0
application via capistrano 3.0
.
I use bundler 1.3.5
so I add capistrano-bundler gem to integ
Just ran into the same issue. What worked for me was this:
1) Installing the capistrano-rvm
gem and adding
require 'capistrano/rvm'
to the Capfile
.
2) Adding my deployment user to the rvm
group on the server:
# usermod deploy -a -G rvm
3) Creating two directories in my deployment user's home folder: .rvm
and .rvm/bin
4) Adding this line to my deploy.rb
file:
set :default_env, { rvm_bin_path: '~/.rvm/bin' }
Phew! That took a few hours.
in your config/deploy/production.rb file put
set :rvm_ruby_version, '2.0.0-p247'
see https://github.com/capistrano/rvm
I had:
set :bundle_flags, '--system --quiet'
Changed to:
set :bundle_flags, '--deployment --quiet'
This resolved a problem.
To debug it try to remove the --quiet
flag:
set :bundle_flags, '--deployment'
Are you using rbenv, rvm or something similar? It might be possible that when bundle
is running the Ruby version is not set yet. By removing the --quite
flag you might get some debugging information.
The error sounds like it can't find bundle
in your PATH
. It's possible that when you SSH in manually, it's running something in your ~/.profile
or ~/.bash_profile
that adds it to your path.
Find the path to bundle
by logging in and running which bundle
. Then, try to find how that path is added to your PATH
environment variable. If there's something in your ~/.bash_profile, try moving it to
~/.bashrc` instead.
You can also try Command Mapping to specify an exact path.
There are some more troubleshooting tips at http://www.capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/
This works in capistrano 3:
task :bundle_list do
on roles(:app) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :bundle, "list"
end
end
end
end
Use this for rake task :
execute :rake, 'some_rake_task'