about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-10-05 23:31:28 -0700
committerEric Wong <normalperson@yhbt.net>2009-10-05 23:31:28 -0700
commit89c786d64ddbe74905d37bc0d110771de5f79f49 (patch)
tree401832828e8752ea9f4bf7050695f4cf69ee0ef1
parent2f89282aee40308879bb4565f3370bd5de9c6214 (diff)
downloadunicorn-89c786d64ddbe74905d37bc0d110771de5f79f49.tar.gz
Modifying this can be useful for esoteric cases like switching
entire Ruby installations or if the app was originally started
in a no-longer-existent directory and we can't upgrade because
we can't chdir to it.
-rw-r--r--lib/unicorn.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb
index c5a0677..ddec8e9 100644
--- a/lib/unicorn.rb
+++ b/lib/unicorn.rb
@@ -53,6 +53,27 @@ module Unicorn
 
     # We populate this at startup so we can figure out how to reexecute
     # and upgrade the currently running instance of Unicorn
+    # This Hash is considered a stable interface and changing its contents
+    # will allow you to switch between different installations of Unicorn
+    # or even different installations of the same applications without
+    # downtime.  Keys of this constant Hash are described as follows:
+    #
+    # * 0 - the path to the unicorn/unicorn_rails executable
+    # * :argv - a deep copy of the ARGV array the executable originally saw
+    # * :cwd - the working directory of the application, this is where
+    # you originally started Unicorn.
+    #
+    # The following example may be used in your Unicorn config file to
+    # change your working directory during a config reload (HUP) without
+    # upgrading or restarting:
+    #
+    #   Dir.chdir(Unicorn::HttpServer::START_CTX[:cwd] = path)
+    #
+    # To change your unicorn executable to a different path without downtime,
+    # you can set the following in your Unicorn config file, HUP and then
+    # continue with the traditional USR2 + QUIT upgrade steps:
+    #
+    #   Unicorn::HttpServer::START_CTX[0] = "/home/bofh/1.9.2/bin/unicorn"
     START_CTX = {
       :argv => ARGV.map { |arg| arg.dup },
       # don't rely on Dir.pwd here since it's not symlink-aware, and