Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash: bundle: command not found when deploying #149

Closed
wiserfirst opened this issue Feb 18, 2016 · 5 comments
Closed

bash: bundle: command not found when deploying #149

wiserfirst opened this issue Feb 18, 2016 · 5 comments

Comments

@wiserfirst
Copy link

When I was deploying with bin/cap staging puma:stop, got this error:

DEBUG [f8d5bb5c] Command: cd /var/www/rails-apps/rails-api/current && ( export RBENV_ROOT="$HOME/.rbenv" RBENV_VERSION="2.2.3" RACK_ENV="staging" ; bundle exec pumactl -S /var/www/rails-apps/rails-api/shared/tmp/pids/puma.state -F /var/www/rails-apps/rails-api/shared/puma.rb stop )
DEBUG [f8d5bb5c]        bash: bundle: command not found
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host demo-api.fastrackexpress.com.au: pumactl exit status: 127
pumactl stdout: bash: bundle: command not found
pumactl stderr: Nothing written

SSHKit::Command::Failed: pumactl exit status: 127
pumactl stdout: bash: bundle: command not found
pumactl stderr: Nothing written

Tasks: TOP => puma:stop
(See full trace by running task with --trace)

My observation is that when running the pumactl command, the RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.3 ~/.rbenv/bin/rbenv exec part was not included, which makes this command fail.

my Gemfile is:

group :development do
  gem 'web-console', '~> 2.0'
  gem 'spring', '~> 1.4'
  gem 'capistrano', '~> 3.4', require: false
  gem 'capistrano-rails', '~> 1.1',  require: false
  gem 'capistrano-rbenv', '~> 2.0',  require: false
  gem 'capistrano3-puma', github: "seuros/capistrano-puma", require: false
end

I was using the github version of capistrano3-puma to avoid issue #120

capfile

# Load DSL and set up stages
require 'capistrano/setup'

# Include default deployment tasks
require 'capistrano/deploy'

require 'capistrano/rbenv'
require 'capistrano/rails'
require 'capistrano/puma'

# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
@Grafikart
Copy link

Got the same error, it's quite strange cause I can still deploy from my Mac (where I didn't do a bundle install from some times now).

I don't use capistrano-bundler but I use capistrano-rvm and I found the error. You have to require capistrano-puma after capistrano-rvm or it won't detect rvm usage.

@seuros
Copy link
Owner

seuros commented Mar 1, 2016

if you use bundler, you should add capistrano-bundler.

@seuros seuros closed this as completed Mar 1, 2016
@wiserfirst
Copy link
Author

@Grafikart Thanks for the comment! I'm using rbenv instead of rvm, so maybe we don't have the same problem.

@seuros Thank you for pointing out about capistrano-bundler. I just tried to add it as following.

My Gemfile:

group :development do
  gem 'web-console', '~> 2.0'
  gem 'spring', '~> 1.4'
  gem 'capistrano', '~> 3.4', require: false
  gem 'capistrano-bundler', '~> 1.1.2', require: false # Newly added
  gem 'capistrano-rails', '~> 1.1',  require: false
  gem 'capistrano-rbenv', '~> 2.0',  require: false
  gem 'capistrano3-puma', :git => 'git@github.com:seuros/capistrano-puma.git', :ref => 'c1d705d',  require: false
end

My Capfile:

# Load DSL and set up stages
require 'capistrano/setup'
# Include default deployment tasks
require 'capistrano/deploy'

require 'capistrano/rbenv'
require 'capistrano/bundler' #Newly added
require 'capistrano/rails'
require 'capistrano/puma'

But after adding capistrano-bundler like this, the command bundle exec cap staging puma:stop would still fail with the same error. I'm not quite sure if I missed anything or did something wrong. Thank you very much!

@seuros
Copy link
Owner

seuros commented Mar 2, 2016

in the staging server double check that you have bundler installer

cd /var/www/rails-apps/rails-api/current
gem install bundler

@wiserfirst
Copy link
Author

@seuros Thanks for the quick response. I checked that bundler was installed:

deployuser@demosite:/var/www/rails-apps/rails-api/current$ which bundle
/home/deployuser/.rbenv/shims/bundle
deployuser@demosite:/var/www/rails-apps/rails-api/current$ which bundler
/home/deployuser/.rbenv/shims/bundler

I've also confirmed that by adding the RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.3 ~/.rbenv/bin/rbenv exec prefix to the pumactl command, it would work as expected. That's why I added the :bundle, 'exec'back in the commands in PR #150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants