Open pvande opened 1 year ago
I previously looked into this in https://github.com/heroku/heroku-buildpack-ruby/pull/351 though that was a long time ago and quite a bit has changed.
This fork of the buildpack supports it https://www.fastruby.io/blog/how-to-run-multiple-versions-of-rails-on-heroku.html
I've been thinking that it will be difficult to hunt down all the locations where it's expected that Gemfile/Gemfile.lock
combination will be used at the root of the application.
An alternative way forward could be to detect when BUNDLE_GEMFILE
is set to something different and then move those files into the root of the app before heroku/ruby
runs.
We could make a micro buildpack that does this and not even need to touch heroku/ruby
.
Hey @schneems I would like to attempt the micro buildpack you suggested, do you have any pointers to help me get started?
I have not created a buildpack before, am I over-ambitious?
Hey @schneems we opened a PR that could potentially enable setting the Gemfile via an ENV value. When you have a moment could you take a look and see if this could potentially be merged into the official buildpack? https://github.com/fastruby/heroku-buildpack-ruby/pull/2
I'm trying to set up dual-booting for my application, using a similar approach to the
next_rails
gem. Put simply, my application has aGemfile
/Gemfile.lock
pair for the "stable" configuration, and aGemfile.next
/Gemfile.next.lock
pair for the configuration being validated.In my local environment, I can switch between these by setting
BUNDLE_GEMFILE=Gemfile.next
as necessary. In this way, my "next" environment can explore updates to Ruby, Rails, and other dependencies over the long-term without endangering my production app or holding up the development pipeline.For all appearances, however, this buildpack doesn't play nicely with such a configuration. Bundler version inference, Ruby version inference, and initial gem installation are done (at least in part) based on the
Gemfile.lock
file, regardless of the value ofBUNDLE_GEMFILE
, which causes mismatches during build startup.