2012-04-16 47 views
1

嗨,大家好像標題解釋我已經從git://github.com/barmstrong/ribbot.git下載了一個開源代碼ribbot。我是ruby和rails的新手,但是我設置了自己的環境,並且能夠讓我的代碼在本地機器上運行。我想使用heroku作爲我的服務器基礎解決方案。我繼續推動這個應用程序heroku。 Heroku似乎告訴我,該應用程序運行正常,但我一直通過開源代碼重定向到一個錯誤頁面,但它並沒有在我的本地機器上這樣做。我懷疑這與mongo有關,我已經下載了MongoHQ for heroku的補充,並且仍然遇到了這個問題。我知道,此代碼使用mongoid通過mongo db獲取rails在heroku上的工作

2012-04-16T19:06:47+00:00 app[web.1]: localhost:11211 failed (count: 2) 
2012-04-16T19:06:47+00:00 app[web.1]: 
2012-04-16T19:06:47+00:00 app[web.1]: 
2012-04-16T19:06:47+00:00 app[web.1]: Started GET "/" for 208.124.140.154 at 2012-04-16 19:06:47 +0000 
2012-04-16T19:06:47+00:00 app[web.1]: allow_dynamic_fields is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: autocreate_indexes is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: identity_map_enabled is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: include_root_in_json is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: include_type_for_serialization is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: max_retries_on_connection_failure is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: parameterize_keys is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: scope_overwrite_exception is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: persist_in_safe_mode is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: preload_models is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: raise_not_found_error is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: skip_version_check is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: time_zone is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: use_utc is not a valid option for Mongo::Connection 
2012-04-16T19:06:47+00:00 app[web.1]: timestamped_migrations is not a valid option for Mongo::Connection 
2012-04-16T19:06:50+00:00 app[web.1]: 
2012-04-16T19:06:50+00:00 app[web.1]: Mongo::ConnectionFailure (Failed to connect to a master node at localhost:27017): 
2012-04-16T19:06:50+00:00 app[web.1]: app/controllers/application_controller.rb:19:in `current_forum' 
2012-04-16T19:06:50+00:00 app[web.1]: app/controllers/application_controller.rb:40:in `require_current_forum!' 
2012-04-16T19:06:50+00:00 app[web.1]: 
2012-04-16T19:06:50+00:00 app[web.1]: 
2012-04-16T19:06:50+00:00 app[web.1]: cache: [GET /] miss 
2012-04-16T19:06:50+00:00 app[web.1]: Processing by PostsController#index as HTML 
2012-04-16T19:06:50+00:00 app[web.1]: Completed 500 Internal Server Error in 2997ms 
2012-04-16T19:06:50+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/gems/exception_notification_rails3-1.2.0/lib/exception_notifier/views/exception_notifier/_request.text.erb (0.2ms) 
2012-04-16T19:06:50+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/gems/exception_notification_rails3-1.2.0/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms) 
2012-04-16T19:06:50+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/gems/exception_notification_rails3-1.2.0/lib/exception_notifier/views/exception_notifier/_session.text.erb (0.2ms) 
2012-04-16T19:06:50+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/gems/exception_notification_rails3-1.2.0/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms) 
2012-04-16T19:06:50+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/gems/exception_notification_rails3-1.2.0/lib/exception_notifier/views/exception_notifier/_environment.text.erb (23.9ms) 
2012-04-16T19:06:50+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/gems/exception_notification_rails3-1.2.0/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms) 
2012-04-16T19:06:50+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/gems/exception_notification_rails3-1.2.0/lib/exception_notifier/views/exception_notifier/_backtrace.text.erb (0.1ms) 
2012-04-16T19:06:50+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/gems/exception_notification_rails3-1.2.0/lib/exception_notifier/views/exception_notifier/_title.text.erb (0.0ms) 
2012-04-16T19:06:50+00:00 app[web.1]: Rendered vendor/bundle/ruby/1.9.1/gems/exception_notification_rails3-1.2.0/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb (26.8ms) 
2012-04-16T19:06:50+00:00 app[web.1]: 
2012-04-16T19:06:50+00:00 app[web.1]: Sent mail to [email protected] (274ms) 
2012-04-16T19:06:50+00:00 heroku[router]: GET impact-project.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=3832ms status=500 bytes=728 
2012-04-16T19:06:51+00:00 app[web.1]: localhost:11211 failed (count: 3) 
2012-04-16T19:06:51+00:00 app[web.1]: cache: [GET /favicon.ico] miss, store 
2012-04-16T19:06:51+00:00 app[web.1]: [2012-04-16 19:06:51] ERROR NoMethodError: undefined method `each' for nil:NilClass 
2012-04-16T19:06:51+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/rack-1.3.5/lib/rack/handler/webrick.rb:71:in `service' 
2012-04-16T19:06:51+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service' 
2012-04-16T19:06:51+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run' 
2012-04-16T19:06:51+00:00 app[web.1]: /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread' 
2012-04-16T19:06:51+00:00 heroku[router]: GET impact-project.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=517ms status=500 bytes=337 
+0

我們可以看到你的'config/mongoid.yml'嗎? – 2012-04-16 19:14:26

+0

另外,你有沒有在Heroku上安裝任何Mongo插件? – Emily 2012-04-16 19:15:36

+0

嗨,對不起,遲交回復。是的,我已經添加了蒙戈附加 – 2012-04-16 22:42:26

回答

5

如果您已經安裝了MongoHQ附加在Heroku上,它創建您的Rails應用程序可用於連接到數據庫的MONGOHQ_URL環境變量。看起來你的config/mongoid.yml配置不正確。下面是Heroku的& MongoHQ工作示例:

development: 
    host: localhost 
    database: yourapp_dev 

test: 
    host: localhost 
    database: yourapp_test 

# set these environment variables on your prod server 
production: 
    uri: <%= ENV['MONGOHQ_URL'] %> 

希望這有助於!

+0

謝謝你的迴應。剛纔看到我的mongoid.yml與urs非常相似,但是我指定了MONGOLAB_IRL。這是否意味着我應該安裝mongolab插件? – 2012-04-16 22:47:52

+0

這隻取決於你的Heroku應用程序正在使用什麼和你的偏好是什麼。通過在你的CLI中使用''''heroku addons''命令來檢查你的app是否安裝了附件。如果兩者都不存在,只需選擇並使用任何你喜歡的。環境變量應該在你的Rails配置中以相同的方式工作。 – 2012-04-30 01:37:32