How to start Sinatra app using Puma

The following will look at and start app using puma by default

cd myapp

Assuming we have a similar to this

require './app'

# Sinatra (optional) config
enable :logging, :static

configure :production do
  disable :logging

run Sinatra::Application

If you want to force use of puma use

rackup -s Puma

To allow a puma config file you must call puma directly ...

bundle exec puma -C "./config/puma.rb"

A sample config file is ./config/puma.rb

name = "myapp"
port 3003

environment "production"


pidfile "#{RUN}/puma-#{name}.pid"
bind "unix://#{RUN}/puma-#{name}.sock"
state_path "#{RUN}/puma-#{name}.state"

tag name

workers 2
threads 1, 1


To run puma as daemon (after version 5.0) you need to use puma-daemon gem.

Add to Gemfile and add daemonize to puma.rb

require 'puma/daemon'

I have NOT found any way to run puma from rackup and using the puma config file ...

Kill server

Kill sever by sending SIGINT to server PID e.g.

sudo kill -SIGINT `cat ./run/`