无法连接到heroku的postgres

时间:2013-04-08 11:19:39

标签: ruby-on-rails ruby postgresql heroku

这是我得到的错误

 2013-04-08T11:14:02+00:00 app[web.1]:  from /app/config.ru:3:in `block in <main>'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/config.ru:in `<main>'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/config/environment.rb:5:in `<top (required)>'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/config.ru:in `new'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
2013-04-08T11:14:02+00:00 app[web.1]:   from script/rails:6:in `require'
2013-04-08T11:14:02+00:00 app[web.1]:   from script/rails:6:in `<main>'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
2013-04-08T11:14:02+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
2013-04-08T11:14:04+00:00 heroku[web.1]: Process exited with status 1
2013-04-08T11:14:04+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-08T11:14:25+00:00 heroku[api]: Release v18 created by email123@gmail.com
2013-04-08T11:14:25+00:00 heroku[api]: Deploy 1e1f3c4 by email123@gmail.com
2013-04-08T11:14:25+00:00 heroku[web.1]: State changed from crashed to starting
2013-04-08T11:14:26+00:00 heroku[slugc]: Slug compilation finished
2013-04-08T11:14:28+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 11206`
2013-04-08T11:14:31+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-04-08T11:14:31+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/config/environment.rb:5)
2013-04-08T11:14:32+00:00 app[web.1]: => Ctrl-C to shutdown server
2013-04-08T11:14:32+00:00 app[web.1]: => Rails 3.2.13 application starting in production on http://0.0.0.0:11206
2013-04-08T11:14:32+00:00 app[web.1]: => Booting WEBrick
2013-04-08T11:14:32+00:00 app[web.1]: => Call with -d to detach
2013-04-08T11:14:32+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
2013-04-08T11:14:32+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize': FATAL:  role "ctvgjnlklcweaz" is not permitted to log in (PG::Error)
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `n
ew'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
2013-04-08T11:14:32+00:00 app[web.1]: Exiting
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:324:in `initialize'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:418:in `_run__1840128634652434605__prepare__2621832742962076453__callbacks'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `connect'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/model_schema.rb:308:in `clear_cache!'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/config/environment.rb:5:in `<top (required)>'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/config.ru:3:in `block in <main>'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/config.ru:in `new'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/config.ru:in `<main>'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
2013-04-08T11:14:32+00:00 app[web.1]:   from script/rails:6:in `require'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/railtie.rb:104:in `block (2 levels) in <class:Railtie>'
2013-04-08T11:14:32+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
2013-04-08T11:14:32+00:00 app[web.1]:   from script/rails:6:in `<main>'
2013-04-08T11:14:34+00:00 heroku[web.1]: Process exited with status 1
2013-04-08T11:14:34+00:00 heroku[web.1]: State changed from starting to crashed
2013-04-08T11:14:35+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=my_host.org fwd="223.206.224.25" dyno= connect= service= status=503 bytes=
2013-04-08T11:14:36+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=my_host.org fwd="223.206.224.25" dyno= connect= service= status=503 bytes=

的Gemfile

source 'https://rubygems.org'

ruby '1.9.3'
gem 'rails', '3.2.13'
gem 'jquery-rails'
gem 'haml-rails'
gem 'devise'
gem 'bcrypt-ruby'
gem 'curb'
gem 'nokogiri'
gem 'pg'

group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  # gem 'therubyracer', :platforms => :ruby
  gem 'twitter-bootstrap-rails'
  gem 'uglifier'
end

group :development do
  gem "pry"
  gem "pry-nav"
end

的database.yml

development:
  adapter: postgresql
  database: my_db123
  encoding: unicode
  pool: 5
  port: 5432
  host: localhost
  timeout: 5000
  username: postgres
  password: 1234a

test:

在localhost上运行良好。我甚至根本不使用数据库。

1 个答案:

答案 0 :(得分:1)

您似乎遇到了这个问题:FATAL: role “role-name”,正如您必须提供的文档中所述:

 - If required, provision a new database via heroku addons:add
   heroku-postgresql
 - Use heroku pg:promote HEROKU_POSTGRESQL_<new-database-color> to
   promote it, making it the primary database for your application.