ruby on rails - Foreman export upstart scripts as userjob on ubuntu 12.04 -


i trying export upstart scripts rails application using foreman don't want use sudo that. saw ubuntu 12.04 using supports userjob http://upstart.ubuntu.com/cookbook/#user-job have enabled that. enabled test script have placed @ ~/.init tried bundle exec foreman export upstart ~/.init -a myapp -l log -u myuser , exported foreman tasks ~/.init. when run start myapp works thin instances doesn't start , can't figure out why. maybe has using rvm user install. there way debug this? thanks.

you can set

console log

in upstart script, , output should shown in log-fie.

according recen upstart cookbook, session job output appear in $xdg_cache_home/upstart/<jobname>, (which should fall $home/.cache).

alternatively, can tell log elsewhere, --logdir option upstart command.

since question few months old, may aware using $home/.init "user" jobs deprecated in favour of $xdg_config_home/upstart (or $home/.config/upstart/). looks latest foreman doesn't give nice defaults that, though it's still possible.

as reason script won't start, things consider are

  • are running right user? setuid <user>
  • does user have access bundle in environment?

i'm not sure rvm, i've had success chruby. here's example (which logs):

 description "a rails application"  author "me (me@example.com)"  start on runlevel [2345]  stop on runlevel [016]   respawn   setuid appuser  setgid appuser   console output   chdir /var/www/app/current  exec chruby-exec 2.0 -- bundle exec unicorn_rails -e production -p 5000