Configuring Rails for Production

When you ran the bin/rails server command, Puma started up with a nice set of defaults for development mode. But in production, you’ll want a more explicit configuration suited for your production deployment platform. In this section, you’ll create that platform and get Twitalytics ready for it.

To configure Puma, create a config/puma.rb file, open it in an editor, and put the following code in it:

 port ENV[​'PORT'​] || 3000
 environment ENV[​'RACK_ENV'​] || ​'development'
 threads (ENV[​"MIN_PUMA_THREADS"​] || 0), (ENV[​"MAX_PUMA_THREADS"​] || 16)
 preload_app!

This sets the port, environment, and thread pool size based on environment variables. The defaults are intended ...

Get Deploying with JRuby 9k now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.