hi i have an instance of locomotivecms loaded locally which is all working perfectly, though when i push the files to heroku i am getting the below errors, and i cant seem to pin point what is causing the app to restart

    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=
有帮助吗?

解决方案

From the looks of it your problem is to do with your connection to your mongodb. I think this maybe as simple as just ensuring that you have started the MongoDB service. Take a look at the following link it MongoDB Installation. Dependent on which OS you are on will depend on which commands you need to execute. But I thoroughly believe you should take a look and ensure you have installed it correctly and the service is running, as this is the root of your problem.

Further to this also found out that you have to install the MongoHQ add-on in Heroku. This creates a MONGOHQ_URL ENV variable which supposedly is what your application uses to connect to the database.

MongoHQ - Heroku Add on

Command to add MongoHQ - heroku addons:add mongohq

Also you may want to look at the following MongoDB - Ruby to ensure your database.yml is setup correctly. You will see under the section highlighted Mongoid 2.x. Dependent on what version you are using will deter the setup you follow as you will notice as you scroll further down there is a section for Mongoid 3.x. Hope this helps.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top