Login | Register
My pages Projects Community openCollabNet

Discussions > users > Avoiding downtime while updating the Current database

Project highlights: Stable Version: 1.6.1, Development Version: 1.7.6

current
Discussion topic

Hide all messages in topic

All messages in topic

Re: Avoiding downtime while updating the Current database

Reply

Author hunterm
Full name Hunter Matthews
Date 2003-03-26 14:51:43 PST
Message I just wanted to let everyone know - I DID look at the code in 1.4.3,
and decided its just not practical (or sane, really) to provide for this
request in 1.4.3.

Since my httpd server here is now ALSO doing things other than current,
I too feel the pain.

The answer is 1.5.x. Sorry.


On Wed, 2003-03-05 at 14:56, Jeremy Portzer wrote:
> Of course my approach is somewhat flawed in that if a client is
> downloading updates when this script runs, it will crash when Current
> suddenly goes away. Oh well, it's a start.
>
> --Jeremy
>
> On Wed, 2003-03-05 at 14:52, Jeremy Portzer wrote:
> > One of the problems with the 1.4 series of current is that you must
> > shutdown your web server while running "cadmin update" or other cadmin
> > commands. Although I realize this may be changing in the upcoming
> > postgres backend, for now it can be quite a pain if you use your current
> > server's Apache for something else.
> >
> > Here's a strategy for working around this problem.
> > * make a version of current.httpd.conf that disables the XMLRPC URL
> > * replace current.httpd.conf with this "disabled version" and then
> > restart Apache
> > * run the necessary cadmin commands (i.e. "cadmin update")
> > * replace current.httpd.conf with the original
> > * restart Apache, which turns current back on
> >
> > Since it only takes a moment to restart apache (send a HUP to its parent
> > PID), this minimizes downtime to your other web services while safely
> > updating the current databases.
> >
> > I've attached a script that does this, suitable for running in cron
> > after your mirror downloads the latest updates. It has a lot more
> > verbosity than is really necessary, but it should work. For this
> > script, copy your existing current.httpd.conf to
> > current.httpd.conf.enabled. Then make a current.httpd.conf.disabled
> > version. My current.httpd.conf.disabled looks like this:
> > <Location /XMLRPC >
> > Deny from all
> > </Location>
> > This makes every request return a 403 Forbidden. Does anyone know a way
> > to change this to something more appropriate like 503 Service
> > Unavailable?
> >
> > I hope this is useful!
> >
> > Regards,
> > Jeremy Portzer
> > jeremyp at pobox dot com
> > ----
> >
>
> > #!/bin/sh
> >
> > # This is a script to update the "current" database while keeping apache
> > # mostly running.
> > # Before using this, make sure you have a file current.httpd.conf.disabled
> > # and that you've copied current.httpd.conf to current.httpd.conf.enabled
> >
> > # Suggested contents for current.conf.disabled :
> > # <Location /XMLRPC >
> > # Deny from all
> > # </Location>
> >
> > # Author: Jeremy Portzer <jeremyp at pobox dot com>
> > # Released under the same license as Current itself;
> > # see http://current.tigris.org/
> >
> > # Modify these configuration values as appropriate:
> >
> > CONFDIR=/etc/httpd/conf
> > CONFFILE=current.httpd.conf
> >
> > # Command to run to update current:
> > CURRENT="cadmin update"
> >
> > # Subroutine to use to restart apache; you may wish to alter this
> > reloadapache()
> > {
> > kill -HUP `/bin/cat /var/run/httpd.pid`
> > return $?
> > }
> >
> >
> > PROGNAME=`basename $0`
> > CURRCONF=$CONFDIR/$CONFFILE
> >
> > #Check sanity
> >
> > if [ ! -f ${CURRCONF}.enabled ]
> > then
> > echo "$PROGNAME: Cannot find ${CURRCONF}.enabled" >&2
> > exit 1
> > fi
> >
> > if [ ! -f ${CURRCONF}.disabled ]
> > then
> > echo "$PROGNAME: Cannot find ${CURRCONF}.disabled" >&2
> > exit 1
> > fi
> >
> > # make backup of current.conf for extra safety
> > /bin/cp -f $CURRCONF ${CURRCONF}~ || exit 1
> >
> > #copy disabled configuration to "live" version
> > /bin/cp -f ${CURRCONF}.disabled $CURRCONF || exit 1
> >
> > #restart apache with new configuration, if that works rebuild current
> > if reloadapache
> > then
> > $CURRENT
> > if [ $? != 0 ]
> > then
> > echo "$PROGNAME: failure running $CURRENT" >&2
> > #exit here on purpose leaving current disabled, since something failed in updating it.
> > exit 1
> > fi
> >
> > else
> > echo "$PROGNAME: first reload of apache failed" >&2
> > exit 1
> > fi
> >
> > #copy enabled configuration to "live" version
> > /bin/cp -f ${CURRCONF}.enabled $CURRCONF || exit 1
> >
> > #restart apache again; we're done
> >
> > if reloadapache
> > then
> > exit 0
> > else
> > echo "$PROGNAME: second reload of apache failed" >&2
> > exit 1
> > fi
> >
> > ----
> >
>
> > --------------------​--------------------​--------------------​---------
> > To unsubscribe, e-mail: users-unsubscribe@cu​rrent.tigris.org
> > For additional commands, e-mail: users-help at current dot tigris dot org
>
>
>
> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: users-unsubscribe@cu​rrent.tigris.org
> For additional commands, e-mail: users-help at current dot tigris dot org
--
Hunter Matthews Unix / Network Administrator
Office: BioScience 145/244 Duke Univ. Biology Department
Key: F0F88438 / FFB5 34C0 B350 99A4 BB02 9779 A5DB 8B09 F0F8 8438
Never take candy from strangers. Especially on the internet.


--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@cu​rrent.tigris.org
For additional commands, e-mail: users-help at current dot tigris dot org

Re: Avoiding downtime while updating the Current database

Reply

Author jpportz
Full name Jeremy Portzer
Date 2003-03-05 11:56:09 PST
Message Of course my approach is somewhat flawed in that if a client is
downloading updates when this script runs, it will crash when Current
suddenly goes away. Oh well, it's a start.

--Jeremy

On Wed, 2003-03-05 at 14:52, Jeremy Portzer wrote:
> One of the problems with the 1.4 series of current is that you must
> shutdown your web server while running "cadmin update" or other cadmin
> commands. Although I realize this may be changing in the upcoming
> postgres backend, for now it can be quite a pain if you use your current
> server's Apache for something else.
>
> Here's a strategy for working around this problem.
> * make a version of current.httpd.conf that disables the XMLRPC URL
> * replace current.httpd.conf with this "disabled version" and then
> restart Apache
> * run the necessary cadmin commands (i.e. "cadmin update")
> * replace current.httpd.conf with the original
> * restart Apache, which turns current back on
>
> Since it only takes a moment to restart apache (send a HUP to its parent
> PID), this minimizes downtime to your other web services while safely
> updating the current databases.
>
> I've attached a script that does this, suitable for running in cron
> after your mirror downloads the latest updates. It has a lot more
> verbosity than is really necessary, but it should work. For this
> script, copy your existing current.httpd.conf to
> current.httpd.conf.enabled. Then make a current.httpd.conf.disabled
> version. My current.httpd.conf.disabled looks like this:
> <Location /XMLRPC >
> Deny from all
> </Location>
> This makes every request return a 403 Forbidden. Does anyone know a way
> to change this to something more appropriate like 503 Service
> Unavailable?
>
> I hope this is useful!
>
> Regards,
> Jeremy Portzer
> jeremyp at pobox dot com
> ----
>

> #!/bin/sh
>
> # This is a script to update the "current" database while keeping apache
> # mostly running.
> # Before using this, make sure you have a file current.httpd.conf.disabled
> # and that you've copied current.httpd.conf to current.httpd.conf.enabled
>
> # Suggested contents for current.conf.disabled :
> # <Location /XMLRPC >
> # Deny from all
> # </Location>
>
> # Author: Jeremy Portzer <jeremyp at pobox dot com>
> # Released under the same license as Current itself;
> # see http://current.tigris.org/
>
> # Modify these configuration values as appropriate:
>
> CONFDIR=/etc/httpd/conf
> CONFFILE=current.httpd.conf
>
> # Command to run to update current:
> CURRENT="cadmin update"
>
> # Subroutine to use to restart apache; you may wish to alter this
> reloadapache()
> {
> kill -HUP `/bin/cat /var/run/httpd.pid`
> return $?
> }
>
>
> PROGNAME=`basename $0`
> CURRCONF=$CONFDIR/$CONFFILE
>
> #Check sanity
>
> if [ ! -f ${CURRCONF}.enabled ]
> then
> echo "$PROGNAME: Cannot find ${CURRCONF}.enabled" >&2
> exit 1
> fi
>
> if [ ! -f ${CURRCONF}.disabled ]
> then
> echo "$PROGNAME: Cannot find ${CURRCONF}.disabled" >&2
> exit 1
> fi
>
> # make backup of current.conf for extra safety
> /bin/cp -f $CURRCONF ${CURRCONF}~ || exit 1
>
> #copy disabled configuration to "live" version
> /bin/cp -f ${CURRCONF}.disabled $CURRCONF || exit 1
>
> #restart apache with new configuration, if that works rebuild current
> if reloadapache
> then
> $CURRENT
> if [ $? != 0 ]
> then
> echo "$PROGNAME: failure running $CURRENT" >&2
> #exit here on purpose leaving current disabled, since something failed in updating it.
> exit 1
> fi
>
> else
> echo "$PROGNAME: first reload of apache failed" >&2
> exit 1
> fi
>
> #copy enabled configuration to "live" version
> /bin/cp -f ${CURRCONF}.enabled $CURRCONF || exit 1
>
> #restart apache again; we're done
>
> if reloadapache
> then
> exit 0
> else
> echo "$PROGNAME: second reload of apache failed" >&2
> exit 1
> fi
>
> ----
>

> --------------------​--------------------​--------------------​---------
> To unsubscribe, e-mail: users-unsubscribe@cu​rrent.tigris.org
> For additional commands, e-mail: users-help at current dot tigris dot org



--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: users-unsubscribe@cu​rrent.tigris.org
For additional commands, e-mail: users-help at current dot tigris dot org

Avoiding downtime while updating the Current database

Reply

Author jpportz
Full name Jeremy Portzer
Date 2003-03-05 11:52:32 PST
Message One of the problems with the 1.4 series of current is that you must
shutdown your web server while running "cadmin update" or other cadmin
commands. Although I realize this may be changing in the upcoming
postgres backend, for now it can be quite a pain if you use your current
server's Apache for something else.

Here's a strategy for working around this problem.
    * make a version of current.httpd.conf that disables the XMLRPC URL
    * replace current.httpd.conf with this "disabled version" and then
restart Apache
    * run the necessary cadmin commands (i.e. "cadmin update")
    * replace current.httpd.conf with the original
    * restart Apache, which turns current back on

Since it only takes a moment to restart apache (send a HUP to its parent
PID), this minimizes downtime to your other web services while safely
updating the current databases.

I've attached a script that does this, suitable for running in cron
after your mirror downloads the latest updates. It has a lot more
verbosity than is really necessary, but it should work. For this
script, copy your existing current.httpd.conf to
current.httpd.conf.enabled. Then make a current.httpd.conf.disabled
version. My current.httpd.conf.disabled looks like this:
    <Location /XMLRPC >
    Deny from all
    </Location>
This makes every request return a 403 Forbidden. Does anyone know a way
to change this to something more appropriate like 503 Service
Unavailable?

I hope this is useful!

Regards,
Jeremy Portzer
jeremyp at pobox dot com
Attachments
Messages per page: