0

私の問題は、Heroku DataMapper にデプロイすると、データベース接続情報のこの部分を完全なデータベース接続として使用しようとすること'postgres://postgres:myohmysosecret@localhost/recall'ですDataMapper.setup(:default, ENV['DATABASE_URL'] || 'postgres://postgres:myohmysosecret@localhost/recall')

これが私のHerokuログファイルです:

2012-07-08T06:49:40+00:00 heroku[web.1]: Starting process with command `bundle exec rackup config.ru -p 26035`
2012-07-08T06:49:48+00:00 app[web.1]:   Is the server running on host "localhost" and accepting
2012-07-08T06:49:48+00:00 app[web.1]:   from <internal:prelude>:10:in `synchronize'
2012-07-08T06:49:48+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/connection.rb:79:in `initialize': could not connect to server: Connection refused (DataObjects::ConnectionError)
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:177:in `block in new'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:172:in `new'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/connection.rb:79:in `new'
2012-07-08T06:49:48+00:00 app[web.1]:   TCP/IP connections on port 5432?
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:251:in `open_connection'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/connection.rb:68:in `new'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/data_objects-0.10.8/lib/data_objects/pooling.rb:119:in `new'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-transactions-1.2.0/lib/dm-transactions/adapters/dm-do-adapter.rb:69:in `open_connection'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:276:in `with_connection'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-do-adapter-1.2.0/lib/dm-do-adapter/adapter.rb:61:in `execute'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:60:in `ensure in without_notices'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:60:in `without_notices'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/adapters/dm-postgres-adapter.rb:18:in `upgrade_model_storage'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:73:in `upgrade_model_storage'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:47:in `block in repository_execute'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:145:in `auto_upgrade!'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/descendant_set.rb:64:in `block in each'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/ordered_set.rb:319:in `each'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/ordered_set.rb:319:in `block in each'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/subject_set.rb:210:in `block in each'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/ordered_set.rb:319:in `each'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/subject_set.rb:210:in `each'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-core-1.2.0/lib/dm-core/support/descendant_set.rb:63:in `each'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:46:in `repository_execute'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/dm-migrations-1.2.0/lib/dm-migrations/auto_migration.rb:27:in `auto_upgrade!'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/recall.rb:25:in `<top (required)>'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/config.ru:2:in `require'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/config.ru:2:in `block in <main>'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/config.ru:1:in `new'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/config.ru:1:in `<main>'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
2012-07-08
T06:49:48+00:00 app[web.1]:     from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:137:in `start'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `load'
2012-07-08T06:49:48+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/bin/rackup:19:in `<main>'
4

1 に答える 1

3

私はこの問題を抱えていました。最終的には、Heroku チュートリアルにある以下に関連しているように見えましたが、一見エラーのようです:

ENV['DATABASE_URL']

基本的に、おそらくデータベースはありません。ランニングheroku configはこれを示しています。ここで詳しく説明されているように、データベースを作成する次の行を実行できます。

heroku addons:add heroku-postgresql:dev

次に、heroku configもう一度実行してデータベース文字列を取得するか、おそらく DataMapper.setup で次の行を使用できます。

ENV['HEROKU_POSTGRESQL_CYAN_URL']

お役に立てれば!これを自分の Heroku サポート チケットに追加して、彼らの意見を確認しました!

于 2012-12-07T20:40:21.043 に答える