lopezdp lopezdp - 2 months ago 6
Ruby Question

Failure to deploy rails app on Heroku

I have been trying to deploy a simple rails app onto heroku and i have been completely unsuccessful.

I am working on the Mac terminal using the Viking Code School prep work to walk through the "Railsfest Installation". This is the exact link I have been following:

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


My problem is that it looks like I have deployed the app successfully, but if you go the link at:

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


you can clearly see that "something is wrong"... as per heroku's standard output.

I have been working every solution to try to pin down the problem between the commands:

gem install bundler
bundle install --without production


I've set up the file correctly in the routes.rb file and I've also committed all changes to git with:

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


and I've pushed it all through successfully with:

git push heroku master


before pushing successfully i worked through a litany of errors from adding a Procfile to the test app's root path, changing gem files to include the version of ruby being used, to updating bundler with the explicit version i wanted, to updating Xcode, and anything else you can find online about this.

I've reached the extent of what i know to solve this and what is left is to read through the logs, but i don't know how to do so yet.

below are the log files for this issue, and if you can help me pinpoint the area that is causing my headache i would be greatly appreciative.

ill probably even set a bounty!!!

see logs:

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

Answer

Any time you see an error like this:

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

it probably means that you haven't run your migrations. So you probably missed the:

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

step when deploying. Most of us end up writing little scripts to do all the necessary steps in the right order so that we can simply say bin/deploy and not have to worry about it.