3

I have a stack running on ubuntu consisting of a Rack application written in Sinatra and GrapeAPI. The application stack includes Redis, Postgres, Nginx and unicorn. I want to use god to handle process monitoring.

Currently deployment's are made under a deploy user via git. This deployment user is not a sudoer. My question: Who should own the god process? Is it best to run that process as a sudoer or the deploy user?

Running as the deploy user will load rbenv allowing unicorn to start however the deploy user does not have sudo access so will not be able to run init.d scripts.

On the other hand when I am running as a different user the the deploy user then god does not have access to bundle exec provided by rbenv and there for can't start up the unicorn processes if they go down.

2

The god process should be controlled by upstart scripts thus running it as a sudo user. This is made possible by binstubs. A binstub is a shim to an exectuable installed by a gem. Binstubs are provided by bundler. They allow bin files to be run from any where on the system. It's nessory to add rbenv paths in your upstart scripts to do this.

export PATH=/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:$PATH
eval "$(rbenv init -)"
export BUNDLE_GEMFILE=$APPLICATION_ROOT/Gemfile

After this any direct call's to binstubs will load your bundle and execute correctly. With this pattern it's possible to use upstart to run unicorn and resque. This makes your entire stack executable with upstart and your god configuration a chinch because all you have to do is call your upstart scripts. HTH.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.