Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

Running resque as a different user #72

Closed
wvengen opened this issue Jan 14, 2014 · 2 comments
Closed

Running resque as a different user #72

wvengen opened this issue Jan 14, 2014 · 2 comments

Comments

@wvengen
Copy link

wvengen commented Jan 14, 2014

I'm deploying with one user, but would like to run resque as the user the app runs with. It'd be great of capistrano-resque would allow to specify a user to run as. This could be either by setting the ssh user option, or using sudo with a specific user.

A simple solution would be to give the option of prepending the command - a capistrano-resque user could add a sudo :as => there.

Would this be a useful feature?

@dmarkow
Copy link
Collaborator

dmarkow commented Jul 18, 2014

While it may be useful, this could be messy to implement; for example, many people may use the rbenv or rvm capistrano plugins as well as rails/bundler plugins. Capistrano logs in and can execute commands such as bundle exec ... but how would this work with something like su -u otheruser bundle exec if that other user account doesn't have rbenv or bundler installed, etc.

I'm closing this for now as I won't be able to get this personally implemented anytime soon, but if you want to take a stab at it and submit a pull request we can get it added.


On a somewhat related note (which I plan on adding to the README): This gem isn't the best approach to managing workers on a production system. What happens if the system reboots or the workers die unexpectedly? Using a system-level process manager (upstart, init.d, etc.) will handle this kind of stuff without having to manually deploy/start resque via capistrano. If you need to restart workers during a deploy, you can just add a super-simple task like sudo service resque restart. And if you need to set a custom user, this can be done in the init/upstart script.

@dmarkow dmarkow closed this as completed Jul 18, 2014
@wvengen
Copy link
Author

wvengen commented Aug 18, 2014

Thanks for your response, I guess you're right that there is no standard way in which this will just work.

The addition to the README would be useful in my view.

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

No branches or pull requests

2 participants