Package: nginx
Version: 0.4.12-5
Severity: wishlist

Niginx has the ability to update it's binary to a new version "on the
fly", without breaking existing connections, rather starting new binary
and accepting new connection on new workers, while old one gracefully
exiting. 

In practice it looks like:
after installing new binary you need to send -USR2 to main nginx
process.
nginx renames it's PID to .oldbin (for ex. /var/run/nginx.pid.oldbin)
and then starting new master process with pid in usual place.
so at this moment only new workers are accepting connections and 
it's time to send -QUIT (or -WINCH if we need ability to rollback) to old 
master process.
After all old worker gracefully finish, old master process exits too.

example of prerm: 

set -e
case "$1" in
    remove|remove-in-favour|deconfigure|deconfigure-in-favour)
        invoke-rc.d nginx stop
        ;;
    upgrade|failed-upgrade)
        ;;
esac

exit 0

example of postinst:

set -e
case "$1" in
    configure)
            ;;
    abort-upgrade|abort-remove|abort-deconfigure)
            ;;
    *)
        echo "postinst called with unknown argument     \`$1'" >&2
                exit 1
            ;;
esac

if [ -x "/etc/init.d/nginx" ]; then
        update-rc.d nginx defaults >/dev/null
        if [ -f /var/run/nginx.pid ]; then
                kill -USR2 `cat /var/run/nginx.pid`
                while [ ! -f /var/run/nginx.pid.oldbin ]
                do
                        cnt=`expr $cnt + 1`
                        if [ $cnt -gt 10 ]
                        then
                                echo "Nginx 'soft' update failed, doing 
restart";
                                kill -9 `cat /var/run/nginx.pid`
                                invoke-rc.d nginx start
                                exit 0
                        fi
                        sleep 1
                done
                kill -QUIT `cat /var/run/nginx.pid.oldbin`
        else
                invoke-rc.d nginx start
        fi
fi

                                                                




-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (1000, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.17-2-686
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.koi8r (charmap=KOI8-R) (ignored: 
LC_ALL set to ru_RU.koi8r)

Versions of packages nginx depends on:
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries
ii  libpcre3                     6.7-1       Perl 5 Compatible Regular Expressi
ii  zlib1g                       1:1.2.3-13  compression library - runtime

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to