Update a projects bundler version
We use bundler to maintain a projects gems. Unfortunately bundler v1 itself is incompatible with bundler v2.
You have two ways to update bundler on the server.
with capistrano-opscomplete (recommended)
If you use our gem capistrano-opscomplete in your project, you can tell opscomplete to install the required bundler version:
Add the following line to
deploy.rb. If you use different deployment targets, add the follwoing line to the specific target configuration file. (e.g
set :bundler_version, '<VERSION>' #e.g '~>2'
Bundler v2 needs rubygems 3.0+! You are not sure, weather rubygems 3.0 is already installed on the server or not? Tell opscomplete to install a specific rubygems version as well:
set :rubygems_version, '<VERSION>' #e.g. '3.0.6'
Now update the projects bundler version, push the changes and deploy to the server.
If you need to upgrade bundler to the latest version on a server with opscomplete, you have to do it by yourself:
gem install bundler -v '~>2'
After you installed bundler v2, tell bundler to update your Gemfile.lock and bundler binary
bundle update --bundler bundle install
Common issues / mistakes:
- Be careful!
bundler update --bundler produces nearly the same output, but does not update your Gemfile.lock
Even if some people on the web say the
bundler binaries can be used interchangeably.
- Rubygems can't find bundle executable
- Do not change the bundler version in your Gemfile.lock manually, it may work on your local machine, but not on the server.
If you do not need bundler v1 anymore, uninstall the old version with
gem uninstall bundler
Rubygems asks you which version of bundler you want to uninstall.
Now update the project on your local machine the same way, and deploy it to the server.