代码之家  ›  专栏  ›  技术社区  ›  anonn023432

部署到eb时升级ruby版本

  •  0
  • anonn023432  · 技术社区  · 6 年前

    我在Ruby上有一个Production Rails应用程序 2.2.5 但是我把我的应用程序更新到了Ruby 2.5.3 和铁轨从 4.2 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版本?

    1 回复  |  直到 6 年前
        1
  •  2
  •   Justin Howard    6 年前

    弹性Beanstalk在平台中设置了Ruby版本(您可以将其视为基础AMI)。要升级这个,您需要 update your platform version .

    根据您使用的Web服务器的不同,您可能需要:

    • 运行Ruby 2.5(Puma)的64位Amazon Linux 2018.03 v2.8.7
    • 运行Ruby 2.5的64位Amazon Linux 2018.03 v2.8.7(独立客运)