[ZODB-Dev] zeo, data.fs permissions

Mark McEahern mark@mceahern.com
Wed, 4 Sep 2002 14:40:35 -0500


[Jeremy Hylton [mailto:jeremy@zope.com]]
> The spec probably did say to build everything in /var/zope.

Well, I still haven't got it working, but your message has helped me get the
logging straight.  I now have ZEO running and Zope running and I'm logging
events in two separate stupid log files (one for Zope, one for ZEO), but I'm
still not able to access Zope from the browser.  It still times out.  Zope
works just fine if I don't try to serve it from ClientStorage--that is, if I
remove the custom_zodb.py from INSTANCE_HOME.

The SRPM creates both:

  /usr/share/zope
  /var/zope

Both of these paths have a var/Data.fs in them.  That seems weird.  The
system startup script in /etc/init.d/zope calls /var/zope/zserver.sh (which
is just a symbolic link to zserver_wo_pcgi.sh).  I've attached this script
below.  Basically, it exports INSTANCE_HOME='/var/zope' and then runs
python2.1 z2.py.

Here's what /var/zope/custom_zodb.py looks like:

  # <goofy>
  # I found this commend in the ZEO installation source
ZEO/misc/custom_zodb.py:

  # This import isn't strictly necessary but is helpful when
  # debugging and while Zope's and Python's asyncore are out of sync
  # to make sure we get the right version of asyncore.

  import ZServer
  # </goofy>

  from ZEO.ClientStorage import ClientStorage
  zeo_server = '192.168.0.2'
  port = 8800
  Storage = ClientStorage((zeo_server, port), storage="main")

The import ZServer line was added as noted because of a comment in
$src/ZEO/misc/custom_zodb.py.  But whether that's there or not, the browser
still times out trying to access http://localhost:8080/manage

I also tried http://192.168.0.2:8080/manage (the IP address to the ethernet
card) and that doesn't work either--that is, it also times out.

I start ZEO using a shell script in /usr/share/zope/zeo_start:

#!/bin/sh
  reldir=`dirname $0`
  exec python2.1 $reldir/lib/python/ZEO/start.py \
    -S main=StorageConfig:main_storage -u zope -p 8800 -h 192.168.0.2 \
    ZEO_SERVER_PID=$reldir/var/ZEO_SERVER.pid \
    STUPID_LOG_FILE=$reldir/var/ZEO_EVENTS.log \
    "$@"

This uses StorageConfig.py located in the ZEO folder
(/usr/share/zope/lib/python/ZEO/StorageConfig.py):

  import ZODB.FileStorage
  main_storage = ZODB.FileStorage.FileStorage("/usr/share/zope/var/Data.fs")

> That's progress!   Did you use the same network for the client and the
> server?  You may have configured one to use the loopback interface and
> one to use the ethernet interface.

Yes, I believe so.  That is, zeo_start uses:

  start.py -p 8800 -h 192.168.0.2

and custom_zodb.py uses:

  from ZEO.ClientStorage import ClientStorage
  zeo_server = '192.168.0.2'
  port = 8800
  Storage = ClientStorage((zeo_server, port), storage="main")

Is it OK that port is an integer?  Also, I was wondering, why the ZEO log
has this:

  $ cat /usr/share/zope/var/ZEO_EVENTS.log
  ------
  <snip>
  ------
  2002-09-04T18:56:47 INFO(0) ZEO Server:4343 new connection
  ('192.168.0.2', 57534): <ManagedServerConnection ('192.168.0.2', 57534)>
  ------
  <snip>

That is, the address there is 57534 whereas the port is supposed to be 8800?

> If you want to use /usr/share/zope as your instance home, then yes.
> If you want to use /var/zope, then you should stop putting things in
> /usr/share/zope :-).  One way or another, you need to get all the
> scripts to agree on one location.

I think they all agree now.  I'm continuing to use the SRPM-->RPM approach
because when I install Python 2.1.3 and Zope 2.5.1 from source tarballs, the
ZEO unit tests hang on checkCommitLock2OnCommit:

  http://lists.zope.org/pipermail/zope/2002-September/122102.html

> ZEO and Zope use the same logging software, but that doesn't
> necessarily mean they share the same logs.  The logging is controlled
> by two environment variables -- STUPID_LOG_FILE and
> STUPID_LOG_SEVERITY.  Set the first one to a filename (or '' to mean
> stderr) and the logs from the process will get written to that file.
> It's possible to direct Zope and ZEO logs to different files using
> different values for STUPID_LOG_FILE.
>
> The STUPID_LOG_SEVERITY affects the amount of logging that get's
> done.  The default is 0, but you can set it to one of -100, -200, and
> -300 to get more verbose logging.  For ZEO, less than -100 is probably
> only useful to people who know the code inside out.

Thank you very much--I'm now able to log correctly.

// mark

<** zserver_wo_pcgi.sh **>

#!/bin/sh
export INSTANCE_HOME=/var/zope

# Now that we have fixed syslog.syslog_client to handle RH 6.1's changes, we
# can use syslogd for logging.  Logging to a remote server using syslogd can
# be done by using ZSYSLOG_SERVER instead if ZYSLOG.  If you do not define
# either of the ZSYSLOG* env vars, logging goes to the file specified by
# the -l <file> command argument instead.

# Note: For syslog logging to work from the ZServer/medusa subsystem, the
# ZSYSLOG variable must now contain the name of the socket to log to,
# usually /dev/log on Unix machines.  JM 19991104.

#export ZSYSLOG="/dev/log"
#export ZSYSLOG_SERVER="localhost:514"

#
# We disable the Medusa monitor port, for security reasons, since many
# people won't need it.
#
# -z /usr/share/zope    {specify directory of installed Zope software}
# -u zope               {run as user 'zope'}
# -Z zwatchdog.pid      {place to write ZServer's ZDaemon watchdog process
ID}
# -w 8080               {port on which to listen for HTTP requests}
# -f 8021               {port on which to listen for FTP requests}
# -m ''                 {port on which to listen for Medusa monitor
requests}
# -L 'locale'           {specify desired international locale}
# -l /var/log/zope      {specify logfile}
#

cd $INSTANCE_HOME
/usr/bin/env python2.1 z2.py                  \
    -u      zope                              \
    -z      /usr/share/zope                   \
    -Z      /var/run/zwatchdog.pid            \
    -w      8080                              \
    -f      8021                              \
    -m      ''                                \
    -l      /var/log/zope                     \
    STUPID_LOG_FILE=/var/zope/zope_stupid.log \
    FORCE_PRODUCT_LOAD=1                      \
    >>      /var/log/zope 2>&1                \
    &

-