デフォルトのRailsランディングページに移動すると、問題なく表示されますが、ユーザーを表示しようとすると、次のメッセージが表示されます。
Started GET "/users" for 190.21.126.51 at 2013-03-27 03:27:19 +0000
Mar 26 20:27:19 timepoints app/web.1: PG::Error (could not connect to server: Connection refused
Mar 26 20:27:19 timepoints app/web.1: Is the server running on host "localhost" and accepting
Mar 26 20:27:19 timepoints app/web.1: TCP/IP connections on port 5432?
Mar 26 20:27:19 timepoints app/web.1: ):
vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1206:in `initialize'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1206:in `new'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:1206:in `connect'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:329:in `initialize'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:309:in `new_connection'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:319:in `checkout_new_connection'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:241:in `block (2 levels) in checkout'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `loop'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:236:in `block in checkout'
Mar 26 20:27:19 timepoints app/web.1: /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:233:in `checkout'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:96:in `block in connection'
Mar 26 20:27:19 timepoints app/web.1: /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/query_cache.rb:67:in `rescue in call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/query_cache.rb:61:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `_run__572927131951691028__call__675318756725154442__callbacks'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:405:in `__run_callback'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/callbacks.rb:81:in `run_callbacks'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/rack/logger.rb:26:in `call_app'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/rack/logger.rb:16:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/request_id.rb:22:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/methodoverride.rb:21:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/runtime.rb:17:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/lock.rb:15:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/static.rb:62:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/engine.rb:479:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/application.rb:220:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/railties-3.2.6/lib/rails/rack/log_tailer.rb:17:in `call'
Mar 26 20:27:19 timepoints app/web.1: vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
Mar 26 20:27:19 timepoints app/web.1: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
Mar 26 20:27:19 timepoints app/web.1: /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
Mar 26 20:27:19 timepoints app/web.1: /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
Mar 26 20:27:19 timepoints heroku/router: at=info method=GET path=/users host=timepoints.herokuapp.com fwd="190.21.126.51" dyno=web.1 connect=2ms service=8ms status=500 bytes=643
Mar 26 20:27:20 timepoints heroku/router: at=info method=GET path=/favicon.ico host=timepoints.herokuapp.com fwd="190.21.126.51" dyno=web.1 connect=20ms service=13ms status=304 bytes=0
私は自分application.rb
とproduction.rb
を設定しました:
config.assets.initialize_on_precompile = false
私はheroku run rake db:setup
他のいくつかの投稿で提案されているように実行しました、そしてdb:migrate
またdb:reset
確認したところ、同じように設定されているheroku config
ことがわかりますDATABASE_URL
HEROKU_POSTGRESQL_OLIVE_URL
また、アプリを削除して新しいアプリにデプロイしましたが、同じ問題が引き続き発生します。
私Gemfile
は次を持っています:
group :production do
gem 'thin'
gem 'activerecord-postgresql-adapter'
end
Rails3.2.6とRuby1.9.2を使用しています
更新: Rails4.0.0とRuby2.0.0にアップグレードしたばかりですが、同じエラーが発生し続けます
更新2: アプリをrails3.1.0とruby1.9.3にダウングレードしましたが、これでいくつかのエラーが処理されました。サーバーへの接続にまだ問題があります。
更新3: Herokuに連絡したところ、問題の解決に役立ちました。これは、本番環境で接続を台無しにしていたヘルパーファイルで呼び出していた開発データベースへの接続でした。それを取り除くことで問題は解決しました