Note that there are some explanatory texts on larger screens.

plurals
  1. POcan bundler be used in rsync deployments?
    primarykey
    data
    text
    <p><strong>Can you deploy a Rails3 app using Bundler's Gemfile WITHOUT running <code>bundle install</code>... i.e. just by copying a rails project directory to the appropriate dir within Apache/Passenger?</strong></p> <p>So, we have a legacy environment that was designed for internal projects during the Ruby1.8.6/Rails2 timeframe and it depends on copying your local rails directory to a network mount under Apache/Passenger. While this deployment model worked fine for Rails2 (with frozen gems, etc.), it breaks in many painful ways for Rails3 with Bundler.</p> <p>Specifically, I'm seeing gem dependency errors for gems in :test and :development groups even when deploying to :production. I found the following SO post helpful at first:</p> <ul> <li><a href="https://stackoverflow.com/questions/4438601/bundler-incorrectly-trying-to-install-development-and-test-group-gems-in-pro">bundler incorrectly trying to install &quot;development&quot; and &quot;test&quot; group gems in production</a></li> </ul> <p>So I executed <code>bundle install --without test development</code> on my local and then tried to manually copy .bundle/config from my directory to the network dir, but that didn't work. Bundler still tried to load the excluded gems.</p> <p>This is painful for us because we don't have admin privileges to install gems on these servers (i.e. we aren't allowed to ever run <code>bundle install</code> in any form). Likewise, the admins do not want to be bothered with deploying our apps every 5 mins since this is an internal prototyping site and not an external production site. They also don't want to run <code>bundle install</code> because they want tight control of which gems are deployed across all applications -- for example, some apps are still Rails2 based and don't use Bundler yet, so they may break if the wrong gem is installed.</p> <p>Is there any way to use Bundler in a passive/rsync way, or should we just redesign our environment to let developers run <code>bundle install</code> via capistrano or some such?</p> <p>Help?</p> <p>Thanks!</p> <hr> <p><strong>UPDATE:</strong> 1/18/2012: After investigating the reason for the :test and :development group errors some more, I <a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html#bundler_support" rel="nofollow noreferrer">discovered</a> that Phusion Passenger actually executes <code>Bundle.setup()</code> before the Rails app gets a chance to in <code>boot.rb</code>. Without any arguments, <code>setup()</code> checks all gem dependencies, which means if it doesn't find a gem on the server, it will blow up in Passenger before it even gets a chance to load Rails.</p> <p>This particular 'bug' can only happen if you deploy via rsync or copy instead of running <code>bundle install --without test:development</code> on the target server. The majority of Rails3 apps are deployed with Capistrano, which does this step for you, and as such never encounter this particular edge case.</p> <p>So I'm afraid the only way to get 'groups' to work correctly in your gem file is to use <code>bundle install</code> as intended. This means we should change our deployment process!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload