heroku |应用程序崩溃

时间:2019-06-04 12:34:09

标签: ruby-on-rails heroku

我正在尝试在暂存环境中部署我的应用程序,但是它失败了...

主要错误似乎是

2019-06-04T12:15:47.031277+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=myapp-staging.herokuapp.com request_id=80e824e5-bbd5-4c1d-b179-6e1ae25e4da5 fwd="90.65.255.165" dyno= connect= service= status=503 bytes= protocol=https
2019-06-04T12:15:47.354733+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=myapp-staging.herokuapp.com request_id=4b4c9996-89df-452a-b6e4-2d8f49e15549 fwd="90.65.255.165" dyno= connect= service= status=503 bytes= protocol=https

我创建了另一个应用程序,但仍然存在此问题。 我做到了:

heroku restart
heroku run rails console

什么都没有告诉我什么地方...

这是完整的日志

➜  kamelot git:(master) heroku logs --tail                                                                                                                                               [2.4.4]
2019-06-04T12:05:36.117830+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
2019-06-04T12:05:36.117832+00:00 app[web.1]: from bin/rails:9:in `<main>'
2019-06-04T12:09:29.663177+00:00 heroku[run.2594]: State changed from up to complete
2019-06-04T12:09:29.645505+00:00 heroku[run.2594]: Process exited with status 0
2019-06-04T12:12:17.000000+00:00 app[api]: Build started by user myapp@gmail.com
2019-06-04T12:14:54.386002+00:00 app[api]: Release v12 created by user myapp@gmail.com
2019-06-04T12:14:54.386002+00:00 app[api]: Deploy 401b8ae3 by user myapp@gmail.com
2019-06-04T12:14:55.617833+00:00 heroku[web.1]: State changed from crashed to starting
2019-06-04T12:15:11.449593+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 46315`
2019-06-04T12:15:22.498234+00:00 heroku[web.1]: State changed from starting to crashed
2019-06-04T12:15:22.570674+00:00 heroku[web.1]: State changed from crashed to starting
2019-06-04T12:15:22.477871+00:00 heroku[web.1]: Process exited with status 1
2019-06-04T12:15:22.362087+00:00 app[web.1]: => Booting Puma
2019-06-04T12:15:22.362111+00:00 app[web.1]: => Rails 5.2.3 application starting in staging
2019-06-04T12:15:22.362113+00:00 app[web.1]: => Run `rails server -h` for more startup options
2019-06-04T12:15:22.362114+00:00 app[web.1]: Puma starting in single mode...
2019-06-04T12:15:22.362120+00:00 app[web.1]: * Version 3.12.1 (ruby 2.4.4-p296), codename: Llamas in Pajamas
2019-06-04T12:15:22.362122+00:00 app[web.1]: * Min threads: 5, max threads: 5
2019-06-04T12:15:22.362123+00:00 app[web.1]: * Environment: staging
2019-06-04T12:15:22.371419+00:00 app[web.1]: Exiting
2019-06-04T12:15:22.371671+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:273:in `initialize': getaddrinfo: Name or service not known (SocketError)
2019-06-04T12:15:22.371673+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:273:in `new'
2019-06-04T12:15:22.371677+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:273:in `add_tcp_listener'
2019-06-04T12:15:22.371678+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:106:in `block in parse'
2019-06-04T12:15:22.371680+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:90:in `each'
2019-06-04T12:15:22.371683+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:90:in `parse'
2019-06-04T12:15:22.371684+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/runner.rb:153:in `load_and_bind'
2019-06-04T12:15:22.371686+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/single.rb:98:in `run'
2019-06-04T12:15:22.371689+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/launcher.rb:186:in `run'
2019-06-04T12:15:22.371690+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/rack/handler/puma.rb:73:in `run'
2019-06-04T12:15:22.371692+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.7/lib/rack/server.rb:297:in `start'
2019-06-04T12:15:22.371696+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:53:in `start'
2019-06-04T12:15:22.371697+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:147:in `block in perform'
2019-06-04T12:15:22.371701+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `tap'
2019-06-04T12:15:22.371702+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `perform'
2019-06-04T12:15:22.371703+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
2019-06-04T12:15:22.371707+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
2019-06-04T12:15:22.371708+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
2019-06-04T12:15:22.371710+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
2019-06-04T12:15:22.371713+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
2019-06-04T12:15:22.371715+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<main>'
2019-06-04T12:15:22.371719+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
2019-06-04T12:15:22.371733+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
2019-06-04T12:15:22.371737+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
2019-06-04T12:15:22.371739+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
2019-06-04T12:15:22.371740+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
2019-06-04T12:15:22.371741+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
2019-06-04T12:15:22.371743+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
2019-06-04T12:15:22.371744+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
2019-06-04T12:15:22.371745+00:00 app[web.1]: from bin/rails:9:in `<main>'
2019-06-04T12:15:23.000000+00:00 app[api]: Build succeeded
2019-06-04T12:15:37.729263+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 30803`
2019-06-04T12:15:46.387548+00:00 heroku[web.1]: State changed from starting to crashed
2019-06-04T12:15:46.368952+00:00 heroku[web.1]: Process exited with status 1
2019-06-04T12:15:46.269903+00:00 app[web.1]: => Booting Puma
2019-06-04T12:15:46.269931+00:00 app[web.1]: => Rails 5.2.3 application starting in staging
2019-06-04T12:15:46.269943+00:00 app[web.1]: => Run `rails server -h` for more startup options
2019-06-04T12:15:46.269952+00:00 app[web.1]: Puma starting in single mode...
2019-06-04T12:15:46.269959+00:00 app[web.1]: * Version 3.12.1 (ruby 2.4.4-p296), codename: Llamas in Pajamas
2019-06-04T12:15:46.269960+00:00 app[web.1]: * Min threads: 5, max threads: 5
2019-06-04T12:15:46.269962+00:00 app[web.1]: * Environment: staging
2019-06-04T12:15:46.288009+00:00 app[web.1]: Exiting
2019-06-04T12:15:46.288276+00:00 app[web.1]: /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:273:in `initialize': getaddrinfo: Name or service not known (SocketError)
2019-06-04T12:15:46.288286+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:273:in `new'
2019-06-04T12:15:46.288288+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:273:in `add_tcp_listener'
2019-06-04T12:15:46.288290+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:106:in `block in parse'
2019-06-04T12:15:46.288291+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:90:in `each'
2019-06-04T12:15:46.288294+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/binder.rb:90:in `parse'
2019-06-04T12:15:46.288296+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/runner.rb:153:in `load_and_bind'
2019-06-04T12:15:46.288297+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/single.rb:98:in `run'
2019-06-04T12:15:46.288298+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/puma/launcher.rb:186:in `run'
2019-06-04T12:15:46.288301+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/puma-3.12.1/lib/rack/handler/puma.rb:73:in `run'
2019-06-04T12:15:46.288303+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/rack-2.0.7/lib/rack/server.rb:297:in `start'
2019-06-04T12:15:46.288309+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:53:in `start'
2019-06-04T12:15:46.288313+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:147:in `block in perform'
2019-06-04T12:15:46.288314+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `tap'
2019-06-04T12:15:46.288316+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/commands/server/server_command.rb:142:in `perform'
2019-06-04T12:15:46.288319+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
2019-06-04T12:15:46.288320+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
2019-06-04T12:15:46.288323+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
2019-06-04T12:15:46.288326+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
2019-06-04T12:15:46.288329+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
2019-06-04T12:15:46.288332+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<main>'
2019-06-04T12:15:46.288335+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
2019-06-04T12:15:46.288343+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
2019-06-04T12:15:46.288346+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
2019-06-04T12:15:46.288348+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
2019-06-04T12:15:46.288351+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
2019-06-04T12:15:46.288354+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
2019-06-04T12:15:46.288357+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
2019-06-04T12:15:46.288376+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
2019-06-04T12:15:46.288377+00:00 app[web.1]: from bin/rails:9:in `<main>'
2019-06-04T12:15:47.031277+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=myapp-staging.herokuapp.com request_id=80e824e5-bbd5-4c1d-b179-6e1ae25e4da5 fwd="90.65.255.165" dyno= connect= service= status=503 bytes= protocol=https
2019-06-04T12:15:47.354733+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=myapp-staging.herokuapp.com request_id=4b4c9996-89df-452a-b6e4-2d8f49e15549 fwd="90.65.255.165" dyno= connect= service= status=503 bytes= protocol=https
2019-06-04T12:15:51.399896+00:00 app[api]: Starting process with command `bin/rails console` by user myapp@gmail.com
2019-06-04T12:16:07.124655+00:00 heroku[run.7790]: Awaiting client
2019-06-04T12:16:07.432799+00:00 heroku[run.7790]: State changed from starting to up
2019-06-04T12:16:07.420097+00:00 heroku[run.7790]: Starting process with command `bin/rails console`
2019-06-04T12:16:26.584012+00:00 heroku[run.7790]: State changed from up to complete
2019-06-04T12:16:26.565785+00:00 heroku[run.7790]: Process exited with status 0

这是我的config / environments / staging.rb,这里有什么错误可以导致应用程序崩溃?

Rails.application.configure do

  config.public_file_server.headers = {
    'Cache-Control' => "public, s-maxage=#{365.days.to_i}, maxage=#{180.days.to_i}",
    'Expires' => "#{1.year.from_now.to_formatted_s(:rfc822)}"
  }
  config.webpacker.check_yarn_integrity = false
  config.i18n.available_locales = [:fr, :en]
  config.cache_classes = true

  config.eager_load = true

  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true


  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

  config.assets.js_compressor = :uglifier

  config.assets.compile = false

  config.active_storage.service = :local

  config.force_ssl = true

  config.log_level = :debug

  config.log_tags = [ :request_id ]

  config.action_mailer.perform_caching = false
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.default_url_options = { host: ENV['HOST'] }

  config.action_mailer.delivery_method = :smtp

  config.action_mailer.smtp_settings = {
    :user_name => '5808ce008026c8',
    :password => '3be9b008e34068',
    :address => 'smtp.mailtrap.io',
    :domain => 'smtp.mailtrap.io',
    :port => '2525',
    :authentication => :cram_md5
  }

  config.i18n.fallbacks = [I18n.default_locale]

  config.i18n.default_locale = :fr

  config.active_support.deprecation = :notify

  config.log_formatter = ::Logger::Formatter.new


  if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger    = ActiveSupport::TaggedLogging.new(logger)
  end

  config.active_record.dump_schema_after_migration = false
end

我在 Procfile 中也有此文件 web: bundle exec rails server -p $PORT

1 个答案:

答案 0 :(得分:0)

我忘记将其添加到procfile中:

web: bundle exec puma -C config/puma.rb