Deploying bundled applications
Gemfile.lockto source control, but ignore the
.bundlefolder, which is specific to each machine.
$ echo ".bundle" >> .gitignore $ git add Gemfile Gemfile.lock .gitignore $ git commit -m "Add Bundler support"
Manual deploymentIn your deploy script, after updating to the latest code, install your bundle to the
vendor/bundledirectory, ensuring all your dependencies are met.
$ bundle install --deployment
Start your application servers as usual, and your application will use your bundled environment with the exact same gems you use in development.
If you have run
bundle package, the cached
gems will be used automatically.
Automatic deployment with Capistrano
cap deploywill now automatically run
bundle installon the remote server with deployment-friendly options. A list of options that can be changed is available in the help for the cap task. To see it, run
cap -e bundle:install.
Automatic deployment with VladThere is a default Vlad task available. To make it available, add this line to the Vlad
vlad:bundle:installtask will be available for use. Make sure it is run as part of your deploy. For example:
task "vlad:deploy" => %w[ vlad:update vlad:bundle:install vlad:start_app vlad:cleanup ]
After deployingMake sure to use
bundle execto run any executables from gems in the bundle
$ bundle exec rake db:setup
--binstubsoption on the install command to generate executable binaries that can be used instead of
HerokuWhen you deploy to Heroku, Bundler will be run automatically as long as a Gemfile is present. If you check in your Gemfile.lock, Heroku will run
`bundle install --deployment`. If you want to exclude certain groups using the
--withoutoption, you need to use
Heroku Bundler Documentation
$ heroku config:add BUNDLE_WITHOUT="test development" --app app_name