Puma .state file
-
14-07-2021 - |
Question
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?
Solution
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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow