2015-07-03 123 views
0

这是我第一次部署Heroku。我一直在看和阅读无数的资源,仍然无法弄清楚为什么我会得到这么多的错误。我已经在部署过渡到postgresql,将ruby版本添加到gemfile,setup puma和procfile中。任何帮助是极大的赞赏。初级Rails部署到Heroku

heroku logs 
2015-07-03T20:10:25.239238+00:00 heroku[api]: Release v8 created by [email protected] 
2015-07-03T20:10:25.322364+00:00 heroku[web.1]: State changed from crashed to starting 
2015-07-03T20:10:29.668690+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb` 
2015-07-03T20:10:31.657586+00:00 app[web.1]: config/puma.rb:66:in `_load_from': undefined local variable or method `path_to_key' for #<Puma::DSL:0x007f3dbbc6d798> (NameError) 
2015-07-03T20:10:31.657616+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:20:in `instance_eval' 
2015-07-03T20:10:31.657618+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:20:in `_load_from' 
2015-07-03T20:10:31.657620+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:9:in `block in load' 
2015-07-03T20:10:31.657621+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:8:in `tap' 
2015-07-03T20:10:31.657622+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:8:in `load' 
2015-07-03T20:10:31.657624+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/configuration.rb:35:in `load' 
2015-07-03T20:10:31.657625+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/cli.rb:545:in `parse_options' 
2015-07-03T20:10:31.657626+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/cli.rb:190:in `run' 
2015-07-03T20:10:31.657627+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/bin/puma:10:in `<top (required)>' 
2015-07-03T20:10:31.657632+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/bin/puma:23:in `<main>' 
2015-07-03T20:10:31.657629+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/bin/puma:23:in `load' 
2015-07-03T20:10:32.427366+00:00 heroku[web.1]: State changed from starting to crashed 
2015-07-03T20:10:32.416181+00:00 heroku[web.1]: Process exited with status 1 
2015-07-03T20:10:53.231676+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sheltered-bastion-3907.herokuapp.com request_id=270e6357-61b1-4a76-be72-48ffaddca924 fwd="73.219.192.111" dyno= connect= service= status=503 bytes= 
2015-07-03T20:10:53.117888+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sheltered-bastion-3907.herokuapp.com request_id=07da6d55-0f58-419e-b43c-bd5b2d6826af fwd="73.219.192.111" dyno= connect= service= status=503 bytes= 
2015-07-03T20:17:47.455257+00:00 heroku[web.1]: State changed from crashed to starting 
2015-07-03T20:17:52.666069+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb` 
2015-07-03T20:17:54.638707+00:00 app[web.1]: config/puma.rb:66:in `_load_from': undefined local variable or method `path_to_key' for #<Puma::DSL:0x007fc6d540e7c0> (NameError) 
2015-07-03T20:17:54.638733+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:20:in `instance_eval' 
2015-07-03T20:17:54.638735+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:20:in `_load_from' 
2015-07-03T20:17:54.638737+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:9:in `block in load' 
2015-07-03T20:17:54.638738+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:8:in `tap' 
2015-07-03T20:17:54.638741+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/configuration.rb:35:in `load' 
2015-07-03T20:17:54.638742+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/cli.rb:545:in `parse_options' 
2015-07-03T20:17:54.638740+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:8:in `load' 
2015-07-03T20:17:54.638743+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/cli.rb:190:in `run' 
2015-07-03T20:17:54.638745+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/bin/puma:10:in `<top (required)>' 
2015-07-03T20:17:54.638748+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/bin/puma:23:in `load' 
2015-07-03T20:17:54.638750+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/bin/puma:23:in `<main>' 
2015-07-03T20:17:55.418705+00:00 heroku[web.1]: State changed from starting to crashed 
2015-07-03T20:17:55.419971+00:00 heroku[web.1]: State changed from crashed to starting 
2015-07-03T20:17:55.402960+00:00 heroku[web.1]: Process exited with status 1 
2015-07-03T20:18:00.150833+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb` 
2015-07-03T20:18:02.318326+00:00 app[web.1]: config/puma.rb:66:in `_load_from': undefined local variable or method `path_to_key' for #<Puma::DSL:0x007f3df1b321e0> (NameError) 
2015-07-03T20:18:02.318351+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:20:in `instance_eval' 
2015-07-03T20:18:02.318353+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:20:in `_load_from' 
2015-07-03T20:18:02.318356+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:8:in `tap' 
2015-07-03T20:18:02.318355+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:9:in `block in load' 
2015-07-03T20:18:02.318357+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:8:in `load' 
2015-07-03T20:18:02.318359+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/cli.rb:545:in `parse_options' 
2015-07-03T20:18:02.318358+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/configuration.rb:35:in `load' 
2015-07-03T20:18:02.318360+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/cli.rb:190:in `run' 
2015-07-03T20:18:02.318361+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/bin/puma:10:in `<top (required)>' 
2015-07-03T20:18:02.318362+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/bin/puma:23:in `load' 
2015-07-03T20:18:02.318364+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/bin/puma:23:in `<main>' 
2015-07-03T20:18:03.109652+00:00 heroku[web.1]: State changed from starting to crashed 
2015-07-03T20:18:03.087281+00:00 heroku[web.1]: Process exited with status 1 
2015-07-03T20:18:05.096319+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sheltered-bastion-3907.herokuapp.com request_id=0ad389e3-a02f-43f2-a29c-ad4e8aeb2106 fwd="73.219.192.111" dyno= connect= service= status=503 bytes= 
2015-07-03T20:18:05.333898+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=sheltered-bastion-3907.herokuapp.com request_id=201736a7-5254-4467-bb0c-fc49c7ca8e61 fwd="73.219.192.111" dyno= connect= service= status=503 bytes= 
2015-07-03T20:21:39.079385+00:00 heroku[web.1]: State changed from crashed to starting 
2015-07-03T20:21:51.485731+00:00 heroku[api]: Starting process with command `rails console` by [email protected] 
2015-07-03T20:21:55.526689+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb` 
2015-07-03T20:21:57.017844+00:00 heroku[run.6543]: Awaiting client 
2015-07-03T20:21:57.051627+00:00 heroku[run.6543]: Starting process with command `rails console` 
2015-07-03T20:21:57.186947+00:00 heroku[run.6543]: State changed from starting to up 
2015-07-03T20:21:57.471779+00:00 app[web.1]: config/puma.rb:66:in `_load_from': undefined local variable or method `path_to_key' for #<Puma::DSL:0x007fe598fddab0> (NameError) 
2015-07-03T20:21:57.471807+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:20:in `instance_eval' 
2015-07-03T20:21:57.471809+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:20:in `_load_from' 
2015-07-03T20:21:57.471810+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:9:in `block in load' 
2015-07-03T20:21:57.471812+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:8:in `tap' 
2015-07-03T20:21:57.471813+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:8:in `load' 
2015-07-03T20:21:57.471814+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/configuration.rb:35:in `load' 
2015-07-03T20:21:57.471816+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/cli.rb:545:in `parse_options' 
2015-07-03T20:21:57.471817+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/cli.rb:190:in `run' 
2015-07-03T20:21:57.471818+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/bin/puma:10:in `<top (required)>' 
2015-07-03T20:21:57.471828+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/bin/puma:23:in `load' 
2015-07-03T20:21:57.471830+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/bin/puma:23:in `<main>' 
2015-07-03T20:21:58.226945+00:00 heroku[web.1]: Process exited with status 1 
2015-07-03T20:21:58.240543+00:00 heroku[web.1]: State changed from starting to crashed 
2015-07-03T20:22:15.185831+00:00 heroku[run.6543]: State changed from up to complete 
2015-07-03T20:22:15.170261+00:00 heroku[run.6543]: Process exited with status 0 
2015-07-03T20:22:33.180767+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by [email protected] 
2015-07-03T20:22:39.525530+00:00 heroku[run.2044]: Awaiting client 
2015-07-03T20:22:39.555404+00:00 heroku[run.2044]: Starting process with command `bundle exec rake db:migrate` 
2015-07-03T20:22:39.843264+00:00 heroku[run.2044]: State changed from starting to up 
2015-07-03T20:22:47.821258+00:00 heroku[run.2044]: State changed from up to complete 
2015-07-03T20:22:47.804773+00:00 heroku[run.2044]: Process exited with status 0 
2015-07-03T20:24:08.475083+00:00 heroku[api]: Deploy 9ef9d59 by [email protected] 
2015-07-03T20:24:08.475083+00:00 heroku[api]: Release v9 created by [email protected] 
2015-07-03T20:24:08.524035+00:00 heroku[slug-compiler]: Slug compilation started 
2015-07-03T20:24:08.524042+00:00 heroku[slug-compiler]: Slug compilation finished 
2015-07-03T20:24:08.595914+00:00 heroku[web.1]: State changed from crashed to starting 
2015-07-03T20:24:17.032551+00:00 heroku[web.1]: Starting process with command `bundle exec puma -C config/puma.rb` 
2015-07-03T20:24:19.244953+00:00 app[web.1]: config/puma.rb:66:in `_load_from': undefined local variable or method `path_to_key' for #<Puma::DSL:0x007efccd061870> (NameError) 
2015-07-03T20:24:19.244976+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:20:in `instance_eval' 
2015-07-03T20:24:19.244979+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:9:in `block in load' 
2015-07-03T20:24:19.244978+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:20:in `_load_from' 
2015-07-03T20:24:19.244981+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:8:in `tap' 
2015-07-03T20:24:19.245034+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/dsl.rb:8:in `load' 
2015-07-03T20:24:19.245036+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/configuration.rb:35:in `load' 
2015-07-03T20:24:19.245037+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/cli.rb:545:in `parse_options' 
2015-07-03T20:24:19.245038+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/lib/puma/cli.rb:190:in `run' 
2015-07-03T20:24:19.245040+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/gems/puma-2.11.3/bin/puma:10:in `<top (required)>' 
2015-07-03T20:24:19.245041+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/bin/puma:23:in `load' 
2015-07-03T20:24:19.245042+00:00 app[web.1]: from /app/vendor/bundle/ruby/2.2.0/bin/puma:23:in `<main>' 
2015-07-03T20:24:20.019209+00:00 heroku[web.1]: State changed from starting to crashed 
2015-07-03T20:24:20.009361+00:00 heroku[web.1]: Process exited with status 1 

回答

3

您是否制作沿config/puma.rb文件与Procfile?如果没有,添加以下内容到Procfile创建它:

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

然后,创建一个名为config/puma.rb文件,并设置它就像这样:

workers Integer(ENV['WEB_CONCURRENCY'] || 2) 
threads_count = Integer(ENV['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 

看看是否有帮助。更多信息可以在文档here中找到。您可能已经考虑过这一点,但这是一个缩小问题范围的初始行动。

+0

名为'Procfile'的纯文本文件应该放在根目录的rails目录中吗? – inthenameofmusik

+0

是的,这是正确的。 –

+0

我刚刚得到它的工作......非常感谢你。 – inthenameofmusik