2016-09-19 112 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而不必擔心。