无法在Heroku上部署rails应用程序

时间:2016-09-19 00:56:22

标签: ruby-on-rails ruby git ruby-on-rails-3 heroku

我一直在尝试将一个简单的rails应用程序部署到heroku上,但我完全没有成功。

我正在使用Viking Code School准备工作在Mac终端上完成“Railsfest安装”。这是我一直关注的确切链接:

http://docs.railsbridge.org/installfest/deploy_a_rails_app

我的问题是看起来我已经成功部署了应用程序,但是如果你去了链接:

https://powerful-river-94011.herokuapp.com

根据heroku的标准输出,你可以清楚地看到“出了问题”......

我一直在努力解决这些命令之间的问题:

gem install bundler
bundle install --without production

我已经在routes.rb文件中正确设置了文件,并且我还将所有更改都提交给了git:

git add .
git commit -m "Updates for heroic deployment"

我已经成功地完成了以下任务:

git push heroku master

在推送成功之前我通过将一个Procfile添加到测试应用程序的根路径,更改gem文件以包含正在使用的ruby版本,使用我想要的显式版本更新bundler,更新Xcode,以及其他任何你可以在网上找到的关于此事的内容。

我达到了我所知道的解决这个问题的程度,剩下的就是阅读日志,但我不知道该怎么做。

下面的

是这个问题的日志文件,如果你能帮助我查明引起我头痛的区域,我将非常感激。

可能甚至设置了赏金!!!

见日志:

bash-3.2$ heroku logs
2016-09-18T23:32:28.482253+00:00 app[web.1]: LINE 1: SELECT "drinks".* FROM "drinks"
2016-09-18T23:32:28.482253+00:00 app[web.1]:                                ^
2016-09-18T23:32:28.482254+00:00 app[web.1]: : SELECT "drinks".* FROM "drinks"):
2016-09-18T23:32:28.482459+00:00 app[web.1]: F, [2016-09-18T23:32:28.482403 #3] FATAL -- : [8a3e7df9-9c3c-4e87-99db-98b963445aa1]     12:   </thead>
2016-09-18T23:32:28.482511+00:00 app[web.1]: F, [2016-09-18T23:32:28.482450 #3] FATAL -- : [8a3e7df9-9c3c-4e87-99db-98b963445aa1]     13: 
2016-09-18T23:32:28.482559+00:00 app[web.1]: F, [2016-09-18T23:32:28.482507 #3] FATAL -- : [8a3e7df9-9c3c-4e87-99db-98b963445aa1]     14:   <tbody>
2016-09-18T23:32:28.482607+00:00 app[web.1]: F, [2016-09-18T23:32:28.482554 #3] FATAL -- : [8a3e7df9-9c3c-4e87-99db-98b963445aa1]     15:     <% @drinks.each do |drink| %>
2016-09-18T23:32:28.482653+00:00 app[web.1]: F, [2016-09-18T23:32:28.482602 #3] FATAL -- : [8a3e7df9-9c3c-4e87-99db-98b963445aa1]     16:       <tr>
2016-09-18T23:32:28.482699+00:00 app[web.1]: F, [2016-09-18T23:32:28.482648 #3] FATAL -- : [8a3e7df9-9c3c-4e87-99db-98b963445aa1]     17:         <td><%= drink.name %></td>
2016-09-18T23:32:28.482747+00:00 app[web.1]: F, [2016-09-18T23:32:28.482695 #3] FATAL -- : [8a3e7df9-9c3c-4e87-99db-98b963445aa1]     18:         <td><%= drink.temperature %></td>
2016-09-18T23:32:28.482801+00:00 app[web.1]: F, [2016-09-18T23:32:28.482742 #3] FATAL -- : [8a3e7df9-9c3c-4e87-99db-98b963445aa1]   
2016-09-18T23:32:28.482851+00:00 app[web.1]: F, [2016-09-18T23:32:28.482796 #3] FATAL -- : [8a3e7df9-9c3c-4e87-99db-98b963445aa1] app/views/drinks/index.html.erb:15:in `_app_views_drinks_index_html_erb___3144108514546919488_70045158412820'
2016-09-18T23:38:53.796354+00:00 heroku[slug-compiler]: Slug compilation started
2016-09-18T23:38:53.796363+00:00 heroku[slug-compiler]: Slug compilation finished
2016-09-18T23:38:53.571881+00:00 heroku[api]: Deploy eb7fe63 by davidplopez@live.com
2016-09-18T23:38:53.571938+00:00 heroku[api]: Release v7 created by davidplopez@live.com
2016-09-18T23:38:54.227728+00:00 heroku[web.1]: Restarting
2016-09-18T23:38:54.228404+00:00 heroku[web.1]: State changed from up to starting
2016-09-18T23:38:57.046379+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 22549 -e production`
2016-09-18T23:38:57.661732+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-09-18T23:38:58.634008+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2016-09-18T23:38:58.634151+00:00 app[web.1]: === puma shutdown: 2016-09-18 23:38:58 +0000 ===
2016-09-18T23:38:58.634155+00:00 app[web.1]: - Goodbye!
2016-09-18T23:38:58.634262+00:00 app[web.1]: Exiting
2016-09-18T23:38:58.847640+00:00 heroku[web.1]: Process exited with status 0
2016-09-18T23:39:01.848588+00:00 app[web.1]: => Booting Puma
2016-09-18T23:39:01.848604+00:00 app[web.1]: => Rails 5.0.0.1 application starting in production on http://0.0.0.0:22549
2016-09-18T23:39:01.848605+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-09-18T23:39:03.746891+00:00 app[web.1]: Puma starting in single mode...
2016-09-18T23:39:03.746907+00:00 app[web.1]: * Version 3.6.0 (ruby 2.3.0-p0), codename: Sleepy Sunday Serenity
2016-09-18T23:39:03.746910+00:00 app[web.1]: * Min threads: 5, max threads: 5
2016-09-18T23:39:03.746941+00:00 app[web.1]: * Environment: production
2016-09-18T23:39:03.747068+00:00 app[web.1]: * Listening on tcp://0.0.0.0:22549
2016-09-18T23:39:03.747420+00:00 app[web.1]: Use Ctrl-C to stop
2016-09-18T23:39:03.924768+00:00 heroku[web.1]: State changed from starting to up
2016-09-18T23:39:06.077662+00:00 heroku[router]: at=info method=GET path="/" host=powerful-river-94011.herokuapp.com request_id=9fd02c9a-b60a-482f-8162-cf234d790d5e fwd="173.109.254.111" dyno=web.1 connect=1ms service=146ms status=500 bytes=1669
2016-09-18T23:39:06.013101+00:00 app[web.1]: I, [2016-09-18T23:39:06.012945 #3]  INFO -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e] Started GET "/" for 173.109.254.111 at 2016-09-18 23:39:06 +0000
2016-09-18T23:39:06.021251+00:00 app[web.1]: I, [2016-09-18T23:39:06.021149 #3]  INFO -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e] Processing by DrinksController#index as HTML
2016-09-18T23:39:06.053632+00:00 app[web.1]: I, [2016-09-18T23:39:06.053528 #3]  INFO -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]   Rendering drinks/index.html.erb within layouts/application
2016-09-18T23:39:06.057188+00:00 app[web.1]: D, [2016-09-18T23:39:06.057110 #3] DEBUG -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]   Drink Load (1.4ms)  SELECT "drinks".* FROM "drinks"
2016-09-18T23:39:06.057943+00:00 app[web.1]: I, [2016-09-18T23:39:06.057878 #3]  INFO -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]   Rendered drinks/index.html.erb within layouts/application (4.2ms)
2016-09-18T23:39:06.058217+00:00 app[web.1]: I, [2016-09-18T23:39:06.058153 #3]  INFO -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e] Completed 500 Internal Server Error in 37ms (ActiveRecord: 1.4ms)
2016-09-18T23:39:06.059622+00:00 app[web.1]: F, [2016-09-18T23:39:06.059558 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]   
2016-09-18T23:39:06.059696+00:00 app[web.1]: F, [2016-09-18T23:39:06.059630 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e] ActionView::Template::Error (PG::UndefinedTable: ERROR:  relation "drinks" does not exist
2016-09-18T23:39:06.059698+00:00 app[web.1]: LINE 1: SELECT "drinks".* FROM "drinks"
2016-09-18T23:39:06.059699+00:00 app[web.1]: : SELECT "drinks".* FROM "drinks"):
2016-09-18T23:39:06.059698+00:00 app[web.1]:                                ^
2016-09-18T23:39:06.059950+00:00 app[web.1]: F, [2016-09-18T23:39:06.059892 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]     12:   </thead>
2016-09-18T23:39:06.060055+00:00 app[web.1]: F, [2016-09-18T23:39:06.059952 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]     13: 
2016-09-18T23:39:06.060108+00:00 app[web.1]: F, [2016-09-18T23:39:06.060057 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]     14:   <tbody>
2016-09-18T23:39:06.060166+00:00 app[web.1]: F, [2016-09-18T23:39:06.060110 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]     15:     <% @drinks.each do |drink| %>
2016-09-18T23:39:06.060210+00:00 app[web.1]: F, [2016-09-18T23:39:06.060162 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]     16:       <tr>
2016-09-18T23:39:06.060272+00:00 app[web.1]: F, [2016-09-18T23:39:06.060213 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]     17:         <td><%= drink.name %></td>
2016-09-18T23:39:06.060339+00:00 app[web.1]: F, [2016-09-18T23:39:06.060277 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]     18:         <td><%= drink.temperature %></td>
2016-09-18T23:39:06.060385+00:00 app[web.1]: F, [2016-09-18T23:39:06.060336 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e]   
2016-09-18T23:39:06.060442+00:00 app[web.1]: F, [2016-09-18T23:39:06.060389 #3] FATAL -- : [9fd02c9a-b60a-482f-8162-cf234d790d5e] app/views/drinks/index.html.erb:15:in `_app_views_drinks_index_html_erb__3754491165099000081_70308452059260'
2016-09-19T00:16:06.502893+00:00 heroku[web.1]: Idling
2016-09-19T00:16:06.503495+00:00 heroku[web.1]: State changed from up to down
2016-09-19T00:16:10.228016+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2016-09-19T00:16:11.295273+00:00 app[web.1]: - Gracefully stopping, waiting for requests to finish
2016-09-19T00:16:11.300740+00:00 app[web.1]: === puma shutdown: 2016-09-19 00:16:11 +0000 ===
2016-09-19T00:16:11.300771+00:00 app[web.1]: - Goodbye!
2016-09-19T00:16:11.303483+00:00 app[web.1]: Exiting
2016-09-19T00:16:11.658476+00:00 heroku[web.1]: Process exited with status 0
2016-09-19T00:29:07.753454+00:00 heroku[api]: Deploy 5b3e6f2 by davidplopez@live.com
2016-09-19T00:29:07.753587+00:00 heroku[api]: Release v8 created by davidplopez@live.com
2016-09-19T00:29:08.056459+00:00 heroku[slug-compiler]: Slug compilation started
2016-09-19T00:29:08.056470+00:00 heroku[slug-compiler]: Slug compilation finished
2016-09-19T00:29:08.466255+00:00 heroku[web.1]: State changed from down to starting
2016-09-19T00:29:10.915980+00:00 heroku[web.1]: Starting process with command `bundle exec rails server -p 5753`
2016-09-19T00:29:14.218025+00:00 app[web.1]: => Booting Puma
2016-09-19T00:29:14.218044+00:00 app[web.1]: => Rails 5.0.0.1 application starting in production on http://0.0.0.0:5753
2016-09-19T00:29:14.218045+00:00 app[web.1]: => Run `rails server -h` for more startup options
2016-09-19T00:29:15.338030+00:00 app[web.1]: Puma starting in single mode...
2016-09-19T00:29:15.338095+00:00 app[web.1]: * Version 3.6.0 (ruby 2.3.0-p0), codename: Sleepy Sunday Serenity
2016-09-19T00:29:15.338100+00:00 app[web.1]: * Min threads: 5, max threads: 5
2016-09-19T00:29:15.338121+00:00 app[web.1]: * Environment: production
2016-09-19T00:29:15.338253+00:00 app[web.1]: * Listening on tcp://0.0.0.0:5753
2016-09-19T00:29:15.338788+00:00 app[web.1]: Use Ctrl-C to stop
2016-09-19T00:29:16.009844+00:00 heroku[web.1]: State changed from starting to up
2016-09-19T00:29:29.948560+00:00 heroku[router]: at=info method=GET path="/" host=powerful-river-94011.herokuapp.com request_id=3fc77aa8-702f-4a4d-b944-92e719770e93 fwd="173.109.254.111" dyno=web.1 connect=0ms service=97ms status=500 bytes=1669
2016-09-19T00:29:29.908406+00:00 app[web.1]: I, [2016-09-19T00:29:29.908307 #3]  INFO -- : [3fc77aa8-702f-4a4d-b944-92e719770e93] Started GET "/" for 173.109.254.111 at 2016-09-19 00:29:29 +0000
2016-09-19T00:29:29.913950+00:00 app[web.1]: I, [2016-09-19T00:29:29.913875 #3]  INFO -- : [3fc77aa8-702f-4a4d-b944-92e719770e93] Processing by DrinksController#index as HTML
2016-09-19T00:29:29.930107+00:00 app[web.1]: I, [2016-09-19T00:29:29.930014 #3]  INFO -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]   Rendering drinks/index.html.erb within layouts/application
2016-09-19T00:29:29.934558+00:00 app[web.1]: D, [2016-09-19T00:29:29.934469 #3] DEBUG -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]   Drink Load (2.0ms)  SELECT "drinks".* FROM "drinks"
2016-09-19T00:29:29.935373+00:00 app[web.1]: I, [2016-09-19T00:29:29.935300 #3]  INFO -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]   Rendered drinks/index.html.erb within layouts/application (5.0ms)
2016-09-19T00:29:29.935723+00:00 app[web.1]: I, [2016-09-19T00:29:29.935651 #3]  INFO -- : [3fc77aa8-702f-4a4d-b944-92e719770e93] Completed 500 Internal Server Error in 22ms (ActiveRecord: 2.0ms)
2016-09-19T00:29:29.937360+00:00 app[web.1]: F, [2016-09-19T00:29:29.937284 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]   
2016-09-19T00:29:29.937443+00:00 app[web.1]: F, [2016-09-19T00:29:29.937364 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93] ActionView::Template::Error (PG::UndefinedTable: ERROR:  relation "drinks" does not exist
2016-09-19T00:29:29.937445+00:00 app[web.1]: LINE 1: SELECT "drinks".* FROM "drinks"
2016-09-19T00:29:29.937446+00:00 app[web.1]:                                ^
2016-09-19T00:29:29.937446+00:00 app[web.1]: : SELECT "drinks".* FROM "drinks"):
2016-09-19T00:29:29.945989+00:00 app[web.1]: F, [2016-09-19T00:29:29.945902 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]     12:   </thead>
2016-09-19T00:29:29.946071+00:00 app[web.1]: F, [2016-09-19T00:29:29.945991 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]     13: 
2016-09-19T00:29:29.946309+00:00 app[web.1]: F, [2016-09-19T00:29:29.946233 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]     14:   <tbody>
2016-09-19T00:29:29.946375+00:00 app[web.1]: F, [2016-09-19T00:29:29.946313 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]     15:     <% @drinks.each do |drink| %>
2016-09-19T00:29:29.946450+00:00 app[web.1]: F, [2016-09-19T00:29:29.946377 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]     16:       <tr>
2016-09-19T00:29:29.946769+00:00 app[web.1]: F, [2016-09-19T00:29:29.946700 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]     17:         <td><%= drink.name %></td>
2016-09-19T00:29:29.946843+00:00 app[web.1]: F, [2016-09-19T00:29:29.946772 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]     18:         <td><%= drink.temperature %></td>
2016-09-19T00:29:29.946942+00:00 app[web.1]: F, [2016-09-19T00:29:29.946846 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93]   
2016-09-19T00:29:29.947034+00:00 app[web.1]: F, [2016-09-19T00:29:29.946967 #3] FATAL -- : [3fc77aa8-702f-4a4d-b944-92e719770e93] app/views/drinks/index.html.erb:15:in `_app_views_drinks_index_html_erb___232611807967303687_70173197040100'
bash-3.2$ git remote show
heroku

1 个答案:

答案 0 :(得分:1)

每当您看到这样的错误时:

PG::UndefinedTable: ERROR: relation "drinks" does not exist

这可能意味着您无法运行迁移。所以你可能错过了:

heroku run rake db:migrate --app ...

部署时的步骤。我们大多数人最终都会编写一些小脚本来按正确的顺序执行所有必要的步骤,这样我们就可以简单地说bin/deploy而不必担心它。