Book Image

Heroku Cookbook

By : Mike Coutermarsh
Book Image

Heroku Cookbook

By: Mike Coutermarsh

Overview of this book

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.
Table of Contents (17 chapters)
Heroku Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Setting up and running Unicorn on Heroku


For Ruby applications on Heroku, Unicorn should be our default choice when picking a web server. When Unicorn starts up, it forks our application's process. Each fork is known as a worker process. Each one of these processes are able to respond to web requests. The more processes we run, the more concurrency will be available on a single dyno.

As each worker is its own process, it has its own memory space, so we do not need to worry about our application's code being thread safe. This makes Unicorn a good choice for developers who are unsure whether their application can handle threading.

How to do it…

To begin, we will need to set up our existing Rails application to run Unicorn.

Note

If you'd like to skip this setup, you can use an example application available on GitHub at https://github.com/mscoutermarsh/unicorn-rails-heroku. This application is already set up to use Unicorn on Heroku.

Perform the following steps:

  1. First, we'll need to add Unicorn to...