unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* unicorn upstart script
@ 2013-08-09 22:02 Josh Sharpe
  2013-08-10  6:20 ` Hleb Valoshka
  2013-08-10  6:21 ` Eric Wong
  0 siblings, 2 replies; 4+ messages in thread
From: Josh Sharpe @ 2013-08-09 22:02 UTC (permalink / raw)
  To: mongrel-unicorn

I haven't seen my mailing list request confirmed.  Please CC me your
responses - thanks!

Does anyone have a working upstart init script for unicorn?  I've been
trying to write my own, but this is non trivial since USR2 ultimately
changes the PPID of the running unicorn instance.

I'm thinking a a wrapper script maybe required that stays running even
in the event of USR2 to being sent to unicorn, and only dies if the
process identified in the PID file is missing.

Thanks!
Josh
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: unicorn upstart script
  2013-08-09 22:02 unicorn upstart script Josh Sharpe
@ 2013-08-10  6:20 ` Hleb Valoshka
  2013-08-11 19:38   ` Josh Sharpe
  2013-08-10  6:21 ` Eric Wong
  1 sibling, 1 reply; 4+ messages in thread
From: Hleb Valoshka @ 2013-08-10  6:20 UTC (permalink / raw)
  To: unicorn list

On 8/10/13, Josh Sharpe <josh.m.sharpe@gmail.com> wrote:
> I'm thinking a a wrapper script maybe required that stays running even
> in the event of USR2 to being sent to unicorn, and only dies if the
> process identified in the PID file is missing.

https://rubyforge.org/pipermail/mongrel-unicorn/2013-July/001820.html
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: unicorn upstart script
  2013-08-09 22:02 unicorn upstart script Josh Sharpe
  2013-08-10  6:20 ` Hleb Valoshka
@ 2013-08-10  6:21 ` Eric Wong
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Wong @ 2013-08-10  6:21 UTC (permalink / raw)
  To: unicorn list; +Cc: Josh Sharpe

Josh Sharpe <josh.m.sharpe@gmail.com> wrote:
> I haven't seen my mailing list request confirmed.  Please CC me your
> responses - thanks!

Done!  (I think the confirmation should've gone through, Rubyforge has
been acting funny...).  Anyways it's common practice on many FOSS
mailing lists to Cc: all parties (but not Ruby-related lists,
unfortunately...)[1]

> Does anyone have a working upstart init script for unicorn?  I've been
> trying to write my own, but this is non trivial since USR2 ultimately
> changes the PPID of the running unicorn instance.

There's been some talk of it if you search the mailing list archives for
links.  I get all the modern init replacements mixed up with each other
:x

> I'm thinking a a wrapper script maybe required that stays running even
> in the event of USR2 to being sent to unicorn, and only dies if the
> process identified in the PID file is missing.

I posted this the other day but haven't gotten much feedback on it:
http://mid.gmane.org/20130724031151.GA14534@dcvr.yhbt.net



[1] Fwiw, I prefer Cc: to all anyways.  It's easier to rope in folks for
    issues that aren't isolated to the project at hand.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: unicorn upstart script
  2013-08-10  6:20 ` Hleb Valoshka
@ 2013-08-11 19:38   ` Josh Sharpe
  0 siblings, 0 replies; 4+ messages in thread
From: Josh Sharpe @ 2013-08-11 19:38 UTC (permalink / raw)
  To: unicorn list

I like the unicorn_forever idea, but as it's lightly tested, I
continued down the path of trying to hack upstart into compliance and
came up with this...  Might as well share.

This works nicely when USR2 is received, and restarts the master if
for whatever reason it dies.

Cheers!

$ cat /etc/init/unicorn.conf
description "Unicorn configuration"

start on filesystem
stop on shutdown

respawn

kill signal QUIT

script
  start-stop-daemon --start --chuid blue --chdir
/u/apps/blue-test-app/current --exec /usr/bin/bundle exec
unicorn_rails -- -c /u/apps/blue-test-app/shared/system/unicorn.cfg -E
production

  exists=0
  pidfile=/tmp/unicorn.master.pid
  oldpidfile=/tmp/unicorn.master.pid.oldbin

  while [ $exists -eq 0 ]
  do
    sleep 0.1

    (test -f $pidfile && pgrep -P $(cat $pidfile)) || (test -f
$oldpidfile && pgrep -P $(cat $oldpidfile))
    exists=$?
  done

  exec rm /tmp/unicorn.master.pid
  exec rm /tmp/unicorn.master.pid.oldbin

  exit 1
end script

On Sat, Aug 10, 2013 at 2:20 AM, Hleb Valoshka <375gnu@gmail.com> wrote:
> On 8/10/13, Josh Sharpe <josh.m.sharpe@gmail.com> wrote:
>> I'm thinking a a wrapper script maybe required that stays running even
>> in the event of USR2 to being sent to unicorn, and only dies if the
>> process identified in the PID file is missing.
>
> https://rubyforge.org/pipermail/mongrel-unicorn/2013-July/001820.html
> _______________________________________________
> Unicorn mailing list - mongrel-unicorn@rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-11 20:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-09 22:02 unicorn upstart script Josh Sharpe
2013-08-10  6:20 ` Hleb Valoshka
2013-08-11 19:38   ` Josh Sharpe
2013-08-10  6:21 ` Eric Wong

Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).