Rails Heroku应用程序无法加载

时间:2016-06-27 02:19:46

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

部署在Heroku上的My Rails应用程序将无法加载。我设置了DB + migrate,我也有puma和procfile ......我完全不知道。

这是我的日志:

2016-06-27T02:12:40.565429+00:00 heroku[web.1]: Starting process with    command `bin/rails server -p 8592 -e production`
2016-06-27T02:12:43.410912+00:00 app[web.1]: => Ctrl-C to shutdown server
2016-06-27T02:12:43.410821+00:00 app[web.1]: => Booting Puma
2016-06-27T02:12:43.410885+00:00 app[web.1]: => Rails 4.2.6 application starting in production on http://127.0.0.1:8592
2016-06-27T02:12:43.410896+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-06-27T02:12:44.269805+00:00 app[web.1]: [3] * Version 3.4.0 (ruby 2.2.4-p230), codename: Owl Bowl Brawl
2016-06-27T02:12:44.270470+00:00 app[web.1]: [3] Use Ctrl-C to stop
2016-06-27T02:12:44.269782+00:00 app[web.1]: [3] Puma starting in cluster mode...
2016-06-27T02:12:44.269807+00:00 app[web.1]: [3] * Environment: production
2016-06-27T02:12:44.269855+00:00 app[web.1]: [3] * Preloading application
2016-06-27T02:12:44.269806+00:00 app[web.1]: [3] * Min threads: 5, max threads: 5
2016-06-27T02:12:44.269840+00:00 app[web.1]: [3] * Process workers: 2
2016-06-27T02:12:44.270026+00:00 app[web.1]: [3] * Listening on tcp://127.0.0.1:8592
2016-06-27T02:12:44.276018+00:00 app[web.1]: [3] - Worker 1 (pid: 9) booted, phase: 0
2016-06-27T02:12:44.275358+00:00 app[web.1]: [3] - Worker 0 (pid: 5) booted, phase: 0
2016-06-27T02:13:12.887521+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=salty-sierra-72006.herokuapp.com request_id=e96197b0-0946-4b58-a68c-b8a9a3c3fc15 fwd="184.160.104.208" dyno= connect= service= status=503 bytes=
2016-06-27T02:13:41.028910+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-06-27T02:13:41.028910+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-06-27T02:13:41.783167+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-27T02:13:41.772079+00:00 heroku[web.1]: Process exited with status 137
2016-06-27T02:13:42.941344+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=salty-sierra-72006.herokuapp.com request_id=0411e6f6-3dee-4d15-9bf2-8e069a20d9fb fwd="184.160.104.208" dyno= connect= service= status=503 bytes=
2016-06-27T02:13:43.295246+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=salty-sierra-72006.herokuapp.com request_id=e1d9e2cd-086a-4d65-9100-dc4c407c9835 fwd="184.160.104.208" dyno= connect= service= status=503 bytes=

的Gemfile

source 'https://rubygems.org'


gem 'rails', '4.2.6'
gem 'pg'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'rake', '< 11'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'rails_12factor'
gem 'bootstrap-sass', '~> 3.3.6'
gem 'sass-rails', '>= 3.2'
gem 'simple_form'

gem 'twilio-ruby', '~> 4.11.1'
gem 'dotenv-rails'
gem 'puma'
gem "font-awesome-rails"

group :development, :test do
  gem 'rspec-rails', '~> 3.1.0'
  gem "factory_girl_rails",   "~> 4.7.0"
  gem "faker"
  gem "shoulda-matchers",     "~> 3.1.1"
  gem "database_cleaner",     "~> 1.4.0"
  gem "rails_best_practices", "~> 1.16.0"
  gem "rails-erd"
  gem 'annotate'
  gem 'pry-byebug'
  gem 'awesome_print'
  gem 'pry-stack_explorer'
  gem 'pry-coolline'
  gem 'pry-doc'
  gem 'pry-rails'
  gem 'pry'
  gem 'pry-macro'
  gem 'pry-state'
end

group :development do
  gem 'better_errors'
  gem "binding_of_caller"

  gem 'spring'
end

Procfile

web: bundle exec puma -t 5:5 -p ${PORT:-3000} -e ${RACK_ENV:-development}

配置/ puma.rb

工人整数(ENV ['WEB_CONCURRENCY'] || 2) threads_count =整数(ENV ['RAILS_MAX_THREADS'] || 5) threads threads_count,threads_count

preload_app!

rackup      DefaultRackup
port        ENV['PORT']     || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
  # Worker specific setup for Rails 4.1+
  # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
  ActiveRecord::Base.establish_connection
end

1 个答案:

答案 0 :(得分:1)

我发现了这个问题并且非常简单。

1- heroku pg:reset DATABASE_URL

2- https://devcenter.heroku.com/articles/heroku-postgresql

3-从本地启动Heroku,而不是虚拟框。

工作。