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
Related
I am getting following error when trying to deploy a rails 4.2.1 app on ec2 using elastic beanstalk
on't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching source index from https://rubygems.org/
Fetching git#github.com:bokmann/font-awesome-rails.git
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Retrying git clone 'git#github.com:bokmann/font-awesome-rails.git' "/var/app/ondeck/vendor/bundle/ruby/2.0/cache/bundler/git/font-awesome-rails-aa9211906101215f2656ef38ba0c26146ba4c6bc" --bare --no-hardlinks --quiet due to error (2/3): Bundler::Source::Git::GitCommandError Git error: command `git clone 'git#github.com:bokmann/font-awesome-rails.git' "/var/app/ondeck/vendor/bundle/ruby/2.0/cache/bundler/git/font-awesome-rails-aa9211906101215f2656ef38ba0c26146ba4c6bc" --bare --no-hardlinks --quiet` in directory /var/app/ondeck has failed.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Git error: command `git clone 'git#github.com:bokmann/font-awesome-rails.git'
"/var/app/ondeck/vendor/bundle/ruby/2.0/cache/bundler/git/font-awesome-rails-aa9211906101215f2656ef38ba0c26146ba4c6bc"
--bare --no-hardlinks --quiet` in directory /var/app/ondeck has failed.
2014-07-13 15:16:48,672 [ERROR] (4743 MainThread) [directoryHooksExecutor.py-33] [root directoryHooksExecutor error] Script /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed with returncode 11
and .ebextensions/ruby.config looks like this
# Install git in order to be able to bundle gems from git
packages:
yum:
git: []
patch: []
commands:
# Run rake with bundle exec to be sure you get the right version
add_bundle_exec:
test: test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete
cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
command: perl -pi -e 's/(rake)/bundle exec $1/' 11_asset_compilation.sh 12_db_migration.sh
# Bundle with --deployment as recommended by bundler docs
# cf. http://gembundler.com/v1.2/rationale.html under Deploying Your Application
add_deployment_flag:
test: test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete
cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
command: perl -pi -e 's/(bundle install)/$1 --deployment/' 10_bundle_install.sh
# Vendor gems to a persistent directory for speedy subsequent bundling
make_vendor_bundle_dir:
test: test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete
command: mkdir /var/app/support/vendor_bundle
# Store the location of vendored gems in a handy env var
set_vendor_bundle_var:
test: test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete
cwd: /opt/elasticbeanstalk/support
command: sed -i '12iexport
EB_CONFIG_APP_VENDOR_BUNDLE=$EB_CONFIG_APP_SUPPORT/vendor_bundle' envvars
# The --deployment flag tells bundler to install gems to vendor/bundle/, so
# symlink that to the persistent directory
symlink_vendor_bundle:
test: test ! -f /opt/elasticbeanstalk/support/.post-provisioning-complete
cwd: /opt/elasticbeanstalk/hooks/appdeploy/pre
command: sed -i 's/\(^cd $EB_CONFIG_APP_ONDECK\)/\1\nln -s $EB_CONFIG_APP_VENDOR_BUNDLE .\/vendor\/bundle/' 10_bundle_install.sh
# Don't run the above commands again on this instance
# cf. http://stackoverflow.com/a/16846429/283398
z_write_post_provisioning_complete_file:
cwd: /opt/elasticbeanstalk/support
command: touch .post-provisioning-complete%
I am using a 64 bit Amazon Linux server and trying to install using ruby-2.0.0 and passenger
I suspect this is failing because in your ebextensions you are running bundle install --deployment. Is there a reason you want to use the --deployment flag. Take a look at this answer: https://stackoverflow.com/a/3681411/161628.
If your usecase does not need the --deployment flag, I would suggest don't use it.
You can locally package your app dependencies using vendor/cache using the approach documented in this blog.
Can you update the question with the contents of your Gemfile. Are you are using git# URLs in your Gemfile? You might want to use URLs like "git://github.com:bokmann/font-awesome-rails.git" in case you have "git#github.com:bokmann/font-awesome-rails.git" in your Gemfile.
Take a look at this answer.
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?
This is my first time deploying an app to an ec2 instance. It seems most of the process worked but eventually the deploy failed with the following error:
failed: "/bin/bash -l -c 'cd /mnt/depot-production/releases/20130312030226 && bundle install --gemfile /mnt/depot-production/releases/20130312030226/Gemfile --path /mnt/depot-production/shared/bundle --deployment --quiet --without development test staging'" on production.foo.com
I logged into my server and went to the directory and tried to execute the command. The following error was displayed:
Bundler::GemfileNotFound
When I list the contents of the directory, it shows a gemfile. Just could use some help in determining why it is not found and how to fix it.
I'm also not exactly sure how to proceed? I would like to simply fix the error and continue on with the instance that was created but not sure what steps all need to be executed.
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"?