I am deploying my 1st Rails app using capistrano, unicorn, rbenv, nginx, linode, ubuntu 12.04. When I run
bin/cap deploy:cold
in my app root, I get the following error back:
* 2012-10-31 01:19:36 executing `bundle:install'
* executing "cd /home/mr_deployer/apps/prjct_mngr/releases/20121031001933 && bundle install --gemfile /home/mr_deployer/apps/prjct_mngr/releases/20121031001933/Gemfile --path /home/mr_deployer/apps/prjct_mngr/shared/bundle --deployment --quiet --without development test"
servers: ["xxxxxxxxxxxxx"]
[xxxxxxxxxxxxx] executing command
** [out :: xxxxxxxxxxxxx] Could not find rake-0.9.2.2 in any of the sources
** [out :: xxxxxxxxxxxxx] Run `bundle install` to install missing gems.
command finished in 1046ms
*** [deploy:update_code] rolling back
* executing "rm -rf /home/mr_deployer/apps/prjct_mngr/releases/20121031001933; true"
servers: ["xxxxxxxxxxxxx"]
[xxxxxxxxxxxxx] executing command
command finished in 625ms
failed: "sh -c 'cd /home/mr_deployer/apps/prjct_mngr/releases/20121031001933 && bundle install --gemfile /home/mr_deployer/apps/prjct_mngr/releases/20121031001933/Gemfile --path /home/mr_deployer/apps/prjct_mngr/shared/bundle --deployment --quiet --without development test'" on xxxxxxxxxxxxx
I have run bundle install --path vendor/bundle on my development machine, and gem rake is installed both on dev machine and on linode vps. Why cant it find rake?
UPDATE:
I have tried adding path of my rake gem on linode to both my bashrc on linode and to :default_envoronment in deploy.rb file. Still getting the same error...
Try to specify your path in capistrano receipe, for example:
default_environment["PATH"] = "/usr/local/bin:/usr/bin:/usr/local/rvm/bin/:/var/lib/gems/1.9.1/bin"
If you don't know how looks your path, connect to your server via ssh and run command
echo $PATH
Capistrano tries to run command cd /home/mr_deployer/apps/prjct_mngr/releases/20121031001933 && bundle install --gemfile /home/mr_deployer/apps/prjct_mngr/releases/20121031001933/Gemfile --path /home/mr_deployer/apps/prjct_mngr/shared/bundle --deployment --quiet --without development test on remote machine where you service is deployed to.
Looks like remote node doesn't have rake installed that bundle trying to use.
Maybe you should check that all necessary gems are installed on remote machine.
This error is not indicating that rake is not installed on the machine you are deploying to. This error means that Bundler, when it tried to install your gems, was unable to find Rake version 0.9.2.2 in the sources listed in your Gemfile. Does your Gemfile contain a line like source "http://rubygems.org"?
Related
I'M trying to deploy with capistrano to a staging server. This command fails both on deploy and manually:
cd .../apps/myapp/releases/20150205154326 && ( RVM_BIN_PATH=/usr/local/rvm/bin/ PATH=/usr/bin/git:$PATH /usr/local/rvm/bin/rvm default do bundle install --path .../apps/myapp/shared/bundle --without development test --deployment --quiet )
error:
Git error: command 'git clone --no-checkout --quiet
".../apps/myapp/shared/bundle/ruby/2.1.0/cache/bundler/git/fog- 8836460df0e4c80347618efd3adda34209f0c6f7"
".../apps/myapp/shared/bundle/ruby/2.1.0/bundler/gems/fog- 5ceace13efe1"'
in directory .../apps/myapp/releases/20150205154326 has failed.
If this error persists you could try removing the cache directory
'.../apps/myapp/shared/bundle/ruby/2.1.0/cache/bundler/git/fog-8836460df0e4c80347618efd3adda34209f0c6f7'
However, this dir exists, and the permissions are ok. I've tried to delete it and run again, but to no avail.
solved by reinstalling bundler and rvm
Why doesn't the second command of
$ bundle install
not need
--without production
(As this is how it went in a tutorial, so I assume its correct)
What is happening/reasoning behind it not being needed?
From http://ruby.railstutorial.org/chapters/a-demo-app#sec-demo_users_resource
$ bundle install --without production
$ bundle update
$ bundle install
I believe it's because bundler creates a .bundle/config file inside your project's folder. This file stores the --without production option for later execution so that you don't have to type it every time.
When you run your bundle command on your development machine, it won't install the gems for use in your production environment.
See here: http://bundler.io/man/bundle-install.1.html
NAME
bundle-install - Install the dependencies specified in your Gemfile
SYNOPSIS
bundle install [--binstubs[=DIRECTORY]] [--clean] [--full-index] [--gemfile=GEMFILE] [--jobs=NUMBER] [--local] [--deployment] [--no-cache] [--no-prune] [--path PATH] [--system] [--quiet] [--retry=NUMBER] [--shebang] [--standalone[=GROUP[ GROUP...]]] [--trust-policy=POLICY] [--without=GROUP[ GROUP...]]
trying to deploy my Rails app to a virtual host on VirtualBox.
I'm using capistrano to deploy my app, and using vagrant to manage virtual machine.
My capistrano setting is OK, because it works correctly on AWS.
All that I did is,
$ cap deploy:setup
then
$ cap deploy
....
* 2013-05-24 11:09:35 11:09:35 == Currently executing `bundle:install'
* executing "cd /home/deploy/apps/appname/releases/20130524020935 && bundle install --gemfile /ho
me/deploy/apps/appname/releases/20130524020935/Gemfile --path /home/deploy/apps/appname/shared/b
undle --deployment --binstubs --without test development deploy"
servers: ["cent1"]
[cent1] executing command
** [out :: cent1] Fetching source index from https://rubygems.org/
Command stops here. No progress.
Why fetching gems failed?
When I tried on AWS, everthing works fine. Whats the difference?
I seem to have a similar problem as this post, where Bundler complains of a gem not being checked out. However, mine shows an error when running a rake task using a cron job. (Otherwise, the site seems to deploy fine in production using Phusion Passenger, and the rake task runs when called in the command line )
The error is:
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/source.rb:571:in load_spec_files': git://github.com/moneill/Google-Maps-for-Rails.git (at modified_markers) is not checked out. Please runbundle install` (Bundler::GitError)
I tried using bundle install --deployment ; bundle pack followed by bundle install --path vendor/cache.
One thing I haven't tried is to locally compile the git project and install the gem in the vendor/bundle folder. I am not using RVM for this particular server.
The cron job command is cd /home/[dir]/[rails_app_folder]/ && RAILS_ENV=production /usr/local/bin/bundle exec rake [task] --trace
Thank you!
So I am attempting to get a capistrano deployment setup with an nginx/unicorn server, using RVM.
The deploy works, but when I attempt to interact with unicorn via capistrano i get an error like:
[~/source/quibbler/config]
$ cap unicorn:start
* executing `unicorn:start'
* executing "cd /u/apps/quibbler/current && bundle exec unicorn_rails -c /u/apps/quibbler/current/config/unicorn-production.rb -E production -D"
servers: ["wwwtestvm.whf.app"]
[wwwtestvm.whf.app] executing command
** [out :: wwwtestvm.whf.app] Could not find rake-0.9.2 in any of the sources
command finished in 553ms
failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-1.9.2-p290#quibbler' -c 'cd /u/apps/quibbler/current && bundle exec unicorn_rails -c /u/apps/quibbler/current/config/unicorn-production.rb -E production -D'" on wwwtestvm.whf.app
I have searched the interwebs all night and can not find the solution. If I copy paste the command into my shell it works so I am 99% sure it has to do with the RVM environment not being correct.
I have created a gist of my deploy and unicorn configs:
https://gist.github.com/1375736#file_deploy.rb
https://gist.github.com/1375736#file_unicorn_production.rb
Any help or guidance would be appreciated.
Thanks to sannankhalid answer on this other question i was able to resolve it.
Short answer: add rake to your Gemfile, make sure you run bundle install so your Gemfile.lock gets updated, then deploy to your server, ayay!