ruby-on-rails - 在部署到 EB 时升级 Ruby 版本
问题描述
我在 Ruby 上有一个生产 rails 应用程序,2.2.5
但我将我的应用程序更新为 ruby2.5.3
和 rails from 4.2
to 5.2
。当我尝试将其部署到 ElasticBeanstalk 时,每次都会收到以下错误:
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.
为了解决这个问题,我使用 ssh 进入实例并rvm
在更新 ruby 版本之前安装
rvm --default use 2.5.3
在此之后,我按照错误消息中的建议更新了我bundler
的,但似乎 ruby 版本会在2.2.5
我每次关闭连接ssh
时重新设置,因为这样做
ruby -v
给2.2.5
如何更新实例上的 ruby 版本?
解决方案
Elastic Beanstalk 在平台中设置 Ruby 版本(您可以将其视为基础 AMI)。要升级它,您需要更新您的平台版本。
根据您使用的网络服务器,听起来您需要以下之一:
- 运行 Ruby 2.5 (Puma) 的 64 位 Amazon Linux 2018.03 v2.8.7
- 运行 Ruby 2.5(乘客独立)的 64 位 Amazon Linux 2018.03 v2.8.7
推荐阅读
- opengl - 如何丢弃 GLSL 计算着色器中的调用
- python - Pandas:Dataframe itertuples 布尔系列 groupby 优化
- django - Factoryboy 无法生成依赖数据库的字段
- xamarin - Xamarin Forms 错误 APT1000:在应有项目的位置找到标记 id (Android)
- html - 如何使用 flex 并排修复此流程图与 Div(用于流程图步骤)和 Container(用于内容)对齐
- node.js - IBM Cloud Functions 和 Node.js:如何获取日本时间?
- r - 删除 geom_tile 中分隔样本的灰色垂直条纹
- haskell - 在 Haskell 中输出多个文件
- ios - 传递给结构的委托属性是否也应该在结构中声明为弱?
- android - 无法使用 DataBinding 隐藏 ProgressBar