Heroku Cookbook

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

Heroku Cookbook

Cookbook
Mike Coutermarsh

Over 70 step-by-step recipes to solve the challenges of administering and scaling a real-world production web application on Heroku
$29.99
$49.99
RRP $29.99
RRP $49.99
eBook
Print + eBook
$12.99 p/month

Want this title & more? Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.
Code Files
+ Collection
Free Sample

Book Details

ISBN 139781782177944
Paperback232 pages

About This Book

  • Make use of popular open-source projects that you’ll learn to deploy and administer step-by-step
  • Learn to effectively scale web applications while maintaining peak performance and reducing costs
  • Get work done fast; packed with straight and to the point solutions to real-world problems that every Heroku user faces

Who This Book Is For

This book is intended for developers who want to learn what it takes to deploy and manage production-level applications on Heroku. You might have already deployed applications to Heroku or might be entirely new to the platform. This book will get you up to speed quickly with all the information needed to run real-world web applications on Heroku. When using the recipes in this book, it will be helpful to have some prior experience in working with Git and command-line applications.

Table of Contents

Chapter 1: Getting Started with Heroku
Introduction
Installing the Heroku Toolbelt
Introducing version control with Git
Deploying a Rails application to Heroku
Deploying a Node.js application to Heroku
Introducing dynos, workers, and scaling
Chapter 2: Managing Heroku from the Command Line
Introduction
Viewing application logs
Searching logs
Installing add-ons
Managing environment variables
Enabling the maintenance page
Managing releases and rolling back
Running one-off tasks and dynos
Managing SSH keys
Sharing and collaboration
Monitoring load average and memory usage
Chapter 3: Setting Up a Staging Environment
Introduction
Duplicating an existing application
Managing git remotes
Password protection for a Rails app
Deploying with Heroku labs – Pipeline
Deploying from tags
Continuous integration and deployment with Travis CI
Chapter 4: Production-ready with Heroku
Introduction
Managing domains from the command line
Configuring DNS with CloudFlare
Setting up SSL with CloudFlare
Enabling preboot for seamless deploys
Enabling custom maintenance and error pages
Setting up a status page
Setting up log draining with LogEntries
Chapter 5: Error Monitoring and Logging Tools
Introduction
Checking Heroku's status
Adjusting Rails's logging level
Storing historical logs with PaperTrail
Monitoring for 404 and 500 errors with PaperTrail
Logging slow queries with PaperTrail
Monitoring uptime with Pingdom
Logging errors with Rollbar
Chapter 6: Load Testing a Heroku Application
Introduction
Monitoring dyno performance with Librato
Monitoring application performance with New Relic
Learning to load test with Siege
Configuring complex load tests with Siege
Load testing from the cloud with Blitz.io
Testing real-user scenarios with Load Impact
Chapter 7: Optimizing Ruby Server Performance on Heroku
Introduction
Setting up and running Unicorn on Heroku
Monitoring and tuning Unicorn's memory usage
Tuning Unicorn's backlog for Heroku
Timing out long requests with Unicorn
Setting up and running Puma on Heroku
Running Puma with Rubinius for parallelism
Chapter 8: Optimizing a Rails Application on Heroku
Introduction
Setting up a sample blogging app
Using Heroku Deflater to gzip assets
Serving assets from Amazon Web Services (AWS) Cloudfront
Adding memcached to a Rails application
Adding Redis to a Rails application
Implementing low-level caching in Rails
Caching rendered views
Aborting long requests with Rack::Timeout
Using a follower for read-only DB queries
Chapter 9: Using and Administrating Heroku Postgres
Introduction
Creating and sizing a new database
Promoting a Heroku database
Connecting to Heroku Postgres from Navicat
Connecting to Heroku Postgres from psql
Creating a database backup
Restoring from a backup
Creating a read-only follower
Viewing and stopping database processes
Analyzing Heroku Postgres's performance
Chapter 10: The Heroku Platform API
Introduction
Making our first API request with HTTPie
Getting started with the Platform API gem
Scaling dynos and workers
Managing configuration variables
Adding and removing collaborators
Creating new Heroku 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

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.

Authors

Table of Contents

Chapter 1: Getting Started with Heroku
Introduction
Installing the Heroku Toolbelt
Introducing version control with Git
Deploying a Rails application to Heroku
Deploying a Node.js application to Heroku
Introducing dynos, workers, and scaling
Chapter 2: Managing Heroku from the Command Line
Introduction
Viewing application logs
Searching logs
Installing add-ons
Managing environment variables
Enabling the maintenance page
Managing releases and rolling back
Running one-off tasks and dynos
Managing SSH keys
Sharing and collaboration
Monitoring load average and memory usage
Chapter 3: Setting Up a Staging Environment
Introduction
Duplicating an existing application
Managing git remotes
Password protection for a Rails app
Deploying with Heroku labs – Pipeline
Deploying from tags
Continuous integration and deployment with Travis CI
Chapter 4: Production-ready with Heroku
Introduction
Managing domains from the command line
Configuring DNS with CloudFlare
Setting up SSL with CloudFlare
Enabling preboot for seamless deploys
Enabling custom maintenance and error pages
Setting up a status page
Setting up log draining with LogEntries
Chapter 5: Error Monitoring and Logging Tools
Introduction
Checking Heroku's status
Adjusting Rails's logging level
Storing historical logs with PaperTrail
Monitoring for 404 and 500 errors with PaperTrail
Logging slow queries with PaperTrail
Monitoring uptime with Pingdom
Logging errors with Rollbar
Chapter 6: Load Testing a Heroku Application
Introduction
Monitoring dyno performance with Librato
Monitoring application performance with New Relic
Learning to load test with Siege
Configuring complex load tests with Siege
Load testing from the cloud with Blitz.io
Testing real-user scenarios with Load Impact
Chapter 7: Optimizing Ruby Server Performance on Heroku
Introduction
Setting up and running Unicorn on Heroku
Monitoring and tuning Unicorn's memory usage
Tuning Unicorn's backlog for Heroku
Timing out long requests with Unicorn
Setting up and running Puma on Heroku
Running Puma with Rubinius for parallelism
Chapter 8: Optimizing a Rails Application on Heroku
Introduction
Setting up a sample blogging app
Using Heroku Deflater to gzip assets
Serving assets from Amazon Web Services (AWS) Cloudfront
Adding memcached to a Rails application
Adding Redis to a Rails application
Implementing low-level caching in Rails
Caching rendered views
Aborting long requests with Rack::Timeout
Using a follower for read-only DB queries
Chapter 9: Using and Administrating Heroku Postgres
Introduction
Creating and sizing a new database
Promoting a Heroku database
Connecting to Heroku Postgres from Navicat
Connecting to Heroku Postgres from psql
Creating a database backup
Restoring from a backup
Creating a read-only follower
Viewing and stopping database processes
Analyzing Heroku Postgres's performance
Chapter 10: The Heroku Platform API
Introduction
Making our first API request with HTTPie
Getting started with the Platform API gem
Scaling dynos and workers
Managing configuration variables
Adding and removing collaborators
Creating new Heroku applications

Book Details

ISBN 139781782177944
Paperback232 pages
Read More

Recommended for You