You are previewing Heroku Cookbook.
O'Reilly logo
Heroku Cookbook

Book Description

Over 70 step-by-step recipes to solve the challenges of administering and scaling a real-world production web application on Heroku

In Detail

Heroku is a Platform as a Service that enables developers to rapidly deploy and scale their web applications. Heroku is designed for developer happiness, freeing developers from doing system administrative tasks such as configuring servers and setting up load balancers. Developers are able to focus on what they do best, building web applications, while leaving the details of deployment and scaling to the experts at Heroku.

This practical guide is packed with step-by-step solutions to problems faced by every production-level web application hosted on Heroku. You'll quickly get comfortable with managing your Heroku applications from the command line and then learn everything you need to know to deploy and administer production-level web applications.

What You Will Learn

  • Administer and debug any Heroku application
  • Comfortably deploy any type of web application
  • Master the Heroku command-line interface (CLI)
  • Identify and eliminate bottlenecks from your apps' performance
  • Load test and monitor application performance
  • Take full advantage of the Heroku add-on marketplace
  • Set up a deployment pipeline to get applications from development to production quickly
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

    Table of Contents

    1. Heroku Cookbook
      1. Table of Contents
      2. Heroku Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the color images of this book
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Getting Started with Heroku
        1. Introduction
        2. Installing the Heroku Toolbelt
          1. Getting ready
          2. How to do it...
          3. How it works…
            1. Authentication
          4. See also
        3. Introducing version control with Git
          1. How to do it…
          2. How it works…
          3. There's more…
          4. See also
        4. Deploying a Rails application to Heroku
          1. Getting ready
          2. How to do it…
          3. How it works…
            1. The Procfile
            2. Environment variables
            3. The build process
          4. See also
        5. Deploying a Node.js application to Heroku
          1. How to do it…
          2. How it works…
            1. The ephemeral filesystem
          3. See also
        6. Introducing dynos, workers, and scaling
          1. What's a dyno?
          2. What's a worker?
          3. Process sizes
          4. How to do it...
          5. How it works…
            1. Dynos
            2. Workers
            3. One-time dynos
          6. See also
      9. 2. Managing Heroku from the Command Line
        1. Introduction
        2. Viewing application logs
          1. How to do it…
          2. How it works
          3. See also
        3. Searching logs
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        4. Installing add-ons
          1. How to do it...
          2. How it works…
          3. See also
        5. Managing environment variables
          1. How to do it...
          2. How it works…
          3. See also
        6. Enabling the maintenance page
          1. How to do it...
          2. See also
        7. Managing releases and rolling back
          1. How to do it...
          2. How it works…
        8. Running one-off tasks and dynos
          1. How to do it...
          2. How it works…
        9. Managing SSH keys
          1. How to do it…
          2. How it works…
        10. Sharing and collaboration
          1. How to do it…
          2. How it works…
          3. See also
        11. Monitoring load average and memory usage
          1. How to do it…
          2. How it works…
          3. See also
      10. 3. Setting Up a Staging Environment
        1. Introduction
        2. Duplicating an existing application
          1. How to do it...
          2. How it works...
            1. Add-ons
            2. Config variables
            3. Database
          3. See also
        3. Managing git remotes
          1. How to do it...
          2. How it works...
        4. Password protection for a Rails app
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Deploying with Heroku labs – Pipeline
          1. How to do it…
          2. How it works…
          3. See also
        6. Deploying from tags
          1. How to do it…
          2. How it works…
          3. See also
        7. Continuous integration and deployment with Travis CI
          1. Getting ready
          2. How to do it…
          3. How it works…
            1. Debugging
          4. See also
      11. 4. Production-ready with Heroku
        1. Introduction
        2. Managing domains from the command line
          1. How to do it…
          2. How it works…
          3. See also
        3. Configuring DNS with CloudFlare
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Setting up SSL with CloudFlare
          1. Getting ready
          2. How to do it…
          3. How it works…
        5. Enabling preboot for seamless deploys
          1. How to do it...
          2. How it works...
        6. Enabling custom maintenance and error pages
          1. Getting ready
          2. How to do it…
          3. How it works…
        7. Setting up a status page
          1. How to do it…
          2. How it works…
          3. See also
        8. Setting up log draining with LogEntries
          1. How to do it…
          2. How it works…
          3. See also
      12. 5. Error Monitoring and Logging Tools
        1. Introduction
        2. Checking Heroku's status
          1. How to do it…
          2. How it works…
        3. Adjusting Rails's logging level
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        4. Storing historical logs with PaperTrail
          1. How to do it…
          2. How it works…
          3. See also
        5. Monitoring for 404 and 500 errors with PaperTrail
          1. How to do it…
          2. How it works…
          3. See also
        6. Logging slow queries with PaperTrail
          1. How to do it…
          2. How it works…
          3. See also
        7. Monitoring uptime with Pingdom
          1. How to do it…
          2. How it works…
          3. See also
        8. Logging errors with Rollbar
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      13. 6. Load Testing a Heroku Application
        1. Introduction
        2. Monitoring dyno performance with Librato
          1. How to do it…
          2. How it works…
          3. See also
        3. Monitoring application performance with New Relic
          1. How to do it…
          2. How it works…
          3. See also
        4. Learning to load test with Siege
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Configuring complex load tests with Siege
          1. How to do it…
          2. How it works…
        6. Load testing from the cloud with Blitz.io
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        7. Testing real-user scenarios with Load Impact
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      14. 7. Optimizing Ruby Server Performance on Heroku
        1. Introduction
        2. Setting up and running Unicorn on Heroku
          1. How to do it…
          2. How it works
          3. See also
        3. Monitoring and tuning Unicorn's memory usage
          1. How to do it…
          2. How it works…
          3. See also
        4. Tuning Unicorn's backlog for Heroku
          1. How to do it…
          2. How it works…
          3. See also
        5. Timing out long requests with Unicorn
          1. How to do it…
          2. How it works…
          3. See also
        6. Setting up and running Puma on Heroku
          1. How to do it…
          2. How it works…
          3. See also
        7. Running Puma with Rubinius for parallelism
          1. How to do it…
          2. How it works…
          3. See also
      15. 8. Optimizing a Rails Application on Heroku
        1. Introduction
        2. Setting up a sample blogging app
          1. How to do it…
          2. See also
        3. Using Heroku Deflater to gzip assets
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        4. Serving assets from Amazon Web Services (AWS) Cloudfront
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Adding memcached to a Rails application
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. See also
        6. Adding Redis to a Rails application
          1. Getting ready…
          2. How to do it…
          3. How it works…
          4. See also
        7. Implementing low-level caching in Rails
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Caching rendered views
          1. How to do it…
          2. How it works…
          3. See also
        9. Aborting long requests with Rack::Timeout
          1. How to do it…
          2. How it works…
          3. See also
        10. Using a follower for read-only DB queries
          1. Getting ready
          2. How to do it…
            1. Using the follower database
          3. How it works…
          4. See also
      16. 9. Using and Administrating Heroku Postgres
        1. Introduction
        2. Creating and sizing a new database
          1. How to do it…
            1. Selecting a tier
            2. Determining data size
            3. Connection limits
            4. Selecting and creating the database
          2. How it works…
          3. See also
        3. Promoting a Heroku database
          1. How to do it…
          2. How it works…
        4. Connecting to Heroku Postgres from Navicat
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        5. Connecting to Heroku Postgres from psql
          1. How to do it…
          2. How it works…
          3. See also
        6. Creating a database backup
          1. How to do it…
          2. How it works…
          3. See also
        7. Restoring from a backup
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
        8. Creating a read-only follower
          1. How to do it…
          2. How it works…
            1. Redundancy
            2. Horizontal scaling
          3. See also
        9. Viewing and stopping database processes
          1. How to do it…
          2. How it works…
          3. See also
        10. Analyzing Heroku Postgres's performance
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. See also
      17. 10. The Heroku Platform API
        1. Introduction
        2. Making our first API request with HTTPie
          1. Getting ready
            1. OS X
            2. Linux
            3. Windows
          2. How to do it…
          3. How it works…
          4. See also
        3. Getting started with the Platform API gem
          1. Getting ready
          2. How to do it…
          3. How it works…
            1. Heroics
            2. Pry
          4. See also
        4. Scaling dynos and workers
          1. How to do it…
          2. How it works…
          3. See also
        5. Managing configuration variables
          1. How to do it…
          2. How it works…
          3. See also
        6. Adding and removing collaborators
          1. How to do it…
          2. How it works…
          3. See also
        7. Creating new Heroku applications
          1. How to do it…
          2. How it works…
          3. See also
      18. Index