Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with Heroku deployment #37

Open
PhilCoggins opened this issue Apr 24, 2020 · 7 comments
Open

Issues with Heroku deployment #37

PhilCoggins opened this issue Apr 24, 2020 · 7 comments

Comments

@PhilCoggins
Copy link

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
Copy link
Author

Literally just found rubygems/rubygems#3304

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

@jacobthemyth
Copy link
Contributor

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

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

@jacobthemyth
Copy link
Contributor

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.

@conarro
Copy link

conarro commented May 20, 2020

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.

@ashkulz
Copy link
Contributor

ashkulz commented Jul 17, 2020

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

@iamrahulroy
Copy link

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.

@rsanheim
Copy link

rsanheim commented Jan 11, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants