-
Notifications
You must be signed in to change notification settings - Fork 87
Manage with upstart
Here's a sample config for upstart to manage eye running as a specific user (deploy in my case):
description 'Eye'
start on (local-filesystems and runlevel [2345])
stop on runlevel [016]
setuid deploy
expect fork
script
# Eye runs from $HOME, upstart with setuid wont set $HOME
export HOME=/home/deploy
exec eye load /path/to/config.eye
end script
respawn
If you use a user other than deploy, just change the setuid line to match your user's name as well as the export HOME line.
If your processes depend on rbenv for using the right version of Ruby, you'll need to add the rbenv shims directory to the path.
Before the exec line within the script block, add the following, updating your path to rbenv if it's installed elsewhere:
script
...
export PATH=/usr/local/rbenv/shims:$PATH
...
exec ...
end script
If you use environment variables to hold things like API keys that will be needed by your processes, you'll need to either define them in the upstart config (see export) or the eye config.
If you define them in /etc/environment, you can source that file in your script block, then export the variables so they are available to your processes.
script
...
. /etc/environment
export RAILS_ENV
export SOME_API_KEY
...
exec ...
end script
Note: If /etc/environment defines PATH and you're modifying the path in you script block, make sure to do your modifications after you source /etc/environment, otherwise the PATH defined in /etc/environment will overwrite your modifications.