Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puma commands on remote server fail to use rbenv version of bundler #206

Closed
guillehorno opened this issue Mar 22, 2017 · 5 comments
Closed

Comments

@guillehorno
Copy link

guillehorno commented Mar 22, 2017

Hi,

In previous versions (using also capistrano-rbenv), any command related to puma had the correct path and env vars set, this is the puma:restart command that executes on the server using capistrano-puma 1.2.1

RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.4.0 $HOME/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/emeral/applications/emeral/shared/tmp/pids/puma.state restart 

With the new version (I tried with 3.0.2), the command was:

bundle exec pumactl -S /home/emeral/applications/emeral/shared/tmp/pids/puma.state -F /home/emeral/applications/emeral/shared/puma.rb restart

Bundler is not installed globally and it should be run like it was in version 1.2.1 (with the RBENV_ROOT=$HOME/.rbenv RBENV_VERSION=2.4.0 $HOME/.rbenv/bin/rbenv execbefore the bundle exec), this is probably similar to #188, and #149

Thanks!

@seuros
Copy link
Owner

seuros commented Mar 22, 2017

I never installed bundler globally and this error is not showing up.
I need a way to replicate this .

@guillehorno
Copy link
Author

guillehorno commented Mar 22, 2017

Ok, let me dig deeper and see how can I help you replicate it. Thanks!

@guillehorno
Copy link
Author

I managed to fix the issue by adding 'puma' and 'pumactl' myself to deploy.rb, where :rbenv_map_bins is set (in theory) initially, like this

set :rbenv_map_bins, %w{rake gem bundle ruby rails puma pumactl}

The problem seems to be that the set_defaults method inside the Puma class gets called before the variables in deploy.rb are set, and therefore, they are being overwritten.

Before, in 1.2.1, those variables were set in the rake task itself, and I assume they were executed after the initial setup of the vars.

I'm not sure if this order issue is something that only affects me (and probable the others with similar issues) or its the nature of Capistrano itself and how it handle plugins.

It works now but probably all the other varibles set in set_default are being overwritten too and thats not the intended effect. Let me know if I can help you with something else to try.

Thanks!

@seuros
Copy link
Owner

seuros commented Mar 22, 2017

Oh, you should not set that variable. Use append : https://github.com/seuros/capistrano-puma/blob/master/lib/capistrano/puma.rb#L79

This will avoid to conflict with other plugins.

@guillehorno
Copy link
Author

Ok. I checked the capistrano/rbenv repo and they still instruct people to do it with set on the deploy.rb: https://github.com/capistrano/rbenv#usage

Looks like they have an old open pull request that tries to fix this, but it doesn't seem like they want to merge it: capistrano/rbenv#58

This also affects other plugins: seuros/capistrano-sidekiq#124

Maybe it could help if you add this advise on the Readme, at least until rbenv fixes the problem.

Thanks for the help 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants