Heroku:PG :: ConnectionBad:无法连接到服务器

时间:2019-01-27 04:58:25

标签: ruby-on-rails heroku

我已经开发了Rails应用程序,并且一直在尝试将其部署到Heroku。我在git push heroku master中发出了一些警告,但从heroku.com上的记录来看,它仍然成功。成功推送后立即尝试heroku run rake db:migrate时,我得到此输出。有人知道这是什么问题吗?告诉我是否需要更多信息。

Running rake db:migrate on ⬢ arcane-depths-69465... up, run.1795 (Free)
/app/vendor/bundle/ruby/2.5.0/gems/bootstrap-4.0.0.alpha6/lib/bootstrap/version.rb:2: warning: already initialized constant Bootstrap::VERSION
/app/vendor/bundle/ruby/2.5.0/gems/bootstrap-sass-3.3.7/lib/bootstrap-sass/version.rb:2: warning: previous definition of VERSION was here
/app/vendor/bundle/ruby/2.5.0/gems/bootstrap-4.0.0.alpha6/lib/bootstrap/version.rb:3: warning: already initialized constant Bootstrap::BOOTSTRAP_SHA
/app/vendor/bundle/ruby/2.5.0/gems/bootstrap-sass-3.3.7/lib/bootstrap-sass/version.rb:3: warning: previous definition of BOOTSTRAP_SHA was here
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
/app/vendor/bundle/ruby/2.5.0/gems/pg-0.18.4/lib/pg.rb:45:in `initialize'
/app/vendor/bundle/ruby/2.5.0/gems/pg-0.18.4/lib/pg.rb:45:in `new'
/app/vendor/bundle/ruby/2.5.0/gems/pg-0.18.4/lib/pg.rb:45:in `connect'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:692:in `connect'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:223:in `initialize'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `new'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql_adapter.rb:48:in `postgresql_connection'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:811:in `new_connection'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:855:in `checkout_new_connection'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:834:in `try_to_checkout_new_connection'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:795:in `acquire_connection'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:523:in `checkout'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:382:in `connection'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:1010:in `retrieve_connection'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/connection_handling.rb:90:in `connection'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.5.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `load'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:27:in `run'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli.rb:360:in `exec'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli.rb:20:in `dispatch'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/cli.rb:10:in `start'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/exe/bundle:30:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/app/vendor/bundle/ruby/2.5.0/gems/bundler-1.15.2/exe/bundle:22:in `<top (required)>'
/app/bin/bundle:3:in `load'
/app/bin/bundle:3:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

以下是一些我认为可能相关的文件

宝石文件

source 'https://rubygems.org'
source 'https://rails-assets.org' do
  gem 'rails-assets-tether', '>= 1.3.3'
  gem 'rails-assets-chosen'
end

ruby '2.5.1'

#gem 'rails',        '5.1.4'
gem 'rails',        '5.2.2'
gem 'bcrypt',           '3.1.11'
gem 'will_paginate',           '3.1.6'
gem 'bootstrap-will_paginate', '1.0.0'
gem 'faker',    '1.7.3'
gem 'bootstrap-sass',   '3.3.7'
gem 'puma',           '3.9.1'
gem 'sass-rails',     '5.0.6'
gem 'uglifier',       '3.2.0'
gem 'coffee-rails',   '4.2.2'
gem 'jquery-rails',   '4.3.1'
gem 'turbolinks',     '5.0.1'
gem 'jbuilder',       '2.7.0'
gem 'popper_js', '~> 1.11.1'
gem 'bootstrap', '4.0.0.alpha6'
gem 'simple_form'

gem 'rb-readline'
gem 'pg'


group :development, :test do
  gem 'byebug',  '9.0.6', platform: :mri
end

group :production do
end



group :development do
  gem 'web-console',           '3.5.1'
  gem 'listen',                '3.1.5'
  gem 'spring',                '2.0.2'
  gem 'spring-watcher-listen', '2.0.1'
end

group :test do
  gem 'rails-controller-testing', '1.0.2'
  gem 'minitest',                 '5.10.3'
  gem 'minitest-reporters',       '1.1.14'
  gem 'guard',                    '2.13.0'
  gem 'guard-minitest',           '2.4.4'
end





# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

config / database.yml

# Changed from sqlite3 to postgresql

development:
  adapter: postgresql
  database: cvwo_todo_development
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000


# 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:
  adapter: postgresql
  database: cvwo_todo_test
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

production:
  adapter: postgresql
  database: cvwo_todo_production
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

0 个答案:

没有答案