How to pass config file to Puma & Sinatra?

Viewed 3319

I have a Sinatra app that's deployed to Heroku.

I want to configure Puma via a puma.rb config file to have multiple workers, but both examples from the readme only show how to pass a 'server name' to the Procfile, but it doesn't show how to pass a config:

Method 1

bundle exec ruby app.rb -s puma

Method 2

require 'sinatra'
configure { set :server, :puma }

There's all the methods listed here which all suffer the same problem: https://github.com/puma/puma/issues/13#issuecomment-7391148


I have my configuration here in puma.rb:

workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['THREAD_COUNT'] || 5)

threads threads_count, threads_count

Here's my config.ru if that helps:

require './app'
run Sinatra::Application

I actually tried doing this instead in Procfile:

bundle exec puma -c puma.rb

Which works perfect locally but then dies in production, but no logs are generated so I have no idea what's wrong.

2 Answers
Related