Puma config
Puma: 6.4.0
#!/usr/bin/env puma
directory "/home/prj/current"
rackup "/home/prj/current/config.ru"
environment "staging"
pidfile "/home/prj/shared/tmp/pids/puma.pid"
state_path "/home/prj/shared/tmp/pids/puma.state"
stdout_redirect '/home/prj/shared/log/puma_access.log', '/home/prj/shared/log/puma_error.log', true
bind 'unix:///home/prj/shared/tmp/sockets/puma.sock'
workers 2
max_threads_count = 16
min_threads_count = 1
threads min_threads_count, max_threads_count
prune_bundler
on_worker_boot do
require "active_record"
ActiveRecord::Base.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished
ActiveRecord::Base.establish_connection
end
before_fork do
ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
end
SystemdReload Command
WorkingDirectory=/home/prj/current
ExecReload=/bin/bash -l -c 'bundle exec pumactl -S /home/prj/shared/tmp/pids/puma.state -F /home/prj/shared/config/puma.rb phased-restart'
Capistrano Config
set :puma_phased_restart, true
set :puma_enable_socket_service, true
set :puma_systemctl_user, :system
After deploy capistrano run
/bin/systemctl reload puma
When I show state of puma, working directory is previous release although cluster reload to the new one. So How can I know newest code already running or not? Why puma state not change directory working?
cat /home/prj/current/tmp/pids/puma.state
---
pid: 4475
running_from: "/home/prj/releases/20231206070847"
ps aux | grep puma
deploy 4475 0.0 1.1 105820 11392 ? Ss Dec06 0:05 puma 6.4.0 (unix:///home/prj/shared/tmp/sockets/puma.sock) [20231206070847]
deploy 22985 0.1 16.6 785688 162364 ? Sl 12:42 0:04 puma: cluster worker 0: 4475 [20231206070847]
deploy 23001 0.1 22.7 812040 221384 ? Sl 12:42 0:04 puma: cluster worker 1: 4475 [20231206070847]
ls /home/prj/releases/
20231206073136 20231206073247 20231207032212