Capistrano deploy bundle: command not found - ruby

I am running Capistrano with a Wordpress website that I work on locally and deploy to a staging server or a production server on Digital Ocean. I've been working on it for months now. And today all of a sudden, the simple deployment script doesn't worK scripts/deploy staging
It's worked just fine & now it's not. Any ideas of what would cause it to break?
I get the error:
scripts/deploy: line 3: bundle: command not found
The command on line 3 is:
(bundle exec cap $1 deploy)
I'm using ruby 2.0.0p645
And it looks like Capistrano gem 'capistrano', '~> 3.2.0'
I actually have 3 websites that use this command and none of them are working all of a sudden. Did Cap do an update or could my system have an error somehow?

Simply try on the remote site:
gem install bundler

Related

Bundle producing no output with "bundle exec cap deploy deploy" command

I'm trying to deploy a site using bundler and capistrano.
I updated to the latest version of Ruby (I was using 1.9.3 and now using 2.3.0)
I updated bundler to 1.10.6.
Before these updates when I ran this command "bundle exec cap production deploy" it would work, now when I run that command there is NO output whatsoever.
I haven't been able to find anything online that deals with this issue.
Any help is appreciated!
Jason

referencing a ruby gem from git breaks aws beanstalk deployment

I have set up my aws environment succesfully. However i am having one probelem. In my Gemfile i have the following line:
gem 'activeadmin', :github => 'gregbell/active_admin'
When i do a git aws.push i can see the following error in the aws logs:
/usr/local/share/ruby/gems/2.0/gems/bundler-1.3.5/lib/bundler/source/git.rb:177:in `rescue in load_spec_files': git://github.com/gregbell/active_admin.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
I was able to fix that problem by creating this file: .ebextensions/ruby.config
option_settings:
- option_name: BUNDLE_DISABLE_SHARED_GEMS
value: "1"
- option_name: BUNDLE_PATH
value: "vendor/bundle"
packages:
yum:
git: []
This packages everything into vendor/bundle and my app starts correctyl.
However I have two problems with this approach:
It takes very long to deploy because it needs to install all gems every time
I am not longer able to execute commands when I ssh into the EC2 instance. For example I have to start an rpush deamon. Locally this works with bundle exec rpush development but on EC2 this results in:
bundle exec rpush
/usr/local/share/ruby/gems/2.0/gems/bundler-1.3.5/lib/bundler.rb:284: warning: Insecure world writable dir /var/app/current/vendor/bundle/bin in PATH, mode 040777
git://github.com/gregbell/active_admin.git (at master) is not checked out. Please run bundle install
Is there an other way for installing the gems correctly and at the same time using the system gems? Or if that is not possible, how can I start rpush when the gems are bundled?
Update your Gemfile.lock (bundle install&& bundle update) in your local env. and push a commit with Gemfile and Gemfile.lock. Deploy to AWS again.
Can you check if using gem 'activeadmin', 'git://github.com:gregbell/active_admin' in your Gemfile works for you?
You can also get faster deployments utilizing vendor/cache by following the instructions given here:
http://blogs.aws.amazon.com/application-management/post/Tx2XVRWSS4E971S/Locally-Packaging-Gem-Dependencies-for-Ruby-Applications-in-Elastic-Beanstalk
What solved my problem: I modified the bundle install script and added the --deployment flag

Heroku: where did my gems go?

I have been deploying a Rails 3.2 application to heroku for several weeks now. I have also been executing rake tasks on the Cedar stack where my application is located.
One day after a deploy I noticed that rake was no longer working. I get, for example, the following:
$:~/dev/my_project$ heroku run rake -T
Running `rake -T` attached to terminal... up, run.7566
bundler: command not found: rake
Install missing gem executables with `bundle install`
Trying to run commands with bundle exec yields the same results.
What I've tried:
heroku run bundle install. This works and informs me that gems were installed into ./vendor/bundle. However, heroku run ls ./vendor/bundle yields only the following:
$:~/dev/my_project$ heroku run ls ./vendor/bundle/
Runningls ./vendor/bundle/attached to terminal... up, run.3458
bin ruby
bundle package. Although the deployment works it does not help my problem.
fiddling around with the rubygems-bundler gem (although I think this is now part of core bundler). This does not seem to have any effect.
On Heroku, gems are installed within the vendor/bundle/ruby/<version>/gems directory. I just checked my Heroku instance and confirmed this.
You are going to want to use bundle exec rake task because the gems are not in the users PATH.

Switch from heroku gem to heroku-api topolbelt

Heroku is so good at making things simple...but this...not so much. How do you switch from the heroku gem to the new tool belt? Here are the steps I have taken:
$ heroku version: heroku-gem/2.32.5 (x86_64-darwin11.4.1) ruby/1.9.3 autoupdate
removed 'gem "heroku"' from gem file
added 'gem "heroku-api"' to gemfile
deleted gemfile.lock
$ bundle install
installed toolbelt via the package installer
$ heroku login ... returns "Authentication successful"
$ heroku version: STILL RETURNS heroku-gem/2.32.5 (x86_64-darwin11.4.1) ruby/1.9.3 autoupdate
Two questions:
#1 Why is my version still using the heroku-gem after taking the steps above?
#2 Where do I put "heroku = Heroku::API.new(:api_key => API_KEY)" for use with the heroku-api gem?
Deleting the gemfile.lock file didn't cut it. I had to run gem uninstall heroku (which I had 9 version of)... After that, heroku version showed to tool belt.

Heroku not loading bundler for non-web ruby app

I have a program that I wrote using ruby. It doesn't have any web interface, but I use bundler for dependency management.
On my local system, running the app is as simple as typing rake app:start, and it loads up just fine.
When I deploy to heroku, however, my app crashes with a cannot load such file -- bundler error.
My Procfile looks has this entry app: bundle exec rake app:start.
Any help is greatly appreciated.
The problem was that Heroku was not changing the GEM_HOME field to the vendor/bundle directory.
By adding the following config vars to Heroku, my app ran as expected:
GEM_HOME: /app/vendor/bundle/ruby/1.9.1
PATH: /app/vendor/bundle/ruby/1.9.1/bin:bin:node_modules/.bin:/usr/local/bin:/usr/bin:/bin
Adding these was done via the heroku config:set CONFIG_NAME=VALUE command.

Resources