简体   繁体   中英

Rails: How to get puma 3.11 for AWS Elasticbeanstalk application?

I am trying to deploy a Rails app on a new EC2 instance. EB is using puma 2.16.0 (which is 2 years old) instead of the version (3.11.0) I have defined in Gemfile.lock . This is a problem for me because the old puma version depends on an older version of rack gem. But one of my new dependency requires the latest version of rack gem

Current platform of EB: Puma with Ruby 2.3 running on 64bit Amazon Linux/2.4.4

So EB automatically uses the older puma and older rack version resulting in a conflict with my latest gems:

/opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/bundler-1.15.0/lib/bundler/runtime.rb:317:in check_for_activated_spec!: You have already activated rack 1.6.8, but your Gemfile requires rack 2.0.5. Prepending bundle exec to your command may solve this. (Gem::LoadError)

I see both versions (the default from EB and the one from Gemfile.lock) installed:

[ec2-user gems]$ ls -l /opt/rubies/ruby-2.3.4/lib/ruby/gems/2.3.0/gems/puma*

puma-2.16.0

puma-3.11.4

Is there a way to use our own version of puma?

Current platform of EB: Puma with Ruby 2.3 running on 64bit Amazon Linux/2.4.4

You're using a pretty old version of the ElasticBeanstalk Puma platform - the latest version is Puma with Ruby 2.5 running on 64bit Amazon Linux/2.7.2 . Unfortunately, that still comes with Puma 2.16. Installing two different versions of Puma simultaneously will probably cause issues.

I think you have a few options:

  1. Switch from puma to passenger.
  2. Downgrade the other gem that depends on rack to a version that can work with the older version of rack
  3. Ask AWS support to upgrade Puma in the platform.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM