seuros / capistrano-puma

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

Pum5.x : Multi Apps on same server #305

Closed jules-w2 closed 3 years ago

jules-w2 commented 3 years ago

Hey guys,

I have multiple rails apps on the same server. (everything worked fine with puma 4.x and capistrano-puma4.x)

Now with Puma 5.x, I try to set set :puma_service_unitname, "puma#{fetch(:application)}_#{fetch(:stage)}" otherwise the puma.service file of app A overwrites the file of app B when I launch cap production puma:systemd:config.

But i have this error 1: from /Users/jules/.rvm/gems/ruby-2.6.6@wgroupe_production/gems/capistrano3-puma-5.0.1/lib/capistrano/puma.rb:47:in template_puma' /Users/jules/.rvm/gems/ruby-2.6.6@wgroupe_production/gems/capistrano3-puma-5.0.1/lib/capistrano/puma.rb:47:inread': no implicit conversion of nil into String (TypeError)

Screen Shot 2020-12-02 at 11 26 01 AM

Have you an idea ? Thanks,

Eric-Guo commented 3 years ago

I also meet this problem, you can unset :puma_service_unit_name first and do the cap production puma:system:config, and then rename the file in the server manually.

After do that deploy at least works.

bendilley commented 3 years ago

This is to do with the lookup in the template_puma method which assumes there's a template somewhere with the name

"#{fetch(:puma_service_unit_name)}.service"

One workaround is to define your project's own template at lib/capistrano/templates/puma.service.erb using a copy of this gem's template (fine, you might want to customise it anyway) and then symlink it for each service name you need (not fine; tedious, in fact, if you have many staging environments). That is a hack when there could just be a separate variable for :puma_service_template_name

jules-w2 commented 3 years ago

thanks @bendilley, i will try it

bendilley commented 3 years ago

When I looked at other usage of the template_puma method, the from argument being passed-in is always a static value, so I've opened #308 to assume that the template name is always 'puma.service', as I think that would have been the intention.