seuros / capistrano-puma

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

fix to error while invoking puma:systemd:generate_config_locally #334

Closed matsu911 closed 2 years ago

matsu911 commented 3 years ago

This PR fix the following error.

$ cap staging puma:systemd:generate_config_locally
(Backtrace restricted to imported tasks)
cap aborted!
NoMethodError: undefined method `properties' for #<struct hostname="example.com">

Tasks: TOP => puma:systemd:generate_config_locally
(See full trace by running task with --trace)
qichunren commented 2 years ago

I got this error. Thanks your fix.

sime commented 2 years ago

@matsu911 Would you know how to monkey patch this?

github-actions[bot] commented 2 years ago

Stale pull request message

jesperronn commented 2 years ago

@seuros @Nowaker @phylor or other maintainers, could you please consider merging this and create a 5.2.1 release?

even though I see no unit tests in this area, I see little risk in merging. And I also get this error.

seuros commented 2 years ago

Checkout the open pr. I will merge it today and release.

Let me know in the pr if there is any bug or addition.

I will copy these change there.

jesperronn commented 2 years ago

Thanks @seuros. Works for me. Now the file is saved locally for inspection in root folder. I reckon there is room for improvement but main purpose of current PR is to fix the exception

besi commented 2 years ago

@seuros: I did update all my capistrano related gems:

bundle update capistrano capistrano3-puma capistrano-rbenv capistrano-rails-console capistrano-rails

Then ran cap staging puma:systemd:generate_config_locally and got the error

 cap staging puma:systemd:generate_config_locally --trace
** Invoke staging (first_time)
** Execute staging
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rbenv:validate (first_time)
** Execute rbenv:validate
me@myserver.com's password:
** Invoke rbenv:map_bins (first_time)
** Execute rbenv:map_bins
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env 
** Invoke puma:systemd:generate_config_locally (first_time)
** Execute puma:systemd:generate_config_locally
cap aborted!
NoMethodError: undefined method `properties' for #<struct hostname="example.com">
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/capistrano3-puma-5.2.0/lib/capistrano/puma.rb:18:in `puma_user'
(erb):8:in `compiled_template_puma'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/2.7.0/erb.rb:905:in `eval'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/2.7.0/erb.rb:905:in `result'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/capistrano3-puma-5.2.0/lib/capistrano/puma.rb:47:in `compiled_template_puma'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/capistrano3-puma-5.2.0/lib/capistrano/tasks/systemd.rake:37:in `block (4 levels) in eval_rakefile'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/sshkit-1.21.3/lib/sshkit/backends/abstract.rb:31:in `instance_exec'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/sshkit-1.21.3/lib/sshkit/backends/abstract.rb:31:in `run'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/capistrano-3.17.1/lib/capistrano/dsl.rb:76:in `run_locally'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/capistrano3-puma-5.2.0/lib/capistrano/tasks/systemd.rake:36:in `block (3 levels) in eval_rakefile'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/airbrussh-1.4.1/lib/airbrussh/rake/context.rb:61:in `execute'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:83:in `block in run'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/rake-13.0.6/lib/rake/application.rb:80:in `run'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/capistrano-3.17.1/lib/capistrano/application.rb:14:in `run'
/usr/local/var/rbenv/versions/2.7.6/lib/ruby/gems/2.7.0/gems/capistrano-3.17.1/bin/cap:3:in `<top (required)>'
/usr/local/var/rbenv/versions/2.7.6/bin/cap:23:in `load'
/usr/local/var/rbenv/versions/2.7.6/bin/cap:23:in `<main>'
Tasks: TOP => puma:systemd:generate_config_locally

These are the versions I'm using:


 cat Gemfile.lock | grep capistrano | grep "("           
    capistrano (3.17.1)
    capistrano-bundler (2.1.0)
      capistrano (~> 3.1)
    capistrano-rails (1.6.2)
      capistrano (~> 3.1)
      capistrano-bundler (>= 1.1, < 3)
    capistrano-rails-console (2.3.0)
      capistrano (>= 3.5.0, < 4.0.0)
    capistrano-rbenv (2.2.0)
      capistrano (~> 3.1)
    capistrano3-puma (5.2.0)
      capistrano (~> 3.7)
seuros commented 1 year ago

Try master please . Check also the example app i created in the other repo

jesperronn commented 1 year ago

@seuros thanks for merging. However, it seemed you did further changes on master and I see no release of this bugfix (yet).

On master I see further commits to allow for Puma 6.0, which is great work. Thanks for that!

Do you mind to make a 5.2.1 release in order to fix the issue mentioned here with a release? (I think this would make it as easy as possible for users to update gradually without considering other (potentially breaking) changes)