簡體   English   中英

將Rails應用程序部署到heroku時出錯

[英]Error deploying Rails app to heroku

嘗試在heroku上訪問我的應用程序時出現以下錯誤。 該應用程序已成功部署,但我無法訪問它。 當我嘗試訪問該應用程序時,頁面上顯示“應用程序錯誤應用程序中發生錯誤,無法為您的頁面提供服務。如果您是應用程序所有者,請檢查日志以獲取詳細信息。” 這是heroku日志:

 heroku logs
2017-03-21T20:28:21.577989+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2017-03-21T20:28:21.578004+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
2017-03-21T20:28:21.578005+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
2017-03-21T20:28:21.578007+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
2017-03-21T20:28:21.578008+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
2017-03-21T20:28:21.578010+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
2017-03-21T20:28:21.749663+00:00 heroku[web.1]: Process exited with status 1
2017-03-21T20:28:21.578012+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/server.rb:59:in `app'
2017-03-21T20:28:21.578026+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
2017-03-21T20:28:21.578029+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/server.rb:282:in `start'
2017-03-21T20:28:21.578030+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/server.rb:79:in `start'
2017-03-21T20:28:21.578032+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:90:in `block in serv                                                                                                                er'
2017-03-21T20:28:21.578033+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
2017-03-21T20:28:21.578035+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `server'
2017-03-21T20:28:21.578037+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
2017-03-21T20:28:21.578052+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
2017-03-21T20:28:21.578078+00:00 app[web.1]:    from bin/rails:4:in `require'
2017-03-21T20:28:21.578079+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2017-03-21T20:28:21.768673+00:00 heroku[web.1]: State changed from starting to c                                                                                                                rashed
2017-03-21T20:28:23.139347+00:00 heroku[router]: at=error code=H10 desc="App cra                                                                                                                shed" method=GET path="/recipes" host=weather-consult.herokuapp.com request_id=9                                                                                                                801a23f-72b9-4477-8e90-93fba979e78f fwd="83.138.193.223" dyno= connect= service=                                                                                                                 status=503 bytes= protocol=https
2017-03-21T20:28:23.718785+00:00 heroku[router]: at=error code=H10 desc="App cra                                                                                                                shed" method=GET path="/favicon.ico" host=weather-consult.herokuapp.com request_                                                                                                                id=100c960d-b3a1-4374-ae56-52e60b785710 fwd="83.138.193.223" dyno= connect= serv                                                                                                                ice= status=503 bytes= protocol=https
2017-03-21T20:28:40.702732+00:00 heroku[web.1]: State changed from crashed to st                                                                                                                arting
2017-03-21T20:28:43.480189+00:00 heroku[web.1]: Starting process with command `b                                                                                                                in/rails server -p 41364 -e production`
2017-03-21T20:28:48.023383+00:00 app[web.1]: => Rails 5.0.2 application starting                                                                                                                 in production on http://0.0.0.0:41364
2017-03-21T20:28:48.023384+00:00 app[web.1]: => Run `rails server -h` for more s                                                                                                                tartup options
2017-03-21T20:28:48.023369+00:00 app[web.1]: => Booting Puma
2017-03-21T20:28:48.023384+00:00 app[web.1]: Exiting
2017-03-21T20:28:48.023457+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/                                                                                                                activerecord-5.0.2/lib/active_record/connection_adapters/connection_specificatio                                                                                                                n.rb:176:in `rescue in spec': Specified 'postgresql' for database adapter, but t                                                                                                                he gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is                                                                                                                 at the minimum required by ActiveRecord). (Gem::LoadError)
2017-03-21T20:28:48.023485+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activerecord-5.0.2/lib/active_record/connection_adapters/connection_spec                                                                                                                ification.rb:173:in `spec'
2017-03-21T20:28:48.023486+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activerecord-5.0.2/lib/active_record/connection_handling.rb:53:in `estab                                                                                                                lish_connection'
2017-03-21T20:28:48.023487+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activerecord-5.0.2/lib/active_record/railtie.rb:125:in `block (2 levels)                                                                                                                 in <class:Railtie>'
2017-03-21T20:28:48.023531+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:49:in `each'
2017-03-21T20:28:48.023532+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:49:in `run_loa                                                                                                                d_hooks'
2017-03-21T20:28:48.023526+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:43:in `instanc                                                                                                                e_eval'
2017-03-21T20:28:48.023527+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:43:in `execute                                                                                                                _hook'
2017-03-21T20:28:48.023534+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activerecord-5.0.2/lib/active_record/base.rb:324:in `<module:ActiveRecor                                                                                                                d>'
2017-03-21T20:28:48.023528+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/lazy_load_hooks.rb:50:in `block i                                                                                                                n run_load_hooks'
2017-03-21T20:28:48.023535+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activerecord-5.0.2/lib/active_record/base.rb:24:in `<top (required)>'
2017-03-21T20:28:48.023537+00:00 app[web.1]:    from /app/app/models/application                                                                                                                _record.rb:1:in `<top (required)>'
2017-03-21T20:28:48.023539+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
2017-03-21T20:28:48.023569+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:37:in `block in l                                                                                                                oad_interlock'
2017-03-21T20:28:48.023564+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `block in                                                                                                                 require'
2017-03-21T20:28:48.023590+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies/interlock.rb:12:in `                                                                                                                block in loading'
2017-03-21T20:28:48.023565+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:259:in `load_depe                                                                                                                ndency'
2017-03-21T20:28:48.023590+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/concurrency/share_lock.rb:150:in                                                                                                                 `exclusive'
2017-03-21T20:28:48.023566+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:293:in `require'
2017-03-21T20:28:48.023568+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:380:in `block in                                                                                                                 require_or_load'
2017-03-21T20:28:48.023591+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies/interlock.rb:11:in `                                                                                                                loading'
2017-03-21T20:28:48.023592+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:37:in `load_inter                                                                                                                lock'
2017-03-21T20:28:48.023593+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:358:in `require_o                                                                                                                r_load'
2017-03-21T20:28:48.023599+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/engine.rb:473:in `each'
2017-03-21T20:28:48.023598+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/engine.rb:475:in `block in eager_load!'
2017-03-21T20:28:48.023600+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/engine.rb:473:in `eager_load!'
2017-03-21T20:28:48.023594+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:336:in `depend_on                                                                                                                '
2017-03-21T20:28:48.023594+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/activesupport-5.0.2/lib/active_support/dependencies.rb:252:in `require_d                                                                                                                ependency'
2017-03-21T20:28:48.023597+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/engine.rb:475:in `each'
2017-03-21T20:28:48.023595+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/engine.rb:476:in `block (2 levels) in eager_loa                                                                                                                d!'
2017-03-21T20:28:48.023602+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/engine.rb:354:in `eager_load!'
2017-03-21T20:28:48.023603+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/application/finisher.rb:59:in `each'
2017-03-21T20:28:48.023605+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/application/finisher.rb:59:in `block in <module                                                                                                                :Finisher>'
2017-03-21T20:28:48.023606+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec'
2017-03-21T20:28:48.023626+00:00 app[web.1]:    from /app/vendor/ruby-2.2.6/lib/                                                                                                                ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_componen                                                                                                                t'
2017-03-21T20:28:48.023608+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run'
2017-03-21T20:28:48.023628+00:00 app[web.1]:    from /app/vendor/ruby-2.2.6/lib/                                                                                                                ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
2017-03-21T20:28:48.023639+00:00 app[web.1]:    from /app/vendor/ruby-2.2.6/lib/                                                                                                                ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
2017-03-21T20:28:48.023610+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initialize                                                                                                                rs'
2017-03-21T20:28:48.023612+00:00 app[web.1]:    from /app/vendor/ruby-2.2.6/lib/                                                                                                                ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
2017-03-21T20:28:48.023641+00:00 app[web.1]:    from /app/vendor/ruby-2.2.6/lib/                                                                                                                ruby/2.2.0/tsort.rb:345:in `each'
2017-03-21T20:28:48.023643+00:00 app[web.1]:    from /app/vendor/ruby-2.2.6/lib/                                                                                                                ruby/2.2.0/tsort.rb:345:in `call'
2017-03-21T20:28:48.023649+00:00 app[web.1]:    from /app/vendor/ruby-2.2.6/lib/                                                                                                                ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
2017-03-21T20:28:48.023663+00:00 app[web.1]:    from /app/config/environment.rb:                                                                                                                5:in `<top (required)>'
2017-03-21T20:28:48.023651+00:00 app[web.1]:    from /app/vendor/ruby-2.2.6/lib/                                                                                                                ruby/2.2.0/tsort.rb:224:in `tsort_each'
2017-03-21T20:28:48.023653+00:00 app[web.1]:    from /app/vendor/ruby-2.2.6/lib/                                                                                                                ruby/2.2.0/tsort.rb:203:in `tsort_each'
2017-03-21T20:28:48.023665+00:00 app[web.1]:    from /app/config.ru:3:in `requir                                                                                                                e_relative'
2017-03-21T20:28:48.023655+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/initializable.rb:54:in `run_initializers'
2017-03-21T20:28:48.023671+00:00 app[web.1]:    from /app/config.ru:3:in `block                                                                                                                 in <main>'
2017-03-21T20:28:48.023661+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/application.rb:352:in `initialize!'
2017-03-21T20:28:48.023673+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
2017-03-21T20:28:48.023675+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
2017-03-21T20:28:48.023678+00:00 app[web.1]:    from /app/config.ru:in `new'
2017-03-21T20:28:48.023683+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2017-03-21T20:28:48.023696+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
2017-03-21T20:28:48.023697+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
2017-03-21T20:28:48.023685+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
2017-03-21T20:28:48.023700+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/server.rb:59:in `app'
2017-03-21T20:28:48.023687+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
2017-03-21T20:28:48.023690+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
2017-03-21T20:28:48.023702+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
2017-03-21T20:28:48.023704+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/rack-2.0.1/lib/rack/server.rb:282:in `start'
2017-03-21T20:28:48.023710+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/server.rb:79:in `start'
2017-03-21T20:28:48.023712+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:90:in `block in serv                                                                                                                er'
2017-03-21T20:28:48.023714+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `tap'
2017-03-21T20:28:48.023715+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:85:in `server'
2017-03-21T20:28:48.023724+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands.rb:18:in `<top (required)>'
2017-03-21T20:28:48.023718+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.2                                                                                                                .0/gems/railties-5.0.2/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
2017-03-21T20:28:48.023726+00:00 app[web.1]:    from bin/rails:4:in `require'
2017-03-21T20:28:48.023732+00:00 app[web.1]:    from bin/rails:4:in `<main>'
2017-03-21T20:28:48.114357+00:00 heroku[web.1]: Process exited with status 1
2017-03-21T20:28:48.128920+00:00 heroku[web.1]: State changed from starting to c                                                                                                                rashed
2017-03-21T20:28:49.680428+00:00 heroku[router]: at=error code=H10 desc="App cra                                                                                                                shed" method=GET path="/recipes" host=weather-consult.herokuapp.com request_id=a                                                                                                                42f1683-8c92-412e-bc36-35bee47fd044 fwd="83.138.193.223" dyno= connect= service=                                                                                                                 status=503 bytes= protocol=https
2017-03-21T20:28:50.139167+00:00 heroku[router]: at=error code=H10 desc="App cra                                                                                                                shed" method=GET path="/favicon.ico" host=weather-consult.herokuapp.com request_                                                                                                                id=70b71bcf-af11-489f-bdee-f3325249f7fe fwd="83.138.193.223" dyno= connect= serv                                                                                                                ice= status=503 bytes= protocol=https

您的Gemfile中一定不能包含pg,這使我認為您的gemfile中可能缺少部署特定的內容。 在您的gemfile中找到sqlite3或等效的開發數據庫gem並進行重組,這通常是這樣完成的。 Heroku自動尋找:production環境並加載適用的配置。

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'sqlite3'
end

group :production do
  gem 'pg'
  gem 'rails_12factor'
  gem 'letsencrypt-rails-heroku'
end

當架構更改時忘記遷移數據庫時,有時還會收到該錯誤。 您可以使用heroku run rake db:migrate來做到這一點。

嘗試重新啟動測功機。

heroku ps:restart

或者嘗試簡單地heroku restart

說明: Devcenter Heroku

通過幫助的Heroku部署錯誤H10(應用程序崩潰),這也可以

您需要更新問題中的日志,以使它們更具可讀性。 使用Postgresql時,需要將pg添加到Gemfile中。

The gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).(Gem::LoadError)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM