bootboot icon indicating copy to clipboard operation
bootboot copied to clipboard

Issues with Heroku deployment

Open PhilCoggins opened this issue 4 years ago • 7 comments

Hello, and thank you for this Bundler plugin.

I am trying to deploy a review app to Heroku with this plugin. It seems to install perfectly fine:

-----> Ruby app detected
-----> Installing bundler 2.0.2
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.6.5
-----> Installing dependencies using bundler 2.0.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Fetching gem metadata from http://rubygems.org/.
       Resolving dependencies...
       Fetching bootboot 0.1.2
       Installing bootboot 0.1.2
       Using bundler 2.0.2
       Installed plugin bootboot
...
       Bundle complete! 180 Gemfile dependencies, 312 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into `./vendor/bundle`
       Post-install message from i18n:

However, my postdeploy script invokes a rake task and raises the following.

bundler: failed to load command: rake (/app/vendor/bundle/ruby/2.6.0/bin/rake)
Bundler::Dsl::DSLError: 
[!] There was an error parsing `Gemfile`: cannot load such file -- /tmp/build_716f2567b68141f1bd17fe9cd59ff266/.bundle/plugin/gems/bootboot-0.1.2/plugins.rb. Bundler cannot continue.
 #  from /app/Gemfile:275
 #  -------------------------------------------
 #  gem "sassc-rails", "2.1.1"
 >  Plugin.send(:load_plugin, "bootboot") if Plugin.installed?("bootboot")
 #  
 #  -------------------------------------------
  /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/plugin.rb:273:in `load'
  /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/plugin.rb:273:in `load_plugin'
  /app/Gemfile:275:in `eval_gemfile'
  /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/dsl.rb:47:in `instance_eval'
  /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/dsl.rb:47:in `eval_gemfile'
  /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/dsl.rb:12:in `evaluate'
  /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/definition.rb:34:in `build'
  /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler.rb:135:in `definition'
  /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler.rb:101:in `setup'
  /app/vendor/bundle/ruby/2.6.0/gems/bundler-2.0.2/lib/bundler/setup.rb:20:in `<top (required)>'
  /app/vendor/ruby-2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
  /app/vendor/ruby-2.6.5/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'

I'm still researching a solution on my end but was hoping someone else has experienced this? Happy to provide any info necessary.

Thanks!

PhilCoggins avatar Apr 24 '20 19:04 PhilCoggins

Literally just found https://github.com/rubygems/rubygems/issues/3304

Feel free to close unless there's any suggestions 😊.

PhilCoggins avatar Apr 24 '20 19:04 PhilCoggins

We ran into this and added a script to rename the index paths:

sed -i “s|$(pwd)|/app|“ .bundle/plugin/index

jacobthemyth avatar Apr 24 '20 23:04 jacobthemyth

By the way, we run that as part of the build process using https://github.com/weibeld/heroku-buildpack-run so that the paths are modified prior to the slug being built.

jacobthemyth avatar Apr 25 '20 19:04 jacobthemyth

We ran into this and added a script to rename the index paths:

sed -i “s|$(pwd)|/app|“ .bundle/plugin/index

☝️ worked like a charm! Reposting code snippet without smart quotes:

sed -i "s|$(pwd)|/app|" .bundle/plugin/index

By the way, the heroku-buildpack-run buildpack can be after the Ruby buildpack. Just FYI for future readers.

conarro avatar May 20 '20 16:05 conarro

This hit us when using Elastic Beanstalk as well, and added this to ebextensions:

files:
  # Runs before `99_reload_app_server.sh`:
  "/opt/elasticbeanstalk/hooks/appdeploy/enact/98_reconfigure_bundle.sh":
    mode: "000775"
    owner: root
    group: users
    content: |
      #!/usr/bin/env bash

      EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir)
      EB_SUPPORT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_dir)
      EB_APP_USER=$(/opt/elasticbeanstalk/bin/get-config container -k app_user)
      EB_APP_CURRENT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir)

      # Setting up correct environment and ruby version so that bundle can load all gems
      . $EB_SUPPORT_DIR/envvars
      . $EB_SCRIPT_DIR/use-app-ruby.sh

      # Make sure that the .bundle directory is recreated
      if [ -n "$DEPENDENCIES_NEXT" ]; then
        rm -fr $EB_APP_CURRENT_DIR/.bundle
        cd $EB_APP_CURRENT_DIR
        su -s /bin/bash -c "bin/bundle install" $EB_APP_USER
      fi

ashkulz avatar Jul 17 '20 06:07 ashkulz

By the way, the heroku-buildpack-run buildpack can be after the Ruby buildpack. Just FYI for future readers.

@conarro worked like a charm. Thanks for the tip.

iamrahulroy avatar May 25 '21 05:05 iamrahulroy

Note that the root issue here will break Capistrano deployments using bootboot if you are cleaning up old releases, as the plugin dir will point at a release directory that will eventually get cleaned up.

rsanheim avatar Jan 11 '22 01:01 rsanheim