LinuxCommandLibrary

puma

TLDR

Start Puma server

$ puma
copy
Start with config
$ puma -C [config/puma.rb]
copy
Start on specific port
$ puma -p [3000]
copy
Start with workers
$ puma -w [4]
copy
Start in daemon mode
$ puma -d
copy

SYNOPSIS

puma [options] [rackup file]

DESCRIPTION

Puma is a fast, concurrent Ruby/Rack web server. It uses threads and optional workers for parallelism, making it suitable for production Rails deployments.

PARAMETERS

-p, --port port

Listen port.
-b, --bind uri
Bind URI.
-C, --config file
Configuration file.
-w, --workers n
Number of workers.
-t, --threads min:max
Thread pool size.
-d, --daemon
Daemonize process.
-e, --environment env
Environment (development, production).

EXAMPLES

$ # Start on port 3000
puma -p 3000

# With workers and threads
puma -w 4 -t 8:32

# Bind to Unix socket
puma -b unix:///tmp/puma.sock

# Production mode
puma -e production -w 4

# With config file
puma -C config/puma.rb
copy

CONFIGURATION (puma.rb)

$ workers 4
threads 4, 16
port 3000
environment 'production'
preload_app!

on_worker_boot do
  ActiveRecord::Base.establish_connection
end
copy

CAVEATS

Ruby/Rack required. Workers require copy-on-write. Use with reverse proxy in production.

HISTORY

Puma was created by Evan Phoenix in 2011 as a replacement for Mongrel, focusing on concurrent request handling.

SEE ALSO

unicorn(1), passenger(1), rails(1), rack(1)

Copied to clipboard