I am using capistrano v2.9.0 to deploy to a ubuntu server running
apache v2.2.12, passenger v3.0.4, ruby v1.9.2 and rails v3.0.1. When
I deploy a new application, I often get error messages like:

Could not find net-ssh-2.2.2 in any of the sources
(Bundler::GemNotFound)

The missing gem is actually in the vendor/cache directory, but it is
being ignored. For a while I was globally installing these missing
gems, but recently I found that by running the command:

$ bundle install --path vendor/cache

after deploying the application, passenger would use the gems in the
application.

Why do I need to do this extra step and why can't capistrano do it for
me?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Jsnark at Jan 11, 2012 at 4:45 pm
    Correction. I'm actually running rails v3.0.7.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Colin Law at Jan 11, 2012 at 4:56 pm

    On 11 January 2012 16:09, jsnark wrote:
    I am using capistrano v2.9.0 to deploy to a ubuntu server running
    apache v2.2.12, passenger v3.0.4, ruby v1.9.2 and rails v3.0.1.  When
    I deploy a new application, I often get error messages like:

    Could not find net-ssh-2.2.2 in any of the sources
    (Bundler::GemNotFound)

    The missing gem is actually in the vendor/cache directory, but it is
    being ignored.  For a while I was globally installing these missing
    gems, but recently I found that by running the command:

    $ bundle install --path vendor/cache
    My understanding (which may be faulty) is that the --path option tell
    bundle install where to put the gems, so this command installs the
    gems to vendor/cache.
    after deploying the application, passenger would use the gems in the
    application.

    Why do I need to do this extra step and why can't capistrano do it for
    me?
    Because that is what bundle install is for, to install the appropriate
    gems as defined by Gemfile and gemfile.lock.
    The one thing I am not sure of is why it did not work when the gems
    were already in vendor/cache. How did you get them there in the first
    place?

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Jsnark at Jan 11, 2012 at 6:06 pm

    On Jan 11, 11:55 am, Colin Law wrote:

    Because that is what bundle install is for, to install the appropriate
    gems as defined by Gemfile and gemfile.lock.
    The one thing I am not sure of is why it did not work when the gems
    were already in vendor/cache.  How did you get them there in the first
    place?

    Colin
    In my development environment I used the command:

    $ bundle pack

    to get the gems into vendor/cache. I then committed them to
    subversion and

    $ cap deploy

    copied them from subversion to the target machine.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Colin Law at Jan 11, 2012 at 7:53 pm

    On 11 January 2012 18:06, jsnark wrote:
    On Jan 11, 11:55 am, Colin Law wrote:

    Because that is what bundle install is for, to install the appropriate
    gems as defined by Gemfile and gemfile.lock.
    The one thing I am not sure of is why it did not work when the gems
    were already in vendor/cache.  How did you get them there in the first
    place?

    Colin
    In my development environment I used the command:

    $ bundle pack

    to get the gems into vendor/cache.  I then committed them to
    subversion and

    $ cap deploy

    copied them from subversion to the target machine.
    So the question is, what is the difference between
    bundle pack
    and
    bundle install --path vendor/cache

    Colin

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Jsnark at Jan 11, 2012 at 9:11 pm

    On Jan 11, 2:52 pm, Colin Law wrote:

    So the question is, what is the difference between
    bundle pack
    and
    bundle install --path vendor/cache

    Colin
    I found the pack command in "Agile Web Development with Rails", fourth
    edition on page 235. I stumbled across the install command while
    researching this issue on the web.

    Looking into this I see one big difference:

    $ bundle install --path vendor/cache

    installs all of ruby in the directory vendor/cache/ruby! It also
    creates a file .bundle/config containing:

    $ cat .bundle/config
    ---
    BUNDLE_PATH: vendor/cache
    BUNDLE_DISABLE_SHARED_GEMS: "1"

    I guess I'd rather not have a fresh copy of ruby with each
    application, so I'm back to my original problem - how to get passenger
    and capistrano to set things up so that the gems in vendor/cache are
    used.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Steven F. at Jan 13, 2012 at 8:39 pm
    I am having the same issue(s). It appears that bundle puts the gems into
    vendor/cache, but the application (or capistrano during install?) is not
    looking for them there. The installation fails, but examining
    shared/cached-copy/vendor/cache on the server (deployment destination)
    shows the "missing" gems are there.

    Where did you run "bundle install --path vendor/cache"? On the
    development machine, or the server?

    Has there been any progress with a work-around?

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Jsnark at Jan 16, 2012 at 2:06 pm

    On Jan 13, 3:39 pm, "Steven F." wrote:

    Where did you run "bundle install --path vendor/cache"?  On the
    development machine, or the server?
    I ran the bundle install command on the server after deploying the
    application.
    Has there been any progress with a work-around?
    No. Based on your other responses, I'm going to try running:

    $ bundle config --path vendor/cache

    on the server after deployment. If this works, I'll play around with
    changing deploy.rb to try to get capistrano to perform this action.

    One big difference between our applications is I am still on Rails 3.0
    and you appear to be on Rails 3.1.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Steven F. at Jan 13, 2012 at 10:38 pm
    By the way... running "bundle install --path vendor/cache" on the
    development system, then re-deploying did not fix the problem -- the
    deploy still failed at the assets compile step.

    To get it to deploy I have to shell into the server, cd to
    "shared/cached-copy" and then run "bundle pack" to install the missing
    gems. After that the project will deploy, at least until the gem list is
    changed again.

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Steven F. at Jan 14, 2012 at 5:09 pm
    Well, this makes little sense to me, but it is a work-around for this
    problem.

    Add the following line to your deploy.rb file:

    before "deploy:assets:precompile", :bundle_install

    I've also run (on the server) "bundle config path vendor/cache" and
    placed "export BUNDLE_PATH=vendor/cache" in the .bashrc file.

    Now, before precompiling the assets, the bundler installs the gems,
    apparently into vendor cache. The last few lines are:

    ** [out :: <server name>] Installing will_paginate (3.0.2)
    ** [out :: <server name>]
    ** [out :: <server name>] Updating .gem files in vendor/cache
    ** [out ::<server name>] Your bundle is complete! It was installed into
    ./vendor/cache
    command finished in 103066ms

    and the deployment continues to completion.

    The end of my deploy.rb file looks like...


    # This is a hack to avoid deployment failure on the assets:precompile
    step
    # Failure is "Could not find <some gem> in any of the sources"
    # seems to be a bundler problem, as all gems are in vendor/cache, and
    shouldn't need
    # a bundle:install command
    before "deploy:assets:precompile", :bundle_install

    after "deploy:update_code", :bundle_install
    desc "install the necessary prerequisites"
    task :bundle_install, :roles => :app do
    run "cd #{release_path} && bundle install"
    end

    See here for an explanation to this issue, that was presumably closed
    last September...

    https://github.com/capistrano/capistrano/issues/81

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Xuan at Jan 16, 2012 at 2:26 pm

    On 11 ene, 17:09, jsnark wrote:
    I am using capistrano v2.9.0 to deploy to a ubuntu server running
    apache v2.2.12, passenger v3.0.4, ruby v1.9.2 and rails v3.0.1.  When
    I deploy a new application, I often get error messages like:

    Could not find net-ssh-2.2.2 in any of the sources
    (Bundler::GemNotFound)

    The missing gem is actually in the vendor/cache directory, but it is
    being ignored.  For a while I was globally installing these missing
    gems, but recently I found that by running the command:

    $ bundle install --path vendor/cache

    after deploying the application, passenger would use the gems in the
    application.

    Why do I need to do this extra step and why can't capistrano do it for
    me?
    If you add '--local' to your 'set :bundle_flags' statement, capistrano
    will automatically look into vendor/cache for the gems during the
    deploy process without extra work.
    They should be previously packaged with bundle package.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Jsnark at Jan 16, 2012 at 2:44 pm

    On Jan 16, 9:25 am, Xuan wrote:

    If you add '--local' to your 'set :bundle_flags' statement, capistrano
    will automatically look into vendor/cache for the gems during the
    deploy process without extra work.
    They should be previously packaged with bundle package.
    Thank you. That's what I needed.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Jsnark at Jan 16, 2012 at 2:54 pm
    Oops. Pilot error.

    set :bundle_flags, '--local'

    did not work.
    On Jan 16, 9:43 am, jsnark wrote:
    On Jan 16, 9:25 am, Xuan wrote:

    If you add '--local' to your 'set :bundle_flags' statement, capistrano
    will automatically look into vendor/cache for the gems during the
    deploy process without extra work.
    They should be previously packaged with bundle package.
    Thank you.  That's what I needed.
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Xuan at Jan 17, 2012 at 11:00 am

    On 16 ene, 15:54, jsnark wrote:
    Oops.  Pilot error.

    set :bundle_flags, '--local'

    did not work.

    On Jan 16, 9:43 am, jsnark wrote:
    Usually it looks more like:
    set :bundle_flags, "--deployment --local --without development test"

    --deployment has several effects, which you can read at bundler page
    as they are qute a few to write them here, specific to deployment
    environments
    --without avoids installing gems grouped on :development and :test on
    your Gemfile

    Anyway, you should post your error messages for further help if this
    doesn't solve them.

    Good luck!

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Jsnark at Jan 17, 2012 at 1:52 pm
    Could not find net-ssh-2.2.2 in any of the sources
    (Bundler::GemNotFound)

    $ ls -l vendor/cache/net*
    -rw-rw-r-- 1 xxx xxx 27136 2012-01-17 08:44 vendor/cache/net-
    scp-1.0.4.gem
    -rw-rw-r-- 1 xxx xxx 61440 2012-01-17 08:44 vendor/cache/net-
    sftp-2.0.5.gem
    -rw-rw-r-- 1 xxx xxx 133120 2012-01-17 08:44 vendor/cache/net-
    ssh-2.2.2.gem
    -rw-rw-r-- 1 xxx xxx 18432 2012-01-17 08:44 vendor/cache/net-ssh-
    gateway-1.1.0.gem

    I added:

    set :bundle_flags, "--deployment --local --without development test"

    to deploy.rb and then reran

    $ cap deploy

    Is tthat correct? I could not find set :bundle_flags in the
    capistrano documentation.
    On Jan 17, 6:00 am, Xuan wrote:
    On 16 ene, 15:54, jsnark wrote:

    Oops.  Pilot error.
    set :bundle_flags, '--local'
    did not work.
    On Jan 16, 9:43 am, jsnark wrote:
    Usually it looks more like:
    set :bundle_flags, "--deployment --local --without development test"

    --deployment has several effects, which you can read at bundler page
    as they are qute a few to write them here, specific to deployment
    environments
    --without avoids installing gems grouped on :development and :test on
    your Gemfile

    Anyway, you should post your error messages for further help if this
    doesn't solve them.

    Good luck!
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Jsnark at Jan 20, 2012 at 3:03 pm
    I found the solution. Insert the line:

    require "bundler/capistrano"

    into deploy.rb
    On Jan 17, 8:52 am, jsnark wrote:
    Could not find net-ssh-2.2.2 in any of the sources
    (Bundler::GemNotFound)

    $ ls -l vendor/cache/net*
    -rw-rw-r-- 1 xxx xxx  27136 2012-01-17 08:44 vendor/cache/net-
    scp-1.0.4.gem
    -rw-rw-r-- 1 xxx xxx  61440 2012-01-17 08:44 vendor/cache/net-
    sftp-2.0.5.gem
    -rw-rw-r-- 1 xxx xxx 133120 2012-01-17 08:44 vendor/cache/net-
    ssh-2.2.2.gem
    -rw-rw-r-- 1 xxx xxx  18432 2012-01-17 08:44 vendor/cache/net-ssh-
    gateway-1.1.0.gem

    I added:

    set :bundle_flags, "--deployment --local --without development test"

    to deploy.rb and then reran

    $ cap deploy

    Is tthat correct?  I could not find set :bundle_flags in the
    capistrano documentation.
    On Jan 17, 6:00 am, Xuan wrote:
    On 16 ene, 15:54, jsnark wrote:

    Oops.  Pilot error.
    set :bundle_flags, '--local'
    did not work.
    On Jan 16, 9:43 am, jsnark wrote:
    Usually it looks more like:
    set :bundle_flags, "--deployment --local --without development test"
    --deployment has several effects, which you can read at bundler page
    as they are qute a few to write them here, specific to deployment
    environments
    --without avoids installing gems grouped on :development and :test on
    your Gemfile
    Anyway, you should post your error messages for further help if this
    doesn't solve them.
    Good luck!
    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 11, '12 at 4:09p
activeJan 20, '12 at 3:03p
posts16
users4
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2021 Grokbase