Rails应用程序在Heroku上崩溃,但在本地运行良好 - > “状态从开始变为崩溃” [英] Rails app crashes on Heroku but runs fine locally -> "State changed from starting to crashed"

查看:132
本文介绍了Rails应用程序在Heroku上崩溃,但在本地运行良好 - > “状态从开始变为崩溃”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

repo at:git@github.com:assafshomer / sample_app.git


  1. 这个程序是我的学习应用程序,基于Michael Hartl的优秀

  2. 应用程序在开发中运行顺利,测试套件全部为绿色

  3. 部署到Heroku时,我立即收到以下错误:应用程序错误。应用程序中发生错误,您的页面无法投放

  4. 升级到Rails4后,问题开始(但我知道问题不是Rails4本身,因为例如git:// github .com / railstutorial / sample_app_rails_4.git部署到Heroku)

  5. 我知道你会问你是否在Heroku上迁移数据库?我做了我甚至运行pg:reset,然后再次rake db:在Heroku上迁移,以防万一。他们似乎运行正常。

Heroku日志不会提供任何信息(至少我没有看到有用)

  2013-05-25T22:11:26.070468 + 00:00 heroku [web.1]:进程退出
状态0
2013-05-25T22:11:26.083572 + 00:00 heroku [web.1]:状态从
开始到崩溃
2013-05-25T22:13:09.372294 +00:00 heroku [run.4121]:状态从
更改为完成
2013-05-25T22:13:09.357146 + 00:00 heroku [run.4121]:进程退出
status 1
2013-05-25T22:13:50.829887 + 00:00 heroku [路由器]:at =错误代码= H10
desc =App crashedmethod = GET path = / host = devsampleapp.herokuapp.com
fwd =93.172.16.63dyno = connect = service = status = 503 bytes =

还没有出现rails控制台:

  2013-05-26T06:41:34.942569+ 00:00 heroku [api]:命令`bin / rails console`由assafshomer@gmail.com启动过程
2013-05-26T06:41:38.312107 + 00 :00 heroku [run.5325]:等待客户端
2013-05-26T06:41:38.339816 + 00:00 heroku [run.5325]:使用命令`bin / rails console`启动进程
2013 -05-26T06:41:39.112396 + 00:00 heroku [run.5325]:客户端连接关闭。发送SIGHUP到所有进程
2013-05-26T06:41:40.329832 + 00:00 heroku [run.5325]:进程退出状态0
2013-05-26T06:41:40.357047 + 00: 00 heroku [run.5325]:状态从开始完成

我向Heroku提交了支持票,但这只会在星期二早些时候出现,我很沮丧地得到这个升级到rails4已经工作了,所以解决这个谜题的任何帮助将会非常感谢。



显然,最好的复制方式是克隆这个repo并部署到heroku:)



谢谢!!



Assaf Shomer(assafshomer at gmail)

解决方案

在rails4中的几个文件( bin负责启动阶段的/ rails bin / rake bin / bundle 被新增或从不同的位置移动(例如 script / rails )。



似乎在应用程序中缺少它们。奇怪的事情确实是它的工作在你的本地机器,但不是在英雄 - 但我尝试并添加了他们。



您可以通过简单地运行 rake rails:update:bin 来创建它们。 >

repo at: git@github.com:assafshomer/sample_app.git

  1. This app is my learning app based on Michael Hartl's excellent railstutorial.
  2. App runs smoothly in development and test suite is all green
  3. When deploying to Heroku I get the following error immediatly: "Application Error. An error occurred in the application and your page could not be served"
  4. The problem started after upgrading to Rails4 (but I know the problem is not Rails4 itself because, e.g. git://github.com/railstutorial/sample_app_rails_4.git deploys fine to Heroku)
  5. I know you are going to ask "did you migrate the db on Heroku?". I did. I even ran pg:reset and then again rake db:migrate on Heroku just in case. They seemed to have run ok.

Heroku logs don't give any info either (at least, nothing I can see as useful)

2013-05-25T22:11:26.070468+00:00 heroku[web.1]: Process exited with
status 0
2013-05-25T22:11:26.083572+00:00 heroku[web.1]: State changed from
starting to crashed
2013-05-25T22:13:09.372294+00:00 heroku[run.4121]: State changed from up
to complete
2013-05-25T22:13:09.357146+00:00 heroku[run.4121]: Process exited with
status 1
2013-05-25T22:13:50.829887+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path=/ host=devsampleapp.herokuapp.com
fwd="93.172.16.63" dyno= connect= service= status=503 bytes=

also the rails console doesn't come up:

2013-05-26T06:41:34.942569+00:00 heroku[api]: Starting process with command `bin/rails console` by assafshomer@gmail.com
2013-05-26T06:41:38.312107+00:00 heroku[run.5325]: Awaiting client
2013-05-26T06:41:38.339816+00:00 heroku[run.5325]: Starting process with command `bin/rails console`
2013-05-26T06:41:39.112396+00:00 heroku[run.5325]: Client connection closed. Sending SIGHUP to all processes
2013-05-26T06:41:40.329832+00:00 heroku[run.5325]: Process exited with status 0
2013-05-26T06:41:40.357047+00:00 heroku[run.5325]: State changed from starting to complete

I submitted a support ticket with Heroku, but that will only be attended to earliest Tuesday, and I'm itching to get this "upgrade to rails4" working already, so, any help in resolving this mystery will be much appreciated.

obviously, the best way to reproduce is to clone the repo and deploy to heroku :)

Thanks!!

Assaf Shomer (assafshomer at gmail)

解决方案

In rails4 several files (bin/rails, bin/rake and bin/bundle) responsible for the startup phase have been newly added or moved from different locations (e.g. script/rails).

Seems that they are missing in your application. Strange thing indeed that it works on your local machine but not on heroku - but well I tried and added them. It seems to work.

You can create them by simply running rake rails:update:bin.

这篇关于Rails应用程序在Heroku上崩溃,但在本地运行良好 - > “状态从开始变为崩溃”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆