We run unicorn in SMF using bundler. I would highly recommend learning to configure SMF.
I'd recommend reading the smf and smf_method https://www.illumos.org/man/5/smf_method man pages. If you use Chef, I have a provider cookbook for configuring services: https://github.com/livinginthepast/smf This is pretty close to the configuration we use: https://github.com/livinginthepast/smf/wiki/Unicorn Note that you probably want to ignore signals, set local environment variables and be careful about your PATH. On Wed, Feb 18, 2015 at 8:25 AM, Robert Mustacchi via smartos-discuss < [email protected]> wrote: > Hi Matt, > > On 2/18/15 2:36 , Matthew Law via smartos-discuss wrote: > > I hope this is not O/T... > > These kinds of questions are definitely not off topic. > > > We have a zone which runs a small Ruby web app. This is fronted by > > nginx and runs the unicorn app server and Resque message queue. The app > > can be started by running "bundle exec unicorn -c > > /home/appuser/current/config/unicorn.rb -E production -D" and the queue > > workers with: "bundle exec rake resque:work" (both of these are commands > > are issued as the appuser user from the /home/appuser/current dir, and > > so inherit their path etc). > > > > This all works fine when run manually either logged into the zone as the > > app user or remotely over ssh with something like capistrano. I would > > like to create an SMF manifest to do the same if the zone is restarted > > but I am not sure how to go about doing that because of the PATH > > requirements and the bundler abstraction. > > I'm not that familiar with bundler, but it seems like it probably is > going to fork and exec your application, right? > > In this case, you can specify both the path, home directory, and user to > run the SMF service as. While While you can write the raw xml yourself, > most folks find it a bit easier to use tools smfgen > (https://github.com/davepacheco/smfgen/) or manifold (in pkgsrc) to > automate the process of writing the XML file. > > > On the equivalent Linux environment we would normally use something like > > monit to do this but I couldn't find monit in the packages on SmartOS. I > > tried compiling it from source but it won't run and I suspect SMF is the > > best solution in SmartOS? Any help would be appreciated. > > SMF is the best solution on SmartOS, thought it's far from perfect. > Importantly it uses the OS native facilities (contracts > http://illumos.org/man/4/contract) to track all groups of processes, no > matter how many children exist or if they try to daemonize or not. > > Hopefully this helps, let us know if you have additional issues. > > Robert > > > ------------------------------------------- > smartos-discuss > Archives: https://www.listbox.com/member/archive/184463/=now > RSS Feed: > https://www.listbox.com/member/archive/rss/184463/24423351-9edae294 > Modify Your Subscription: > https://www.listbox.com/member/?& > Powered by Listbox: http://www.listbox.com > -- ---- e s ------------------------------------------- smartos-discuss Archives: https://www.listbox.com/member/archive/184463/=now RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00 Modify Your Subscription: https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb Powered by Listbox: http://www.listbox.com
