Capistrano and Bundler problem - stratification: not found

I keep getting the following error when trying to deploy my application using the bundle / install option:

failed: "sh -c 'cd /home/deploy/swamp/releases/20110903003336 && bundle install --gemfile /home/deploy/swamp/releases/20110903003336/Gemfile --path /home/deploy/swamp/shared/bundle --deployment --quiet --without development test'" on 12.345.678.98 

** Update - it looks like I missed an error:

 [err :: 12.345.678.98] sh: bundle: not found 

I tried this in my deploy.rb:

 require "bundler/capistrano" 

and I tried this:

 namespace :bundler do task :create_symlink, :roles => :app do shared_dir = File.join(shared_path, 'bundle') release_dir = File.join(current_release, '.bundle') run("mkdir -p #{shared_dir} && ln -s #{shared_dir} #{release_dir}") end task :bundle_new_release, :roles => :app do bundler.create_symlink run "cd #{release_path} && bundle install --without test" end end after 'deploy:update_code', 'bundler:bundle_new_release' 

I also ported my package to the vendor path using this:

 bundle install --path vendor/bundle 

I don’t think this is a permissions problem, because I can manually log in with the installation and installation of the package directly on the server without problems. Here is the whole deploy.rb file:

 require "bundler/capistrano" set :application, "swamp" set :domain, "12.345.678.98" set :repository, " git@github.com :***/**.git" set :deploy_to, "/home/deploy/#{application}" set :rails_env, 'production' set :branch, "master" role :app, domain role :web, domain role :db, domain, :primary => true set :deploy_via, :remote_cache set :scm, :git set :user, "deploy" set :runner, "deploy" ssh_options[:port] = **** set :use_sudo, false after "deploy", "deploy:cleanup" namespace :deploy do desc "Restarting mod_rails with restart.txt" task :restart, :roles => :app, :except => { :no_release => true } do run "touch #{current_path}/tmp/restart.txt" end [:start, :stop].each do |t| desc "#{t} task is a no-op with mod_rails" task t, :roles => :domain do ; end end end task :after_update_code do run "ln -nfs #{deploy_to}/shared/config/database.yml #{release_path}/config/database.yml" end 
+7
source share
6 answers

I found a solution here:

http://www.pastbedti.me/2011/06/change-path-environment-with-rails-and-capistrano/

In the config / deploy.rb file add the following snippet

  set :default_environment, { 'PATH' => "/opt/ruby-enterprise/bin/:$PATH" } 

Then I had to add gemfile.lock and gemfile to the repository and BAM!

+12
source

outdated

the solution below works for capistrano 2. for version 3 and above use the capistrano-rbenv plugin .


Assuming you are using the bash shell and setting rbenv to something in the lines of the bashrc or profile file (globally in /etc or separately) the problem is that capistrano does not use the so-called login shell that is required to load these files ( which ultimately loads rbenv).

for this purpose you may need to instruct capistrano to use such a shell :

 default_run_options[:shell] = '/bin/bash --login' 

put this in your deploy.rb . also has the advantage of keeping you dry without entering another place to manage the rbenv $PATH add-ons - unlike the fatfrog solution.

+7
source

This is because bashrc rbenv init is not running. Move this to the beginning of the bashrc file for the deployment user, and it will fix the problem:

 if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion fi export PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)" 
+4
source

If your RVM problem is on the server, look at the help provided by rvm.io: https://rvm.io/integration/capistrano/#gem

+1
source

for more information, see my answer here: https://stackoverflow.com/a/312929/

+1
source

I ran into this problem, and in my case, the fragment from deploy / production.rb was as follows:

 run "cd #{release_path} && bundle --without development test" 

You need to install the package as follows:

sudo apt-get install bundler

-one
source

All Articles