[Repoze-checkins] r678 - in repoze.zope2/trunk: . repoze/zope2 repoze/zope2/etc

Chris McDonough chrism at agendaless.com
Thu Feb 7 05:37:36 UTC 2008


Author: Chris McDonough <chrism at agendaless.com>
Date: Thu Feb  7 00:37:36 2008
New Revision: 678

Log:
  - mkzope2instance now:

    o creates a "log" directory

    o writes out a zeo.conf into "etc"

  - Add a sample <zodb_db main> section to the generated zope.conf
    that can be uncommented if using ZEO is desirable.




Added:
   repoze.zope2/trunk/repoze/zope2/etc/sample-zeo.conf
Modified:
   repoze.zope2/trunk/CHANGES.txt
   repoze.zope2/trunk/README.txt
   repoze.zope2/trunk/repoze/zope2/etc/sample-zope.conf
   repoze.zope2/trunk/repoze/zope2/instance.py

Modified: repoze.zope2/trunk/CHANGES.txt
==============================================================================
--- repoze.zope2/trunk/CHANGES.txt	(original)
+++ repoze.zope2/trunk/CHANGES.txt	Thu Feb  7 00:37:36 2008
@@ -1,3 +1,14 @@
+Next release
+
+  - mkzope2instance now:
+
+    o creates a "log" directory
+
+    o writes out a zeo.conf into "etc"
+
+  - Add a sample <zodb_db main> section to the generated zope.conf
+    that can be uncommented if using ZEO is desirable.
+    
 0.3.0
 
   - Install a mkzope2instance script as a console script to support

Modified: repoze.zope2/trunk/README.txt
==============================================================================
--- repoze.zope2/trunk/README.txt	(original)
+++ repoze.zope2/trunk/README.txt	Thu Feb  7 00:37:36 2008
@@ -160,7 +160,12 @@
   It's suggested that you serve up repoze.zope2 with mod_wsgi in
   "daemon mode" where each if the mod_wsgi's daemon children runs a
   single-threaded Zope process.  All of the Zope processes should
-  communicate with a single ZEO server on the back end.
+  communicate with a single ZEO server on the back end.  You can run a
+  ZEO server by invoking "bin/zeoctl start -C etc/zeo.conf" from
+  within a Repoze sandbox.  You'll need to change etc/zope.conf,
+  uncommenting the <zodb_db> section that refers to a client storage
+  at that point for Zope to work.
+
 
 
   

Added: repoze.zope2/trunk/repoze/zope2/etc/sample-zeo.conf
==============================================================================
--- (empty file)
+++ repoze.zope2/trunk/repoze/zope2/etc/sample-zeo.conf	Thu Feb  7 00:37:36 2008
@@ -0,0 +1,40 @@
+# Repoze ZEO configuration file
+
+%define INSTANCE ${sandbox}
+
+<zeo>
+  address 8100
+  read-only false
+  invalidation-queue-size 100
+  pid-filename $INSTANCE/var/ZEO.pid
+  # monitor-address PORT
+  # transaction-timeout SECONDS
+</zeo>
+
+<filestorage 1>
+  path $INSTANCE/var/Data.fs
+</filestorage>
+
+<eventlog>
+  level info
+  <logfile>
+    path $INSTANCE/log/zeo.log
+  </logfile>
+</eventlog>
+
+<runner>
+  program $INSTANCE/bin/runzeo
+  socket-name $INSTANCE/var/zeo.zdsock
+  daemon true
+  forever false
+  backoff-limit 10
+  exit-codes 0, 2
+  directory $INSTANCE
+  default-to-interactive true
+  # user zope
+  python ${python}
+  zdrun ${zdaemon_pkgdir}/zdrun.py
+  # This logfile should match the one in the zeo.conf file.
+  # It is used by zdctl's logtail command, zdrun/zdctl doesn't write it.
+  logfile $INSTANCE/log/zeo.log
+</runner>

Modified: repoze.zope2/trunk/repoze/zope2/etc/sample-zope.conf
==============================================================================
--- repoze.zope2/trunk/repoze/zope2/etc/sample-zope.conf	(original)
+++ repoze.zope2/trunk/repoze/zope2/etc/sample-zope.conf	Thu Feb  7 00:37:36 2008
@@ -47,3 +47,16 @@
     </filestorage>
 </zodb_db>
 
+# Uncomment this to use a ZEO server as the main storage.
+#
+# <zodb_db main>
+#     mount-point /
+#     cache-size 10000
+#     <zeoclient>
+#       server localhost:8100
+#       storage 1
+#       cache-size 100MB
+#       name zeostorage
+#       var $INSTANCE/var
+#     </zeoclient>
+# </zodb_db>

Modified: repoze.zope2/trunk/repoze/zope2/instance.py
==============================================================================
--- repoze.zope2/trunk/repoze/zope2/instance.py	(original)
+++ repoze.zope2/trunk/repoze/zope2/instance.py	Thu Feb  7 00:37:36 2008
@@ -18,19 +18,30 @@
     if sandbox is None:
         sandbox = sys.prefix
         
-    for dir in ('bin', 'etc', 'var', 'Products', 'import'):
+    for dir in ('bin', 'etc', 'var', 'Products', 'import', 'log'):
         path = os.path.join(sandbox, dir)
         if not os.path.exists(path):
             os.makedirs(path)
 
+    try:
+        # this is (stupidly) required by the zdrun key in the <runner>
+        # section of zeo.conf
+        import zdaemon
+        zdaemon_pkgdir = zdaemon.__path__[0]
+    except ImportError:
+        zdaemon_pkgdir = '{unknown}'
+        
     for source, target in (
         ('sample-zope2.ini', 'zope2.ini'),
         ('sample-site.zcml', 'site.zcml'),
         ('sample-zope.conf', 'zope.conf'),
         ('sample-apache2.conf', 'apache2.conf'),
+        ('sample-zeo.conf', 'zeo.conf'),
         ):
         template = open(os.path.join(here, 'etc', source), 'r').read()
-        result = rewrite(template, sandbox=sandbox)
+        result = rewrite(template, sandbox=sandbox,
+                         zdaemon_pkgdir=zdaemon_pkgdir,
+                         python=sys.executable)
         targetfile = os.path.join(sandbox, 'etc', target)
         if not os.path.exists(targetfile):
             open(targetfile, 'w').write(result)
@@ -51,7 +62,7 @@
     if len(args) != 2:
         parser.print_help(sys.stderr)
         sys.exit(1)
-    path = os.path.realpath(args[1])
+    path = os.path.realpath(os.path.expanduser(args[1]))
     mkinstance(path)
     
     


More information about the Repoze-checkins mailing list