seuros / capistrano-puma

Puma integration for Capistrano
https://github.com/seuros/capistrano-puma
MIT License
615 stars 299 forks source link

Puma 6.x #349

Closed jules-w2 closed 1 year ago

jules-w2 commented 1 year ago

Hello @seuros

capistrano3-puma does not seem ready for version 6.x of Puma, we are going back to version 1.2.1.

Do you have on ETA date for a new release ?

Bests,

bundle update Fetching gem metadata from https://rubygems.org/........ Resolving dependencies... ...... Installing puma 6.0.0 (was 5.6.5) with native extensions Fetching capistrano3-puma 1.2.1 (was 5.2.0) Installing capistrano3-puma 1.2.1 (was 5.2.0) Bundle updated!

seuros commented 1 year ago

Hold on 10 minutes. I releasing a alpha version for you.

seuros commented 1 year ago

@jules-w2 Please clean up your systemd service and use the latest version

gem 'capistrano3-puma' , '>= 6.0.0.beta.1'

bin/cap staging puma:install 

In the new version you need to have the puma config checked out in config/puma.rb or config/puma/production.rb

There is a sample app in the readme.

The same apply to capistrano-sidekiq if you use it.

I would appreciate if you help me getting this version out.

jules-w2 commented 1 year ago

@seuros ,

I spent my whole day on it, but it's working, my production app is running with Puma 6!

In the end to have a configuration that works with the same settings as before, I had to:

  1. Install Puma & capistrano-puma
gem 'puma' , '>= 6'
gem 'capistrano3-puma' , '>= 6.0.0.beta.1'
  1. set 3 values into the config/deploy.rb file to keep the same behavior as version 5.x
set :puma_systemctl_user, :system
set:puma_access_log,        "#{fetch(:deploy_to)}/shared/log/puma_access.log"
set:puma_error_log,             "#{fetch(:deploy_to)}/shared/log/puma_error.log"
  1. Update the service on the server
cap production puma:install
  1. add config for puma file (config/puma/production.rb)
my_app_path = "path/to/deploy"

directory   "#{my_app_path}/current"
rackup      "#{my_app_path}/current/config.ru"
environment "staging"

tag ""

pidfile         "#{my_app_path}/shared/tmp/pids/puma.pid"
state_path      "#{my_app_path}/shared/tmp/pids/puma.state"
stdout_redirect "#{my_app_path}/shared/log/puma_access.log", "#{my_app_path}/shared/log/puma_error.log", true

threads 0,16

bind "unix://#{my_app_path}/shared/tmp/sockets/puma.sock"

workers 0

restart_command "bundle exec puma"

prune_bundler

on_restart do
  puts "Refreshing Gemfile"
  ENV["BUNDLE_GEMFILE"] = ""
end
  1. deploy the app
cap production deploy

I think your release is ready for production!

Tanks a lot:)

seuros commented 1 year ago

Perfect. Thank you.

I will prepare a final release soon.

btw except the

threads 0,16

bind "unix://#{my_app_path}/shared/tmp/sockets/puma.sock"

workers 0

You don't need the other settings in puma.rb

I recommend you to use ENV variables to configure it like in this example : https://github.com/seuros/capistrano-example-app/blob/main/config/puma/production.rb#L4-L6