I cannot find any good example of a unicorn upstart task that works properly for the following: * Upstart will restart if unicorn dies * Can send USR2 signal to unicorn to do a no downtime deploys * Able to stop upstart job, even after a deploy I have tried the following: expect fork respawn setuid www-data chdir /var/www/app/current exec bundle exec unicorn_rails -E production -c /var/www/app/current/config/unicorn.rb I also tried using the following in various combinations: normal exit 0 QUIT USR2 post-stop exec kill `cat /var/www/app/current/tmp/pids/unicorn.pid` Can anyone help? Thanks Owen
Owen Davies <unicorn at obduk.com> wrote:> I cannot find any good example of a unicorn upstart task that works > properly for the following: > > * Upstart will restart if unicorn dies > * Can send USR2 signal to unicorn to do a no downtime deploysI don''t think you can combine the first two items. Sending QUIT to the original process (after USR2) will confuse Upstart (and similar process managers which rely on the wait/waitpid family of functions) into thinking unicorn died and needs to be restarted. If there''s an existing upstart task for nginx, it should be easy to convert for usage with unicorn. Anyways if you find or come up with a good upstart task, I''ll include it in the examples/ section (as long as it''s Freely redistributable)
On 8 Dec 2012, at 00:52, Owen Davies wrote:> I cannot find any good example of a unicorn upstart task that works > properly for the following: > > * Upstart will restart if unicorn dies > * Can send USR2 signal to unicorn to do a no downtime deploys > * Able to stop upstart job, even after a deployI take the view that the Unicorn master process is as reliable as a process manager and therefore there''s no need to manage Unicorn with a process manager. Some may regard that as cheating but it neatly sidesteps your problem :) I use a control script like the one in the examples/ directory of the Unicorn source to start/stop/restart Unicorn. Yours, Andrew Stewart
Is it then possible to have an upstart script that doesn''t do the restart? Just because upstart scripts are much cleaner than init scripts. Thanks, Owen On 8 December 2012 12:59, Andrew Stewart <boss at airbladesoftware.com> wrote:> > On 8 Dec 2012, at 00:52, Owen Davies wrote: >> I cannot find any good example of a unicorn upstart task that works >> properly for the following: >> >> * Upstart will restart if unicorn dies >> * Can send USR2 signal to unicorn to do a no downtime deploys >> * Able to stop upstart job, even after a deploy > > I take the view that the Unicorn master process is as reliable as a process manager and therefore there''s no need to manage Unicorn with a process manager. > > Some may regard that as cheating but it neatly sidesteps your problem :) > > I use a control script like the one in the examples/ directory of the Unicorn source to start/stop/restart Unicorn. > > Yours, > Andrew Stewart > > > _______________________________________________ > Unicorn mailing list - mongrel-unicorn at rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-unicorn > Do not quote signatures (like this one) or top post when replying