heroku mongohq and mongoid Mongo::ConnectionFailure

Posted by Ole Morten Amundsen on Stack Overflow See other posts from Stack Overflow or by Ole Morten Amundsen
Published on 2010-05-06T20:52:18Z Indexed on 2010/05/06 20:58 UTC
Read the original article Hit count: 717

Filed under:
|
|
|
|

I have added the mongoHQ addon for mongodb at heroku. It crashes with something like this.

connect_to_master': failed to connect to any given host:port (Mongo::ConnectionFailure)

The descriptions online (heroku mongohq) are more directed towards mongomapper, as I see it. I'm running ruby 1.9.1 and rails 3-beta with mongoid.

My feeling says that there's something with ENV['MONGOHQ_URL'], which it says the MongoHQ addon sets, but I haven't set MONGOHQ_URL anywhere in my app. I guess the problem is in my mongoid.yml ?

defaults: &defaults
  host: localhost

development:
  <<: *defaults
  database: aliado_development

test:
  <<: *defaults
  database: aliado_test

# set these environment variables on your prod server
production:
  <<: *defaults
  host: <%= ENV['MONGOID_HOST'] %>
  port: <%= ENV['MONGOID_PORT'] %>
  username: <%= ENV['MONGOID_USERNAME'] %>
  password: <%= ENV['MONGOID_PASSWORD'] %>
  database: <%= ENV['MONGOID_DATABASE'] %>

It works fine locally, but fails at heroku, more stack trace:

==> crashlog.log <==
Cannot write to outdated .bundle/environment.rb to update it
/disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/rack-1.1.0/lib/rack.rb:14: warning: already initialized constant VERSION
/disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongo-0.20.1/lib/mongo/connection.rb:435:in `connect_to_master': failed to connect to any given host:port (Mongo::ConnectionFailure)
    from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongo-0.20.1/lib/mongo/connection.rb:112:in `initialize'
    from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongoid-2.0.0.beta4
/lib/mongoid/railtie.rb:32:in `new'
    from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongoid-2.0.0.beta4/lib/mongoid/railtie.rb:32:in `block (2 levels) in <class:Railtie>'
    from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongoid-2.0.0.beta4/lib/mongoid.rb:110:in `configure'
    from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/mongoid-2.0.0.beta4/lib/mongoid/railtie.rb:21:in `block in <class:Railtie>'
    from /disk1/home/slugs/176479_b14df52_b875/mnt/.bundle/gems/gems/railties-3.0.0.beta3/lib/rails/initializable.rb:25:in `instance_exec'
.....

It all works locally, both tests and app. I'm out of ideas... Any suggestions?

PS: Somebody with high repu mind create the tag 'mongohq'?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails