简体   繁体   中英

Upgrade Ruby version while deploying to EB

I have a production rails application on Ruby 2.2.5 but I updated my app to ruby 2.5.3 and rails from 4.2 to 5.2 . When I try to deploy this to ElasticBeanstalk I get the following errors everytime:

Warning: the running version of Bundler is older than the version that created the lockfile. 
We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Your Ruby version is 2.2.5, but your Gemfile specified 2.5.3. 
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.

To fix this I ssh'd into the instance and installed rvm before updating the ruby version using

rvm --default use 2.5.3

After this I updated my bundler as suggested in the error message but it seems like the ruby version gets reset to 2.2.5 everytime I close my connection and ssh in again because doing

ruby -v gives 2.2.5

How can I update the ruby version on my instance?

Elastic Beanstalk sets the Ruby version in the Platform (you can think of this as the base AMI). To upgrade this you'll need to update your platform version .

Depending on the web server you use, it sounds like you'll need one of:

  • 64bit Amazon Linux 2018.03 v2.8.7 running Ruby 2.5 (Puma)
  • 64bit Amazon Linux 2018.03 v2.8.7 running Ruby 2.5 (Passenger Standalone)

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