Shopify / bootboot

Dualboot your Ruby app made easy
MIT License
416 stars 35 forks source link

How to workaround bundle install --deployment? #26

Closed ecbrodie closed 5 years ago

ecbrodie commented 5 years ago

There is a note in the README that bootboot won't work if bundle install --deployment is being used. This is indeed the case on the project I'm working on. I specify bootboot in the Gemfile so that I can upgrade the project from Rails 4 to Rails 5 in a dual-boot fashion, but we use bundle install --deployment in our Dockerfile when deploying our app's Docker image to our production servers.

The original note about bootboot not working with Bundler's deployment flag was originally added without any further context about why (@eileencodes do you have more information about that?). And the note says that it won't work with Bundler versions <= 2.0.1. As of writing, that still encompasses every version of Bundler that exists.

What workarounds exist to allow me to use bundle install --deployment on a project that also uses bootboot?

eileencodes commented 5 years ago

What workarounds exist to allow me to use bundle install --deployment on a project that also uses bootboot?

Looking at https://github.com/bundler/bundler/issues/6795 and https://github.com/bundler/bundler/pull/6805 I figured 2.0 bundler was fixed and that's the work around. We can't use 2.0 bundler yet so I wasn't able to test.

We ended up not using bootboot and continuing to use our hacked bundler version. The only workaround is to use a combination of bootboot and a monkey patch for bundler.

ecbrodie commented 5 years ago

Thanks for the quick reply @eileencodes .

Basically, I'm at a point where I'm concluding that bootboot is practically unusable for any app that deploys to production as a Docker build. Although this may be fixed on Bundler's mainline, the Bundler release process is very opaque and thus I have no guidance as to when they will cut a new release. I could run my own fork of Bundler until they release, but moving away from mainline Bundler is not ideal.

@Edouard-chin any advice from you, as the main contributor of this plugin?

eileencodes commented 5 years ago

I could run my own fork of Bundler until they release, but moving away from mainline Bundler is not ideal.

It's not ideal, and this may be an unpopular opinion, but I think that upgrading Rails is more important than using mainline bundler. Rails 4 is on a fast train to no longer being supported at all by the Rails Core team. Once 6 comes out (very 🔜) 4.2 won't be supported anymore.

Edouard-chin commented 5 years ago

Yeah sadly this bundler bug make things complicated if you are running bundler with the deployment flag (we also do that). There is no workaround but to monkeypatch the gemfile yourself and add the bootboot plugin conditionally plugin 'bootboot', '~> 0.1.2' unless Bundler.settings[:frozen].

In our app we used this plugin mainly to make sure the Gemfile.lock/Gemfile_next.lock were always in sync

ecbrodie commented 5 years ago

@Edouard-chin I appreciate the reply from you and the effort that you and your team have gone into maintaining this project. It's too bad that Bundler's release schedule can't keep up with the demand for Bootboot. I just submitted PR #27 to add a note about the workaround to the README.

My work team ended up just working on the Rails 5 upgrade in a single branch, since the project and the development team was small enough that it wouldn't cause too much of a disruption without dual-booting.

bogdanvlviv commented 5 years ago

@ecbrodie Just want to notice that Bundler 2.0.2 was released (it includes https://github.com/bundler/bundler/pull/6805) so you can update bundler to this version instead of using the workaround.

ecbrodie commented 5 years ago

That's good to hear that they finally released a Bundler update. Their maintenaners were being vague about when this would happen.

Regardless, it's too late for me with the project I'm working on. We deployed our Rails 5 upgrade without dual booting.