Merge pull request #5178 from consuldemocracy/dependabot/bundler/puma-5.6.7

Bump puma from 4.3.12 to 5.6.7
This commit is contained in:
Javi Martín
2023-11-20 13:20:56 +01:00
committed by GitHub
6 changed files with 31 additions and 17 deletions

View File

@@ -15,7 +15,7 @@ require "rvm1/capistrano3"
require "capistrano/puma" require "capistrano/puma"
install_plugin Capistrano::Puma, load_hooks: false install_plugin Capistrano::Puma, load_hooks: false
install_plugin Capistrano::Puma::Daemon install_plugin Capistrano::Puma::Systemd
#SCM: Git #SCM: Git
require "capistrano/scm/git" require "capistrano/scm/git"

View File

@@ -44,7 +44,7 @@ gem "omniauth-twitter", "~> 1.4.0"
gem "paranoia", "~> 2.6.2" gem "paranoia", "~> 2.6.2"
gem "pg", "~> 1.4.3" gem "pg", "~> 1.4.3"
gem "pg_search", "~> 2.3.6" gem "pg_search", "~> 2.3.6"
gem "puma", "~> 4.3.12" gem "puma", "~> 5.6.7"
gem "recipient_interceptor", "~> 0.3.1" gem "recipient_interceptor", "~> 0.3.1"
gem "redcarpet", "~> 3.6.0" gem "redcarpet", "~> 3.6.0"
gem "responders", "~> 3.1.0" gem "responders", "~> 3.1.0"

View File

@@ -433,7 +433,7 @@ GEM
pronto (~> 0.11.0) pronto (~> 0.11.0)
scss_lint (~> 0.43, >= 0.43.0) scss_lint (~> 0.43, >= 0.43.0)
public_suffix (4.0.7) public_suffix (4.0.7)
puma (4.3.12) puma (5.6.7)
nio4r (~> 2.0) nio4r (~> 2.0)
racc (1.7.1) racc (1.7.1)
rack (2.2.8) rack (2.2.8)
@@ -741,7 +741,7 @@ DEPENDENCIES
pronto-eslint (~> 0.11.1) pronto-eslint (~> 0.11.1)
pronto-rubocop (~> 0.11.5) pronto-rubocop (~> 0.11.5)
pronto-scss (~> 0.11.0) pronto-scss (~> 0.11.0)
puma (~> 4.3.12) puma (~> 5.6.7)
rails (= 6.1.7.4) rails (= 6.1.7.4)
rails-assets-markdown-it (~> 9.0.1)! rails-assets-markdown-it (~> 9.0.1)!
recipient_interceptor (~> 0.3.1) recipient_interceptor (~> 0.3.1)

View File

@@ -49,6 +49,7 @@ set :fnm_install_node_command, -> { "#{fetch(:fnm_setup_command)} && fnm use --i
set :fnm_map_bins, %w[bundle node npm puma pumactl rake yarn] set :fnm_map_bins, %w[bundle node npm puma pumactl rake yarn]
set :puma_conf, "#{release_path}/config/puma/#{fetch(:rails_env)}.rb" set :puma_conf, "#{release_path}/config/puma/#{fetch(:rails_env)}.rb"
set :puma_systemctl_user, :user
set :delayed_job_workers, 2 set :delayed_job_workers, 2
set :delayed_job_roles, :background set :delayed_job_roles, :background
@@ -57,9 +58,6 @@ set :delayed_job_monitor, true
set :whenever_roles, -> { :app } set :whenever_roles, -> { :app }
namespace :deploy do namespace :deploy do
Rake::Task["delayed_job:default"].clear_actions
Rake::Task["puma:smart_restart"].clear_actions
after "rvm1:hook", "map_node_bins" after "rvm1:hook", "map_node_bins"
after :updating, "install_node" after :updating, "install_node"
@@ -68,12 +66,7 @@ namespace :deploy do
after "deploy:migrate", "add_new_settings" after "deploy:migrate", "add_new_settings"
after :publishing, "setup_puma" after :publishing, "setup_puma"
before "puma:smart_restart", "stop_puma_daemon"
after :published, "deploy:restart"
before "deploy:restart", "puma:restart"
before "deploy:restart", "delayed_job:restart"
before "deploy:restart", "puma:start"
after :finished, "refresh_sitemap" after :finished, "refresh_sitemap"
desc "Deploys and runs the tasks needed to upgrade to a new release" desc "Deploys and runs the tasks needed to upgrade to a new release"
@@ -81,6 +74,9 @@ namespace :deploy do
after "add_new_settings", "execute_release_tasks" after "add_new_settings", "execute_release_tasks"
invoke "deploy" invoke "deploy"
end end
before "deploy:restart", "puma:smart_restart"
before "deploy:restart", "delayed_job:restart"
end end
task :install_ruby do task :install_ruby do
@@ -127,7 +123,7 @@ task :map_node_bins do
on roles(:app) do on roles(:app) do
within release_path do within release_path do
with rails_env: fetch(:rails_env) do with rails_env: fetch(:rails_env) do
prefix = -> { "#{fetch(:fnm_setup_command)} && fnm exec" } prefix = -> { "#{fetch(:fnm_path)}/fnm exec" }
fetch(:fnm_map_bins).each do |command| fetch(:fnm_map_bins).each do |command|
SSHKit.config.command_map.prefix[command.to_sym].unshift(prefix) SSHKit.config.command_map.prefix[command.to_sym].unshift(prefix)
@@ -169,10 +165,30 @@ end
desc "Create pid and socket folders needed by puma" desc "Create pid and socket folders needed by puma"
task :setup_puma do task :setup_puma do
on roles(:app) do on roles(fetch(:puma_role)) do
with rails_env: fetch(:rails_env) do with rails_env: fetch(:rails_env) do
execute "mkdir -p #{shared_path}/tmp/sockets; true" execute "mkdir -p #{shared_path}/tmp/sockets; true"
execute "mkdir -p #{shared_path}/tmp/pids; true" execute "mkdir -p #{shared_path}/tmp/pids; true"
end end
end end
after "setup_puma", "puma:systemd:config"
after "setup_puma", "puma:systemd:enable"
end
# Code adapted from the task to stop the daemon in capistrano3-puma
desc "Stops the Puma daemon so systemd can start the Puma process"
task :stop_puma_daemon do
on roles(fetch(:puma_role)) do |role|
within release_path do
with rails_env: fetch(:rails_env) do
if test("[ -f #{fetch(:puma_pid)} ]") &&
!test("systemctl --user is-active #{fetch(:puma_service_unit_name)}") &&
test(:kill, "-0 $( cat #{fetch(:puma_pid)} )")
info "Puma: stopping daemon"
execute :pumactl, "-S #{fetch(:puma_state)} -F #{fetch(:puma_conf)} stop"
end
end
end
end
end end

View File

@@ -12,7 +12,6 @@ state_path "#{rails_root}/tmp/pids/puma.state"
stdout_redirect "#{rails_root}/log/puma_access.log", "#{rails_root}/log/puma_error.log", true stdout_redirect "#{rails_root}/log/puma_access.log", "#{rails_root}/log/puma_error.log", true
bind "unix://#{rails_root}/tmp/sockets/puma.sock" bind "unix://#{rails_root}/tmp/sockets/puma.sock"
daemonize
threads 0, 16 threads 0, 16
workers 2 workers 2

View File

@@ -40,7 +40,6 @@ every 1.day, at: "3:00 am", roles: [:cron] do
end end
every :reboot do every :reboot do
command "cd #{@path} && bundle exec puma -C config/puma/#{@environment}.rb"
# Number of workers must be kept in sync with capistrano's delayed_job_workers # Number of workers must be kept in sync with capistrano's delayed_job_workers
command "cd #{@path} && RAILS_ENV=#{@environment} bin/delayed_job -m -n 2 restart" command "cd #{@path} && RAILS_ENV=#{@environment} bin/delayed_job -m -n 2 restart"
end end