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

bundler install --without 'deployment test' not worked with puma prune_bundler #1593

Closed
zw963 opened this issue Jun 12, 2018 · 5 comments
Closed
Labels

Comments

@zw963
Copy link

zw963 commented Jun 12, 2018

Steps to reproduce

puma config with following special config:

# ....
workers ENV.fetch("WEB_CONCURRENCY") { 2 }

prune_bundler
if ENV['APP_FULL_PATH'].nil?
  fail 'Puma phased restart need specify APP_FULL_PATH env!'
else
  directory ENV['APP_FULL_PATH']
end
  1. I run app in docker, for reduce disk usage and build time, i just want
    bundler only install gems which need in production.

So, i use following pattern in Dockerfile.

# ...
RUN bundle install --without 'development test' --deployment --retry=5
# ...

Expected behavior

When run puma with this config. (prune_bunder and workers must set),

we expect puma server is startup correctly

Actual behavior

raise Exception when puma start a new worker process.

Could not find public_suffix-3.0.2 in any of the sourcesCould not find public_suffix-3.0.2 in any of the sources ( (Bundler::GemNotFound)

Others

Following three case worked:

  1. If remove workers config, it worked.
  2. if remove prune_bunder, it worked too.
  3. Or, if just use bundle install no --without config, config not need change, all work well.

System configuration

Ruby version:
2.5.2
Rails version:
5.1.6
Puma version:
3.11.4

@zw963
Copy link
Author

zw963 commented Jun 12, 2018

As mention in above, if remove prune_bundler, it worked.

I have another question, is there any cases need prune_bundler must be add for puma phased restart?

Thanks

@t-anjan
Copy link

t-anjan commented Aug 20, 2018

I faced a very similar issue. More details here: rubygems/bundler#6667 .

This comment by @deivid-rodriguez helped me find the root cause of the issue, which is due to the usage of a deprecated bundler method in the launcher.rb of the Puma gem.

Maintainers - Please let me know if I should create a PR with the alternate bundler method.

@zw963
Copy link
Author

zw963 commented May 2, 2019

Hi, Here have a new issue i thought more relevant with this.

Create a Dockerfile, it worked on default config/puma.rb

This Dockerfile use ruby:2.3.8-alpine3.8, run a rails 5.2 application,
Use bundler 2.0.1 in Gemfile.lock, rubygems and bundler verison
is updated to newest.

All work well use default config/puma.rb

Change to use config/puma_production.rb, enable multi-process.

Add following code to puma config:

require 'etc'; workers ENV.fetch('WEB_CONCURRENCY', Etc.nprocessors).to_i

prune_bundler
if ENV['APP_FULL_PATH'].nil?
  fail 'Need specify APP_FULL_PATH'
else
  directory ENV['APP_FULL_PATH']
end

Get errors

/app # bundle exec puma -C config/puma_production.rb 
fatal: not a git repository (or any of the parent directories): .git
* Pruning Bundler environment
[334] Puma starting in cluster mode...
[334] * Version 3.12.0 (ruby 2.3.8-p459), codename: Llamas in Pajamas
[334] * Min threads: 0, max threads: 16
[334] * Environment: production
[334] * Process workers: 8
[334] * Phased restart available
[334] * Listening on tcp://0.0.0.0:3000
[334] Use Ctrl-C to stop
[339] + Gemfile in context: /app/Gemfile
[343] + Gemfile in context: /app/Gemfile
[347] + Gemfile in context: /app/Gemfile
[351] + Gemfile in context: /app/Gemfile
[355] + Gemfile in context: /app/Gemfile
[359] + Gemfile in context: /app/Gemfile
[363] + Gemfile in context: /app/Gemfile
[367] + Gemfile in context: /app/Gemfile
You must use Bundler 2 or greater with this lockfile.You must use Bundler 2 or greater with this lockfile.

[371] + Gemfile in context: /app/Gemfile
You must use Bundler 2 or greater with this lockfile.
[375] + Gemfile in context: /app/Gemfile
You must use Bundler 2 or greater with this lockfile.
[377] + Gemfile in context: /app/Gemfile
[383] + Gemfile in context: /app/Gemfile
You must use Bundler 2 or greater with this lockfile.
[387] + Gemfile in context: /app/Gemfile
You must use Bundler 2 or greater with this lockfile.
[391] + Gemfile in context: /app/GemfileYou must use Bundler 2 or greater with this lockfile.

[395] + Gemfile in context: /app/Gemfile
You must use Bundler 2 or greater with this lockfile.

After comment prune_bundler, this issue is gone.

So, same issue, Right?

@nateberkopec
Copy link
Member

I believe this will be fixed by #1893, if it isn't already fixed on master.

@zw963
Copy link
Author

zw963 commented Sep 20, 2019

Cool, i will test above example when this fix is merge into master.

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

No branches or pull requests

3 participants