0

第 5 章を指示どおりに完了し、RSpec のエラーは発生しなかったので、git add .、git commit、および git push の最終ステップを実行しました。次に、git push heroku を実行しました。成功したように見え、テストのために Heroku サイト (http://stark-falls-6972.herokuapp.com/) に行ったところ、「申し訳ありませんが、問題が発生しました」と表示されて失敗しました。

Heroku のログ コマンドは、何か問題が発生したことを示していませんが、プラグインの減価償却に関するメッセージが表示されていますが、これは今日まで見たことがありません。これを修正するにはどうすればよいですか?

ヒロクのログ:

2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:61:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `_run__2054987173047889544__call__2098061657375244569__callbacks'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in `call_app'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:223:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:17:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2012-10-10T16:34:31+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
2012-10-10T16:34:31+00:00 app[web.1]: 
2012-10-10T16:34:31+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
2012-10-10T16:34:31+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
2012-10-10T16:34:31+00:00 app[web.1]: 
2012-10-10T16:36:14+00:00 heroku[slugc]: Slug compilation started
2012-10-10T16:36:41+00:00 heroku[api]: Release v9 created by myemail@example.com
2012-10-10T16:36:41+00:00 heroku[api]: Deploy 90c0db8 by myemail@example.com
2012-10-10T16:36:41+00:00 heroku[web.1]: State changed from up to starting
2012-10-10T16:36:42+00:00 heroku[slugc]: Slug compilation finished
2012-10-10T16:36:44+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 58733`
2012-10-10T16:36:45+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2012-10-10T16:36:46+00:00 app[web.1]: [2012-10-10 16:36:46] ERROR SignalException: SIGTERM
2012-10-10T16:36:46+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
2012-10-10T16:36:47+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)
2012-10-10T16:36:47+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)
2012-10-10T16:36:49+00:00 app[web.1]: [2012-10-10 16:36:49] INFO  WEBrick 1.3.1
2012-10-10T16:36:49+00:00 app[web.1]: [2012-10-10 16:36:49] INFO  ruby 1.9.2 (2011-07-09) [x86_64-linux]
2012-10-10T16:36:49+00:00 app[web.1]: [2012-10-10 16:36:49] INFO  WEBrick::HTTPServer#start: pid=2 port=58733
2012-10-10T16:36:50+00:00 heroku[web.1]: State changed from starting to up
2012-10-10T16:36:51+00:00 app[web.1]: 
2012-10-10T16:36:51+00:00 app[web.1]: => Booting WEBrick
2012-10-10T16:36:51+00:00 app[web.1]: => Call with -d to detach
2012-10-10T16:36:51+00:00 app[web.1]: => Rails 3.2.8 application starting in production on http://0.0.0.0:58733
2012-10-10T16:36:51+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-10-10T16:36:51+00:00 app[web.1]: 
2012-10-10T16:36:51+00:00 app[web.1]: Started GET "/" for 198.245.202.252 at 2012-10-10 16:36:51 +0000
2012-10-10T16:36:51+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2012-10-10T16:36:51+00:00 app[web.1]: 
2012-10-10T16:36:51+00:00 app[web.1]: ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished):
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:404:in `retrieve_connection'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:170:in `retrieve_connection'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:61:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `_run__2960544894057171244__call__2838682389361938761__callbacks'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:405:in `__run_callback'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:144:in `connection'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/query_cache.rb:67:in `rescue in call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/l
ib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in `call_app'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/callbacks.rb:81:in `run_callbacks'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:17:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:223:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
2012-10-10T16:36:51+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
2012-10-10T16:36:51+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
2012-10-10T16:36:51+00:00 app[web.1]: 
2012-10-10T16:36:51+00:00 app[web.1]: 
2012-10-10T16:36:51+00:00 app[web.1]:   /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'
2012-10-10T16:36:51+00:00 app[web.1]:   vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
2012-10-10T16:36:51+00:00 heroku[router]: GET stark-falls-6972.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=623ms status=500 bytes=643
2012-10-10T16:36:51+00:00 heroku[router]: GET stark-falls-6972.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=12ms status=200 bytes=0
2012-10-10T16:36:55+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2012-10-10T16:36:55+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2012-10-10T16:36:57+00:00 heroku[web.1]: Process exited with status 137

heroku run rake db:migrate を実行すると、このメッセージが表示されます。(ps 最近、減価償却のメッセージが表示されるようになりました。プラグインを追加していません)

Running `rake db:migrate` attached to terminal... up, run.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/Rakefile:7)
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/Rakefile:7)
Connecting to database specified by DATABASE_URL
rake aborted!
Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)

Tasks: TOP => db:migrate => db:load_config

私のdatabase.ymlファイル(以前の高度な演習でpostgresqlに更新しましたが、うまくいったと思いました):

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: postgresql
  database: db/development_postgresql
  pool: 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: db/test_postgresql
  pool: 5
  timeout: 5000

production:
  adapter: postgresql
  database: db/production_postgresql
  pool: 5
  timeout: 5000

私の宝石ファイル:

source 'https://rubygems.org'

gem 'rails', '3.2.8'
gem 'bootstrap-sass', '2.0.4'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

group :development, :test do
    gem 'pg', '0.12.2'
    gem 'rspec-rails', '2.11.0'
    gem 'guard-rspec', '1.2.1'
  gem 'guard-spork', '1.2.0'
  gem 'spork', '0.9.2'
end


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.5'
  gem 'coffee-rails', '~> 3.2.2'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :test do
    gem 'capybara', '1.1.2'
    gem 'rb-inotify', '0.8.8'
    gem 'libnotify', '0.5.9'
end


# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'
4

1 に答える 1

2

アプリがローカルで動作することを確認してください。つまり、localhost:3000からアクセスする場合

上記のherokuスタックトレースの関連するエラーメッセージは次のとおりです。ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)

そのため、Herokuはデータベースに接続できません。以前のherokuセットアップ関連の構成をすべて実行したことを確認してください。

Herokuはpostgresdbをサポートしています。したがって、このリストpgで詳しく説明されているように、gemはGemfileに含まれている必要があります

これらのherokuのデプロイ手順、特に手順も確認してください$ heroku run rake db:migrate。(この手順を繰り返しても害はありません)。

これは、同じエラーメッセージを詳細に処理するスタックオーバーフロースレッドです。Ruby-ActiveRecord :: ConnectionNotEstablished うまくいけば、そのページが正しい答えにあなたを導くでしょう。

Railsを学んで頑張ってください。RailsTutorialは、初心者にとって最高のリソースです。

于 2012-10-10T21:10:18.127 に答える