I'm building a Sinatra application that needs to be threadable, as I'm using sucker-punch for jobs, and I want to use the Puma server to do it though I've never used it before.
For some reason, when I start my application it runs Thin.
I uninstalled Thin and it uses Puma, which is good, but how do I stop it from starting with Thin in the future in the case this happens again?
I start my application with rackup
and I have in my main app.rb file:
class App < ::Sinatra::Base
configure do
set :show_exceptions, true
set :root, Info[:root]
set :threaded, true
set :server, :puma
Tilt.register Tilt::ERBTemplate, 'html.erb'
enable :logging
use Rack::CommonLogger, Log.file
if ENV['APP_ENVIRONMENT'] == 'PROD'
set :environment, :production
set :bind, '0.0.0.0', HOST
set :show_exceptions, false
end
end
end
You need to set your server in the config.ru
rackup file. In this file you can set
Rack::Handler.get('puma').run App.new
Documentation is available in "Module: Rack::Handler".
However an even better way is to just run Puma explicitly:
bundle exec puma config.ru
OR as suggested by @matt:
rackup -s puma