Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Puma .state file

I'm attempting to deploy my rails application w/ puma using Capistrano. Towards the end ofthe deployment it attempts to run

bundle exec pumactl -S /home/deployer/production/shared/sockets/puma.state restart

which fails w/

undefined method `has_key?' for false:FalseClass. 

I have simply created a empty file for puma.state. My question is what exactly is this file and what is supposed to be in it?

like image 979
Kyle Decot Avatar asked Oct 24 '12 02:10

Kyle Decot


People also ask

What is Puma in Rails?

Puma is a small library that provides a very fast and concurrent HTTP 1.1 server for Ruby web applications. It is designed for running Rack apps only.

What is PUMA single mode?

Puma works in two main modes: cluster and single. In single mode, only one Puma process boots. In cluster mode, a master process is booted, which prepares (and may boot) the application and then uses the fork() system call to create one or more child processes. These child processes all listen to the same socket.

Is Puma a web server or application server?

Puma is an HTTP web server derived from Mongrel and written by Evan Phoenix. It stresses speed and efficient use of memory.


1 Answers

Puma has a state file that records the PID of the process. If you are deploying for the first time, you should delete the .state file, and do a

cap deploy:cold

or, you can start puma manually using something like

cap puma:start

This will start the process and create a valid state file. Here is my puma start command in capistrano:

namespace :puma do

  desc "Start the application"
  task :start, :roles => :app, :except => { :no_release => true } do
    run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec puma -t 8:32 -b 'unix://#{shared_path}/sockets/puma.sock' -S #{shared_path}/sockets/puma.state --control 'unix://#{shared_path}/sockets/pumactl.sock' >> #{shared_path}/log/puma-#{rails_env}.log 2>&1 &", :pty => false
  end
  after "deploy:start", "puma:start"
end
like image 130
Jesse Wolgamott Avatar answered Sep 19 '22 09:09

Jesse Wolgamott