无法设置DB Rails Heroku - 用户没有CONNECT权限

时间:2016-06-27 00:33:16

标签: ruby-on-rails ruby git ruby-on-rails-4 heroku

我正在尝试将我的Rails应用程序推送到hekoru,但是当我输入时:

heroku run rake db:setup

它给了我:

Running rake db:setup on ⬢ salty-sierra-72006... up, run.7511
FATAL:  permission denied for database "postgres"
DETAIL:  User does not have CONNECT privilege.
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `initialize'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `new'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:651:in `connect'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:242:in `initialize'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `new'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/postgresql_adapter.rb:44:in `postgresql_connection'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/app/vendor/ruby-2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/app/vendor/ruby-2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:87:in `connection'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/postgresql_database_tasks.rb:6:in `connection'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/postgresql_database_tasks.rb:15:in `create'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:93:in `create'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:107:in `block in create_current'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:275:in `block in each_current_configuration'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:274:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:274:in `each_current_configuration'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/tasks/database_tasks.rb:106:in `create_current'
/app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/railties/databases.rake:17:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:199:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:199:in `invoke_prerequisites'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:199:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:199:in `invoke_prerequisites'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.2.4/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/app/vendor/bundle/ruby/2.2.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.2.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.2.0/bin/rake:23:in `<main>'
Couldn't create database for {"adapter"=>"postgresql", "username"=>"toeoazkfdxtjkj", "password"=>"eJm_q_dEC3tAGeNHL8gZEFSkJj", "port"=>5432, "database"=>"dd0f88o8ad606", "host"=>"ec2-54-243-203-85.compute-1.amazonaws.com"}
-- enable_extension("plpgsql")
  SQL (3.9ms)  CREATE EXTENSION IF NOT EXISTS "plpgsql"
   -> 0.0711s
-- create_table("homes", {:force=>:cascade})
   (15.5ms)  CREATE TABLE "homes" ("id" serial primary key, "phone" character varying, "sender_name" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL, "notification_params" text, "status" character varying, "transaction_id" character varying, "purchased_at" timestamp) 
   -> 0.0221s
-- create_table("messages", {:force=>:cascade})
   (11.6ms)  CREATE TABLE "messages" ("id" serial primary key, "body" character varying, "media_url" character varying, "created_at" timestamp NOT NULL, "updated_at" timestamp NOT NULL) 
   -> 0.0315s

迁移会持续一段时间,直到它们全部提交

我尝试了heroku pg:reset DATABASE_URL并清理了我的git版本(这使我能够成功迁移)。话虽这么说,我仍然无法访问我的heroku网址:https://salty-sierra-72006.herokuapp.com/我总是收到此错误:DETAIL: User does not have CONNECT privilege.

任何人都有解决方案吗?

修改

以下是我尝试访问myoku网址时的日志:

2016-06-27T01:05:06.087692+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 32021 -e production`
2016-06-27T01:05:09.014795+00:00 app[web.1]: => Ctrl-C to shutdown server
2016-06-27T01:05:09.014771+00:00 app[web.1]: => Booting Puma
2016-06-27T01:05:09.014785+00:00 app[web.1]: => Rails 4.2.6 application starting in production on http://127.0.0.1:32021
2016-06-27T01:05:09.014792+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-06-27T01:05:09.986692+00:00 app[web.1]: [3] * Process workers: 2
2016-06-27T01:05:09.986695+00:00 app[web.1]: [3] * Preloading application
2016-06-27T01:05:09.992844+00:00 app[web.1]: [3] - Worker 1 (pid: 10) booted, phase: 0
2016-06-27T01:05:09.986645+00:00 app[web.1]: [3] Puma starting in cluster mode...
2016-06-27T01:05:09.991800+00:00 app[web.1]: [3] - Worker 0 (pid: 5) booted, phase: 0
2016-06-27T01:05:09.986665+00:00 app[web.1]: [3] * Version 3.4.0 (ruby 2.2.4-p230), codename: Owl Bowl Brawl
2016-06-27T01:05:09.986820+00:00 app[web.1]: [3] * Listening on tcp://127.0.0.1:32021
2016-06-27T01:05:09.986999+00:00 app[web.1]: [3] Use Ctrl-C to stop
2016-06-27T01:05:09.986667+00:00 app[web.1]: [3] * Min threads: 5, max threads: 5
2016-06-27T01:05:09.986691+00:00 app[web.1]: [3] * Environment: production
2016-06-27T01:06:06.235493+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-06-27T01:06:06.235493+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-06-27T01:06:07.056120+00:00 heroku[web.1]: Process exited with status 137
2016-06-27T01:06:07.068808+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-27T01:06:09.723214+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=salty-sierra-72006.herokuapp.com request_id=36aa59cd-0d8a-41dd-bb28-a0cd20f0e4e2 fwd="184.160.104.208" dyno= connect= service= status=503 bytes=
2016-06-27T01:06:10.135463+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=salty-sierra-72006.herokuapp.com request_id=af1c125f-f469-49d0-8535-34846446431b fwd="184.160.104.208" dyno= connect= service= status=503 bytes=

配置/ database.yml的

default: &default
  adapter: postgresql
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: sms_sender_development

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: sms_sender_test

执行此操作后的日志:https://devcenter.heroku.com/articles/heroku-postgresql

2016-06-27T02:34:31.193484+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 26779 -e production`
2016-06-27T02:34:34.579599+00:00 app[web.1]: => Ctrl-C to shutdown server
2016-06-27T02:34:34.579587+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-06-27T02:34:34.579546+00:00 app[web.1]: => Booting Puma
2016-06-27T02:34:34.579586+00:00 app[web.1]: => Rails 4.2.6 application starting in production on http://127.0.0.1:26779
2016-06-27T02:34:35.556541+00:00 app[web.1]: [3] Puma starting in cluster mode...
2016-06-27T02:34:35.556562+00:00 app[web.1]: [3] * Process workers: 2
2016-06-27T02:34:35.556562+00:00 app[web.1]: [3] * Environment: production
2016-06-27T02:34:35.565093+00:00 app[web.1]: [3] - Worker 1 (pid: 9) booted, phase: 0
2016-06-27T02:34:35.556563+00:00 app[web.1]: [3] * Preloading application
2016-06-27T02:34:35.556560+00:00 app[web.1]: [3] * Version 3.4.0 (ruby 2.2.4-p230), codename: Owl Bowl Brawl
2016-06-27T02:34:35.556646+00:00 app[web.1]: [3] * Listening on tcp://127.0.0.1:26779
2016-06-27T02:34:35.556561+00:00 app[web.1]: [3] * Min threads: 5, max threads: 5
2016-06-27T02:34:35.556831+00:00 app[web.1]: [3] Use Ctrl-C to stop
2016-06-27T02:34:35.565007+00:00 app[web.1]: [3] - Worker 0 (pid: 5) booted, phase: 0
2016-06-27T02:35:31.525027+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-06-27T02:35:31.524814+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-06-27T02:35:32.540122+00:00 heroku[web.1]: Process exited with status 137

0 个答案:

没有答案