Remote debugging is always harder Before you deploy maximize your confidence in

Remote debugging is always harder before you deploy

This preview shows page 512 - 514 out of 517 pages.

Remote debugging is always harder. Before you deploy, maximize your confidence in your local copy of the app! 2. If you have added or changed any gems, be sure you’ve successfully run bundle to make sure your app’s dependencies are still satisfied, and that you’ve committed and pushed any changes to Gemfile and Gemfile.lock . 3. The first time you deploy an app, heroku apps:create appname creates a new Heroku application container called appname ; if you omit the name, a whimsical name is preassigned, such as luminous-coconut-237 . In any case, your app will be deployed at http:// appname . You can change your app’s name later by logging into your Heroku account and clicking My Apps. 4. Once you’ve committed your latest changes, git push heroku master deploys the head of your local repo’s master branch to Heroku. (See this article to deploy from a branch other than master, if you’re following the branch-per-release methodology of Section 10.5 .) 5. heroku ps checks the process status ( ps ) of your deployed app. The State column should say something like “Up for 10s” meaning that your app has been available for 10 seconds. You can also use heroku logs to display the log file of your app, a useful technique if something goes wrong in production that worked fine in development. 6. heroku run rake db:migrate On any deployment where you have changed the database schema (Sections 4.2 and 12.4 ), including the first-time deployment, this command will cause the app’s database to be created or updated. If there are no pending migrations, the command safely does nothing. Heroku also has instructions on how to import the data from your development database to your production database on your first deployment. Figure A.3 summarizes how some of the useful commands you’ve been using in development mode can be applied to the deployed app on Heroku. Local (development) Heroku (production) rails server git push heroku master rails console heroku run console rake db:migrate heroku run rake db:migrate more log/development.log heroku logs Figure A.3: How to get the functionality of some useful development-mode commands for the deployed version of your app on Heroku.
Image of page 512
ELABORATION: Production best practices In this streamlined introduction, we’re omitting two best practices that Heroku recommends for “hardening” your app in production. First, our Heroku deployment still uses WEBrick as the presentation tier; Heroku recommends using the streamlined thin webserver for better performance. Second, since subtle differences between SQLite3 and PostgreSQL functionality may cause migration- related problems as your database schemas get more complex, Heroku advises using PostgreSQL in both development and production, which would require installing and configuring PostgreSQL on your VM or other development computer. In general, it’s a good idea to keep your development and production environments as similar as possible to avoid hard-to-debug problems in which something works in the development environment but fails in the production environment.
Image of page 513
Image of page 514

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors