The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

franfabrizio (17) [Avatar] Offline
#1
It seems that the section on deploying to Heroku is out of date and no longer works.

Apparently, heroku labs:enable user-env-compile is totally deprecated and no longer needed. You get an error when you try to run that command, and Google suggests it isn't necessary any more.

If I skip that step and do the rest, I am greeted with the generic "We're sorry, but something went wrong." when I hit my Heroku URL. The deployment appeared to be successful based on the console output. It did warn me about two things while deploying:

remote: ###### WARNING:
remote: You have not declared a Ruby version in your Gemfile.
remote: To set your Ruby version add this line to your Gemfile:
remote: ruby '2.0.0'
remote: # See https://devcenter.heroku.com/articles/ruby-versions for more information.
remote:
remote: ###### WARNING:
remote: No Procfile detected, using the default web server (webrick)
remote: https://devcenter.heroku.com/articles/ruby-default-web-server
sevenseacat (42) [Avatar] Offline
#2
Odd, it worked when I revised that chapter about a month ago. I'll be revisiting it again in my final technical proof within a week, and will fix up any issues I encounter. Thanks for reporting this!

(edit) The two warnings are okay and can be ignored for now.
franfabrizio (17) [Avatar] Offline
#3
I figured out how to get at heroku logs and the problem is essentially this:

2015-03-30T02:22:29.550578+00:00 app[web.1]: ActionView::Template::Error (PG::UndefinedTable: ERROR:  relation "states" does not exist


This was the first query the app tried to run, so I am guessing I just need to figure out how to do the initial db:migrate to create the database. Looking back through the lengthy output from the git push heroku master, I don't see any evidence that a migration occurred. Is it supposed to be automatic?
franfabrizio (17) [Avatar] Offline
#4
Confirmed that these two additional steps put the app in a functional state on Heroku:

heroku run rake db:migrate
heroku run rake db:seed
sevenseacat (42) [Avatar] Offline
#5
I didn't realize that Manning's MEAP didn't include chapters 13 and onwards when I wrote the last message, my apologies.

We've addressed this problem in the manuscript already:


Oh dear! Our first production issue. What do we do in this case? To start
with, we can consult the Heroku logs. The logs are the first place that we
should go looking whenever anything goes wrong in our application. Let's open
them up now with `heroku logs`. Looking through them, we can see this line
(split out into 3 lines here for legibility):

----
[timestamp] app[web.1]:
ActionView::Template::Error
(PG::UndefinedTable: ERROR: relation "states" does not exist
----

This line is telling us that the `states` relation doesn't exist. In
PostgreSQL, tables are called "relations"; so that would indicate that the
`states` table is the thing that doesn't exist. How would this come to be? It
would seem that we've forgotten to run our migrations on our production
environment! To run the migrations on Heroku we can run this command:

----
$ heroku run rake db:migrate
----

Let's refresh our application again. This time we'll see it running properly!
franfabrizio (17) [Avatar] Offline
#6
Good to know, thanks. I'll stop reporting issues from Ch. 13-15 until Manning updates the MEAP.