开发者

Heroku app fails silently on launch

I'm trying to deploy an app on Heroku, and I haven't gotten it running yet. I see the Rails 500 page ("We're sorry, but something went wrong"), but wh开发者_高级运维en I heroku logs I see nothing interesting:

==> exceptional.log <==
# Logfile created on Tue Nov 02 11:27:18 -0700 2010 by logger.rb
[INFO] (init.rb:21) Tue Nov 02 18:27:18 UTC 2010 - Loading Exceptional 2.0.26 for 2.3.5

==> dyno-2858334.log <==
>> Thin web server (v1.2.6 codename Crazy Delicious)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:15336, CTRL+C to stop

==> production.log <==
# Logfile created on Tue Nov 02 11:27:17 -0700 2010

As you can see, I've installed the Exceptional addon, and Exceptional hasn't reported any exceptions.

What might fail silently during app launch on Heroku?


The answer: our app was using Sass, which attempts to write its compiled CSS to the public/ directory. On Heroku, that's on the read-only filesystem. Instead, I installed Hassle, which puts compiled Sass CSS under tmp/, which is read-write.

Heroku support discovered the problem by setting the environment to development, which allowed the error to be logged:

heroku config:add RACK_ENV=development

The Hassle site recommends adding Hassle as a plugin, but I prefer not to use plugins when I can just use gems. I got it to work by adding it to the Gemfile, and adding this to environment.rb:

# existing requires
# ...

require 'hassle'

Rails::Initializer.run do |config|
  # ...
  # existing config
  # ...

  config.middleware.use Hassle
end

Now it just works.


Try doing (from the root of your app):

heroku rake db:migrate
heroku db:push


The fact that you see Rails's 500 page means the app is working okay (e.g. it's able to start and produce a 500 error).

One issue might be that your database is not migrated. Try migrating it or upload your development database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜