synchronous restart

Stephen Eley sfeley at gmail.com
Tue Aug 31 16:58:40 EDT 2010


On Tue, Aug 31, 2010 at 3:08 PM, Clifton King <cliftonk at gmail.com> wrote:
>
> http://pastie.org/1129610
>
> Most of that configuration file was from a github blog post about
> unicorn (you can try googling for it).

Cool.  In that spirit, here's the config file I use with Vlad the
Deployer in all of my Rails apps:
http://gist.github.com/559710

Four Unicorn-related tasks are included:

* start_unicorn: Calls the unicorn server with the path to the
appropriate config/unicorn.rb file
* reload_unicorn: Sends HUP for a graceful reload (and falls back to
start_unicorn if any status errors come back)
* kick_unicorn: Sends USR2 for synchronous restart.  If successful,
sends WINCH to the old process and then QUIT after one minute (to give
time for testing and fallback if necessary).
* rescue_unicorn: Recovers from a failed kick_unicorn if necessary.
Does a HUP to revive the old master and QUITs the new one.

I've been meaning to bundle this into a Vlad plugin gem, but haven't
gotten around to it yet.  In the meantime, here it is in case anyone
would find it useful.  (I also have Git automation in there that reads
the branch name for the environment.  I.e., I have branches for
'staging', 'production', etc. -- and named users and server subdomains
for them, too.)

-- 
Have Fun,
   Steve Eley (sfeley at gmail.com)
   ESCAPE POD - The Science Fiction Podcast Magazine
   http://www.escapepod.org


More information about the mongrel-unicorn mailing list