How can I solve this trouble to deploy a Rails App to Heroku?

后端 未结 3 1358
故里飘歌
故里飘歌 2020-12-01 23:13

I\'m having trouble to deploy a rails app to Heroku.

When I tried to push my project to Heroku (git push heroku master), it gave m

相关标签:
3条回答
  • 2020-12-01 23:35

    I am posting solution might be late but can help other. Solution most people posting asking to upgrade ruby version. Updating ruby version in an application might be time consuming some time. But with below solution application can deploy without updating ruby version.

    Current stack heroku uses is heroku-18, Having image of Ubuntu 18.04. It have minimum supported runtime is ruby 2.4.5, other information here.

    To run aplication with below this ruby version you need to downgrade heroku stack for your application.

    Open console and run heroku stack you will find.

      cedar-14
      container
      heroku-16
    * heroku-18
    

    You need to downgrade to stack which support your ruby version. For ruby 2.3.x you can set heroku-16

    heroku stack:set heroku-16
    

    Now if you run heroku stack you will find heroku-16 stack set for your application.

      cedar-14
      container
    * heroku-16
      heroku-18
    

    You might get security vulnerability issue on console, Information here.

    Try update only sprockets gem to minimum 3.7.2 like:

    bundle update sprockets --bundler '3.7.2'
    

    Or you can set :

    config.assets.compile = false # Disables security vulnerability
    

    Run git push heroku master. Boom!! Your application deployed successfully.

    0 讨论(0)
  • 2020-12-01 23:37

    Please check Ubuntu packages that are installed in each stacks(cedar 14,cedar 16 and cedar 18) in here.

    https://devcenter.heroku.com/articles/stack-packages#installed-ubuntu-packages

    search for 'ruby' in the list and choose the appropriate cedar stack for the application.

    I hope this information can help the others.

    0 讨论(0)
  • 2020-12-01 23:46

    You should have a .ruby-version file with 2.5.3 in it

    0 讨论(0)
提交回复
热议问题