机车在当地工作,但在推到heroku时不会渲染

时间:2013-06-18 11:58:20

标签: ruby-on-rails heroku locomotivecms

嗨,我有一个本地加载的locomotivecms的实例,这一切都完美正常,但是当我将文件推送到heroku时我得到了以下错误,我似乎无法确定导致应用重启的原因

    2013-06-18T11:54:58.503474+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/mongo-1.5.2/lib/mongo/connection.rb:413:in `connect': Failed to connect to a master node at localhost:27017 (Mongo::ConnectionFailure)
2013-06-18T11:54:58.504255+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongo-1.5.2/lib/mongo/connection.rb:155:in `from_uri'
2013-06-18T11:54:58.503654+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongo-1.5.2/lib/mongo/connection.rb:574:in `setup'
2013-06-18T11:54:58.503767+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongo-1.5.2/lib/mongo/connection.rb:104:in `initialize'
2013-06-18T11:54:58.504871+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/config/database.rb:19:in `configure'
2013-06-18T11:54:58.505684+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/contexts/mongo.rb:176:in `execute'
2013-06-18T11:54:58.505684+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/criteria.rb:145:in `tap'
2013-06-18T11:54:58.506692+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2013-06-18T11:54:58.504033+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongo-1.5.2/lib/mongo/connection.rb:155:in `new'
2013-06-18T11:54:58.505538+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid.rb:146:in `master'
2013-06-18T11:54:58.505684+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/contexts/mongo.rb:262:in `block in iterate'
2013-06-18T11:54:58.505260+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/config.rb:290:in `configure_databases'
2013-06-18T11:54:58.508069+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/runner.rb:152:in `run!'
2013-06-18T11:54:58.505371+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/config.rb:223:in `master'
2013-06-18T11:54:58.505941+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/locomotive_cms-2.0.2/lib/locomotive.rb:66:in `after_configure'
2013-06-18T11:54:58.507734+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `load'
2013-06-18T11:54:58.505684+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/collection.rb:126:in `master'
2013-06-18T11:54:58.504548+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/config/database.rb:86:in `master'
2013-06-18T11:54:58.505684+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/contexts/mongo.rb:480:in `selecting'
2013-06-18T11:54:58.505684+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/collection.rb:42:in `find'
2013-06-18T11:54:58.505684+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/criteria.rb:145:in `each'
2013-06-18T11:54:58.505684+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/contexts/mongo.rb:259:in `iterate'
2013-06-18T11:54:58.505684+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/locomotive_cms-2.0.2/lib/locomotive.rb:66:in `collect'
2013-06-18T11:54:58.505684+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/mongoid-2.4.12/lib/mongoid/criteria.rb:145:in `block in each'
2013-06-18T11:54:58.505941+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/locomotive_cms-2.0.2/lib/locomotive.rb:42:in `configure'
2013-06-18T11:54:58.508069+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/controllers/controller.rb:71:in `start'
2013-06-18T11:54:58.505941+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
2013-06-18T11:54:58.506459+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:587:in `each'
2013-06-18T11:54:58.505941+00:00 app[web.1]:    from /app/config/initializers/locomotive.rb:1:in `<top (required)>'
2013-06-18T11:54:58.506692+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `eval'
2013-06-18T11:54:58.506459+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
2013-06-18T11:54:58.506459+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
2013-06-18T11:54:58.507900+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
2013-06-18T11:54:58.508069+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/bin/thin:23:in `load'
2013-06-18T11:54:58.506459+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
2013-06-18T11:54:58.505941+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
2013-06-18T11:54:58.506459+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:587:in `block in <class:Engine>'
2013-06-18T11:54:58.506459+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
2013-06-18T11:54:58.505941+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load'
2013-06-18T11:54:58.506459+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
2013-06-18T11:54:58.506692+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2013-06-18T11:54:58.505941+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load'
2013-06-18T11:54:58.506459+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
2013-06-18T11:54:58.506692+00:00 app[web.1]:    from config.ru:3:in `block in <main>'
2013-06-18T11:54:58.506459+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
2013-06-18T11:54:58.506459+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
2013-06-18T11:54:58.506692+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2013-06-18T11:54:58.506692+00:00 app[web.1]:    from config.ru:3:in `require'
2013-06-18T11:54:58.506692+00:00 app[web.1]:    from config.ru:1:in `new'
2013-06-18T11:54:58.508069+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/bin/thin:6:in `<top (required)>'
2013-06-18T11:54:58.508185+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/bin/thin:23:in `<main>'
2013-06-18T11:54:58.506692+00:00 app[web.1]:    from config.ru:1:in `<main>'
2013-06-18T11:54:58.508069+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/thin-1.5.1/lib/thin/runner.rb:187:in `run_command'
2013-06-18T11:55:00.526901+00:00 heroku[web.1]: State changed from starting to crashed
2013-06-18T11:55:00.505749+00:00 heroku[web.1]: Process exited with status 1
2013-06-18T11:55:19.174354+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=nameless-eyrie-8067.herokuapp.com fwd="58.6.242.61" dyno= connect= service= status=503 bytes=
2013-06-18T11:55:20.392737+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=nameless-eyrie-8067.herokuapp.com fwd="58.6.242.61" dyno= connect= service= status=503 bytes=

1 个答案:

答案 0 :(得分:1)

从外观上看,您的问题与您与mongodb的关联有关。我认为这可能就像确保你已经启动MongoDB service一样简单。请查看以下链接MongoDB Installation。取决于您所使用的操作系统将取决于您需要执行哪些命令。但我完全相信你应该看看并确保你已正确安装它并且服务正在运行,因为这是你问题的根源。

此外还发现你必须在Heroku中安装MongoHQ插件。这将创建一个MONGOHQ_URL ENV变量,该变量应该是您的应用程序用于连接数据库的变量。

MongoHQ - Heroku Add on

添加MongoHQ的命令 - heroku addons:add mongohq

此外,您可能需要查看以下MongoDB - Ruby以确保正确设置database.yml。您将在突出显示 Mongoid 2.x 的部分下看到。根据您使用的版本将阻止您关注的设置,因为当您向下滚动时,会有一个 Mongoid 3.x 的部分。希望这可以帮助。