Why Rails is not finding the gems in the vendored bundle when unicorn starts its workers?

June 20, 2018 229 views
Ruby on Rails One-Click Install Apps Ubuntu 16.04

I'm using the one-click rails droplet and deploying with Capistrano. So far everything seems to work after making small adjustments on the project directory for nginx and unicorn config files, then I ran bundle install --deployment --without=development,test --path=vendor/bundle but requests to the droplet return a bad gateway error, and

when I run sudo tail -f /var/log/unicorn/unicorn.log I see the following happening for each of its workers upon trying to start (error log below).

Thanks in advance and pĺease let me know if more info is needed.

I, [2018-06-20T03:29:07.903622 #7409]  INFO -- : worker=1 spawning...
Exception `Bundler::GemNotFound' at /home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/spec_set.rb:87 - Could not find rake-12.3.1 in any of the sources
Exception `Bundler::GemNotFound' at /home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/definition.rb:180 - Could not find rake-12.3.1 in any of the sources
Exception `Bundler::GemNotFound' at /usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55 - Could not find rake-12.3.1 in any of the sources
Exception `Bundler::GemNotFound' at /home/rails/skyclub-web/releases/20180620015335/config/application.rb:1 - Could not find rake-12.3.1 in any of the sources
I, [2018-06-20T03:29:07.906179 #19761]  INFO -- : worker=1 spawned pid=19761
Exception `Bundler::GemNotFound' at /home/rails/skyclub-web/releases/20180620015335/config/environment.rb:2 - Could not find rake-12.3.1 in any of the sources
Exception `Bundler::GemNotFound' at config.ru:4 - Could not find rake-12.3.1 in any of the sources
E, [2018-06-20T03:29:07.906525 #19751] ERROR -- : Could not find rake-12.3.1 in any of the sources (Bundler::GemNotFound)
/home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/spec_set.rb:87:in `block in materialize'
/home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/spec_set.rb:80:in `map!'
/home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/spec_set.rb:80:in `materialize'
/home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/definition.rb:176:in `specs'
/home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/definition.rb:235:in `specs_for'
/home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/definition.rb:224:in `requested_specs'
/home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/runtime.rb:118:in `block in definition_method'
/home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/runtime.rb:19:in `setup'
/home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler.rb:100:in `setup'
/home/rails/rails_project/vendor/bundle/gems/bundler-1.14.6/lib/bundler/setup.rb:20:in `<top (required)>'
/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/home/rails/skyclub-web/releases/20180620015335/config/boot.rb:3:in `<top (required)>'
/home/rails/skyclub-web/releases/20180620015335/config/application.rb:1:in `require_relative'
/home/rails/skyclub-web/releases/20180620015335/config/application.rb:1:in `<top (required)>'
/home/rails/skyclub-web/releases/20180620015335/config/environment.rb:2:in `require_relative'
/home/rails/skyclub-web/releases/20180620015335/config/environment.rb:2:in `<top (required)>'
config.ru:4:in `require_relative'
config.ru:4:in `block in <main>'
/home/rails/rails_project/vendor/bundle/gems/rack-2.0.5/lib/rack/builder.rb:55:in `instance_eval'
/home/rails/rails_project/vendor/bundle/gems/rack-2.0.5/lib/rack/builder.rb:55:in `initialize'
config.ru:1:in `new'
config.ru:1:in `<main>'
/home/rails/rails_project/vendor/bundle/gems/unicorn-5.3.0/lib/unicorn.rb:56:in `eval'
/home/rails/rails_project/vendor/bundle/gems/unicorn-5.3.0/lib/unicorn.rb:56:in `block in builder'
/home/rails/rails_project/vendor/bundle/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:796:in `build_app!'
/home/rails/rails_project/vendor/bundle/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:661:in `init_worker_process'
/home/rails/rails_project/vendor/bundle/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:683:in `worker_loop'
/home/rails/rails_project/vendor/bundle/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:549:in `spawn_missing_workers'
/home/rails/rails_project/vendor/bundle/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:563:in `maintain_worker_count'
/home/rails/rails_project/vendor/bundle/gems/unicorn-5.3.0/lib/unicorn/http_server.rb:293:in `join'
/home/rails/rails_project/vendor/bundle/gems/unicorn-5.3.0/bin/unicorn:126:in `<top (required)>'
/home/rails/rails_project/vendor/bundle/bin/unicorn:22:in `load'
/home/rails/rails_project/vendor/bundle/bin/unicorn:22:in `<main>'
/home/rails/rails_project/vendor/bundle/bin/ruby_executable_hooks:15:in `eval'
/home/rails/rails_project/vendor/bundle/bin/ruby_executable_hooks:15:in `<main>'
Be the first one to answer this question.