2016-09-19 114 views
0

我一直在试图部署一个简单的Rails应用程序到heroku上,并且我已经完全不成功。未能在Heroku上部署Rails应用程序

我正在使用海盗码学校的准备工作来浏览“Railsfest安装”,在Mac终端上工作。这是我一直在下面的确切链接:

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 [email protected] 
2016-09-18T23:38:53.571938+00:00 heroku[api]: Release v7 created by [email protected] 
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 [email protected] 
2016-09-19T00:29:07.753587+00:00 heroku[api]: Release v8 created by [email protected] 
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

“PG :: UndefinedTable:ERROR:relation”饮料“不存在”错误表明您在Heroku上没有'db:migrate'。 –

+0

它总是一件简单的事情不是它...让我看看 – lopezdp

+0

@ muistooshort耶稣男人!我花了整整一天的时间,这只是我在该终端的该死的命令!反正我的朋友,这是解决我的问题..想把它放在答案,所以你可以得到它的要点?对此,我真的非常感激。你可能想要补充的任何理由可能会帮助我发现未来可能对帖子也有帮助。 – lopezdp

回答

1

你看到这样的错误任何时候:

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

这可能意味着你没有运行您的迁移。所以你可能错过了:

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

步骤部署时。我们大多数人最终都会写小脚本来按照正确的顺序完成所有必要的步骤,以便我们可以简单地说bin/deploy而不必担心。