Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7166099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:21:32+00:00 2026-05-28T14:21:32+00:00

Can you deploy a Rails3 app using Bundler’s Gemfile WITHOUT running bundle install …

  • 0

Can you deploy a Rails3 app using Bundler’s Gemfile WITHOUT running bundle install… i.e. just by copying a rails project directory to the appropriate dir within Apache/Passenger?

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.

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:

  • bundler incorrectly trying to install "development" and "test" group gems in production

So I executed bundle install --without test development 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.

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 bundle install 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 bundle install 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.

Is there any way to use Bundler in a passive/rsync way, or should we just redesign our environment to let developers run bundle install via capistrano or some such?

Help?

Thanks!


UPDATE: 1/18/2012: After investigating the reason for the :test and :development group errors some more, I discovered that Phusion Passenger actually executes Bundle.setup() before the Rails app gets a chance to in boot.rb. Without any arguments, setup() 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.

This particular ‘bug’ can only happen if you deploy via rsync or copy instead of running bundle install --without test:development 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.

So I’m afraid the only way to get ‘groups’ to work correctly in your gem file is to use bundle install as intended. This means we should change our deployment process!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:21:33+00:00Added an answer on May 28, 2026 at 2:21 pm

    Some other rails devs and I were discussing how to effectively freeze gems in Rails 3 and we worked out this solution. This is along the lines of what @asymmetric proposed, but different in some key ways. As I later discovered from the gemfile man page, this approach also suffers from the same limitation that @indirect warned of with bundle install --deployment, in that your gems must either be pure ruby (no native compilation), or these steps must be done on an identical architecture to your stage and prod servers.

    Ok, now that we have the preliminaries out of the way, let’s see about “freezing” some gems into Rails 3…

    First, start with a clean environment:

    $ rvm gemset use fresh
    $ rvm gemset empty fresh
    $ gem install rails
    $ rails new strawman
    $ cd strawman/
    

    Next, install the gem you want to use:

    $ gem install condi
    

    Next, create a vendor/gems directory and unpack the gem within it:

    $ mkdir vendor/gems
    $ cd vendor/gems
    $ gem unpack condi
    Unpacked gem: '/tmp/strawman/vendor/gems/condi-0.0.6'
    

    OPTIONAL:

    If your gem doesn’t have a .gemspec file with it (i.e. the spec is part of the contained Rakefile build), Bundler may not be able to load it correctly with the :path statement. In this case, you have to output the gemspec from the gem file using:

    $ gem specification /tmp/condi-0.0.6.gem > condi-0.0.6/condi.gemspec
    

    Or if you already have the gem installed locally, you can:

    $ gem specification condi -v=0.0.6 > condi-0.0.6/condi.gemspec
    

    Now, update the Gemfile with the line:

    gem 'condi', '0.0.6', :path => 'vendor/gems/condi-0.0.6'
    

    NOTE: “Unlike :git, bundler does not compile C extensions for gems specified as paths.” [man gemfile] So this only works for pure ruby gems without native extensions! Be warned!

    Next, uninstall the gem from your gemset:

    $ gem uninstall condi
    Successfully uninstalled condi-0.0.6
    

    And returning to the rails root environment, try to run the rails console:

    $ cd ../..
    $ rails c
    Loading development environment (Rails 3.1.3)
    1.9.3-p0 :001 > 
    

    Success!! Your pure ruby gem is now effectively frozen in a Rails 3 app.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to deploy a small rails3 app to a FreeBSD host using capistrano
I'm using Heroku to deploy a Rails3 App for months. Until now, deploying my
I already have a deploy.rb that can deploy my app on my production server.
Can I deploy SQL Server Express with my desktop application just like builtin database?
Can anyone give me some pointers on how I could deploy my rails app
I'm using Subversion and Capistrano to deploy my rails app. Part of the organization
I am about to deploy a web app using MongoDB as storage. The problem
I'm trying to deploy my Rails app to my webhost (DreamHost) using Capistrano but
I'm looking at ways to deploy a Ruby on Rails app (running on JRuby)
I've managed to deploy my app to production using Capistrano, but I don't understand

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.