$ bundle install --without production
Publish to HerokuPublishing to the cloud from my local git repo I need to make sure that it is updated with all recent changes, therefore after changing the gem file I need to commit, then push from git to heroku. Needless to say that the Heroku command line tool needs to be locally installed and that we need to login to Heroku.
To publish the master brach to Heroku run this command:
$ git push heroku master
Of course I could push any branch but at this time, the master branch is the one with all features. If the push yields no errors then I am in luck! In the case that there are errors, Heroku stores them in the logs file.
$ heroku logs
Fix the errors and continue. In my case, my 'novice' error was that I neglected to create a production group with Postgre gem in it. I still need the sqlite gem in the gem file to be able to use this SQLite during development. Therefore, a development group was created containing the sqlite gem. The reviewed development and production groups look like this:
group :development dogem 'sqlite3'endgroup :production dogem 'pg'gem 'rails_12factor'end
At this time Heroku does not know anything about our Object Model and the database has not been created yet, therefore, if I run the app after pushing then my app does not run, but if I run it any way, Heroku issues an app error page and the reason for the failure is written to the log and I could view it with "heroku logs" .
To create my database I need to run the rake db migration command in the Heroku command line tool. As a matter of fact, every time my Active Record model changes I need to run this command in the Heroku command line tool:
$ heroku run rake db:migrate
Now the app can be loaded in the browser using the command:
$ heroku open
There is no data however because that db has not been seeded, but this is a different story. At this time everything works and I can move to other things... mainly keep learning RoR!
Other Useful Heroku CommandsThere are other commands that I needed to use and they are:
$ heroku login $ heroku create $ heroku restart
The above command are self explanatory.
Stopping and Starting the App Running on Heroku
$ heroku ps:scale web=0
Setting "web=0" scales down the app to 0, and the result is the stopped app.
$ heroku ps:scale web=1
To start it up again scale the app to "web=1".