Re: Working ZEO server startup script for current ZEO (5.1.0)
Jim Fulton <[email protected]>
| Newsgroups | gmane.comp.web.zope.zodb |
|---|---|
| Message-ID | <CAPDm-FghaQo8Vr6gQ-3=-0cLmZw1pOi4WG0Vs0VAwtQjUU7stA@mail.gmail.com> |
On Wed, Apr 19, 2017 at 7:26 AM, Jens Vagelpohl <[email protected]> wrote: > Hi all, > > Does anyone have a buildout example snippet that generates a working > script to start/stop a standalone ZEO server under ZEO 5.1.0? Sure: https://gist.github.com/jimfulton/798b59365b63fd4b3e60fa7ca439d93c Note: - This uses zdaemon and a zdaemon recipe. I like zdaemon for automated deployment because I like to deploy services independently. - There are undoubtedly better template recipes that zc.recipe.deployment:configuration, but I'm lazy and I use what I'm familiar with. (Also, zc.recipe.deployment is useful if you want to play well with operations.) - Perhaps there's a higher level recipe that would allow configuration with a single part. If not, it wouldn't take much effort to write one, however, when you get beyond toy deployments, you start introducing a lot of complications arising from production operational requirements. At ZC we had a recipe that supported our operations requirements: https://bitbucket.org/zc/zrs-rpm/src/8e04cfcab36e394e80e44dfe34768d9c9d0db0f9/src/zc_zrs_rpm_recipes/?at=master Our requirements included - server - service discovery with ZooKeeper - monitoring - packing cron jobs - installing things in the "right" places (according to our operations folks). > As already mentioned on the list, the old script generating recipes such > as plone.recipe.zeoserver and the zope.mkzeoinstance script no longer work. > I'm not sure what you're referring to here. The Plone folks reported the the zeoctl script in ZEO 5 was broken. The symptom was different than what you show. zeoctl is a very old and untested (and undocumented) script that combined zdaemon and zeo configuration into a single file. It was and is untested and is deprecated. No one was able to tell me how to use it correctly with any version of ZEO and I wasn't able to figure it out myself (with admittedly little debugging). I was able to guess at a fix that unstuck Plone. zeoctl is deprecated and "unsupported". People should stop using it. > > As an example, here’s the traceback from a current (v. 1.3.1) > plone.recipe.zeoserver-generated script: > > $ bin/zeoserver fg > /opt/zope/buildout/parts/zeoserver/bin/runzeo > Traceback (most recent call last): > File "/opt/zope/buildout/eggs/ZEO-5.1.0-py2.7.egg/ZEO/runzeo.py", line > 401, in <module> > main() > File "/opt/zope/buildout/eggs/ZEO-5.1.0-py2.7.egg/ZEO/runzeo.py", line > 392, in main > s.main() > File "/opt/zope/buildout/eggs/ZEO-5.1.0-py2.7.egg/ZEO/runzeo.py", line > 155, in main > self.create_server() > File "/opt/zope/buildout/eggs/ZEO-5.1.0-py2.7.egg/ZEO/runzeo.py", line > 251, in create_server > self.server = create_server(self.storages, self.options) > File "/opt/zope/buildout/eggs/ZEO-5.1.0-py2.7.egg/ZEO/runzeo.py", line > 345, in create_server > from .StorageServer import StorageServer > ValueError: Attempted relative import in non-package > This is odd. It suggests that ZEO wasn't installed correctly, or something weird with the path. > > bin/zeoserver looks like this: > > “”” > #!/opt/zope/Python-2.7.13/bin/python2.7 > > import sys > sys.path[0:0] = [ > '/opt/zope/buildout/eggs/plone.recipe.zeoserver-1.3.1-py2.7.egg', > '/opt/zope/buildout/eggs/ZopeUndo-4.1-py2.7.egg', > '/opt/zope/buildout/eggs/ZODB3-3.11.0-py2.7.egg', > '/opt/zope/buildout/eggs/zope.mkzeoinstance-3.9.5-py2.7.egg', > '/opt/zope/buildout/eggs/zc.recipe.egg-2.0.3-py2.7.egg', > '/opt/zope/buildout/eggs/setuptools-34.3.0-py2.7.egg', > '/opt/zope/buildout/eggs/zc.buildout-2.8.0-py2.7.egg', > '/opt/zope/buildout/eggs/transaction-2.1.2-py2.7.egg', > '/opt/zope/buildout/eggs/BTrees-4.4.1-py2.7-linux-x86_64.egg', > '/opt/zope/buildout/eggs/persistent-4.2.4-py2.7-linux-x86_64.egg', > '/opt/zope/buildout/eggs/ZODB-5.2.0-py2.7.egg', > '/opt/zope/buildout/eggs/ZEO-5.1.0-py2.7.egg', > '/opt/zope/buildout/eggs/appdirs-1.4.3-py2.7.egg', > '/opt/zope/buildout/eggs/six-1.10.0-py2.7.egg', > '/opt/zope/buildout/eggs/packaging-16.8-py2.7.egg', > '/opt/zope/buildout/eggs/zope.interface-4.2.0-py2.7-linux-x86_64.egg', > '/opt/zope/buildout/eggs/zodbpickle-0.6.0-py2.7-linux-x86_64.egg', > '/opt/zope/buildout/eggs/zc.lockfile-1.0.2-py2.7.egg', > '/opt/zope/buildout/eggs/ZConfig-3.1.0-py2.7.egg', > '/opt/zope/buildout/eggs/trollius-2.1-py2.7.egg', > '/opt/zope/buildout/eggs/futures-3.0.5-py2.7.egg', > '/opt/zope/buildout/eggs/zdaemon-4.2.0-py2.7.egg', > '/opt/zope/buildout/eggs/pyparsing-2.2.0-py2.7.egg', > ] > > import os; os.environ['PYTHONPATH'] = '/opt/zope/buildout/eggs/plone > .recipe.zeoserver-1.3.1-py2.7.egg:/opt/zope/buildout/eggs/ > ZopeUndo-4.1-py2.7.egg:/opt/zope/buildout/eggs/ZODB3-3.11. > 0-py2.7.egg:/opt/zope/buildout/eggs/zope.mkzeoinstance-3.9. > 5-py2.7.egg:/opt/zope/buildout/eggs/zc.recipe.egg-2. > 0.3-py2.7.egg:/opt/zope/buildout/eggs/setuptools-34.3. > 0-py2.7.egg:/opt/zope/buildout/eggs/zc.buildout-2.8.0-py2.7.egg:/opt/zope/ > buildout/eggs/transaction-2.1.2-py2.7.egg:/opt/zope/ > buildout/eggs/BTrees-4.4.1-py2.7-linux-x86_64.egg:/opt/ > zope/buildout/eggs/persistent-4.2.4-py2.7-linux-x86_64.egg:/ > opt/zope/buildout/eggs/ZODB-5.2.0-py2.7.egg:/opt/zope/ > buildout/eggs/ZEO-5.1.0-py2.7.egg:/opt/zope/buildout/eggs/ > appdirs-1.4.3-py2.7.egg:/opt/zope/buildout/eggs/six-1.10.0- > py2.7.egg:/opt/zope/buildout/eggs/packaging-16.8-py2.7.egg: > /opt/zope/buildout/eggs/zope.interface-4.2.0-py2.7-linux-x86 > _64.egg:/opt/zope/buildout/eggs/zodbpickle-0.6.0-py2.7-linux > -x86_64.egg:/opt/zope/buildout/eggs/zc.lockfile-1.0.2-py2.7. > egg:/opt/zope/buildout/eggs/ZConfig-3.1.0-py2.7.egg:/opt/ > zope/buildout/eggs/trollius-2.1-py2.7.egg:/opt/zope/ > buildout/eggs/futures-3.0.5-py2.7.egg:/opt/zope/buildout/ > eggs/zdaemon-4.2.0-py2.7.egg:/opt/zope/buildout/eggs/ > pyparsing-2.2.0-py2.7.egg:’ > import plone.recipe.zeoserver.ctl > > if __name__ == '__main__': > sys.exit(plone.recipe.zeoserver.ctl.main( > ["-C", '/opt/zope/buildout/parts/zeoserver/etc/zeo.conf'] > + sys.argv[1:])) > “”” > > /opt/zope/buildout/parts/zeoserver/bin/runzeo looks like this: > > “”” > #!/bin/sh > # ZEO instance start script > > PYTHON="/opt/zope/Python-2.7.13/bin/python2.7" > INSTANCE_HOME="/opt/zope/buildout/parts/zeoserver" > ZODB3_HOME="/opt/zope/buildout/eggs/ZEO-5.1.0-py2.7.egg" > > CONFIG_FILE="/opt/zope/buildout/parts/zeoserver/etc/zeo.conf" > > PYTHONPATH="/opt/zope/buildout/eggs/plone.recipe.zeoserver- > 1.3.1-py2.7.egg:/opt/zope/buildout/eggs/ZopeUndo-4.1- > py2.7.egg:/opt/zope/buildout/eggs/ZODB3-3.11.0-py2.7.egg:/ > opt/zope/buildout/eggs/zope.mkzeoinstance-3.9.5-py2.7.egg:/ > opt/zope/buildout/eggs/zc.recipe.egg-2.0.3-py2.7.egg:/opt/ > zope/buildout/eggs/setuptools-34.3.0-py2.7.egg:/opt/zope/ > buildout/eggs/zc.buildout-2.8.0-py2.7.egg:/opt/zope/ > buildout/eggs/transaction-2.1.2-py2.7.egg:/opt/zope/ > buildout/eggs/BTrees-4.4.1-py2.7-linux-x86_64.egg:/opt/ > zope/buildout/eggs/persistent-4.2.4-py2.7-linux-x86_64.egg:/ > opt/zope/buildout/eggs/ZODB-5.2.0-py2.7.egg:/opt/zope/ > buildout/eggs/ZEO-5.1.0-py2.7.egg:/opt/zope/buildout/eggs/ > appdirs-1.4.3-py2.7.egg:/opt/zope/buildout/eggs/six-1.10.0- > py2.7.egg:/opt/zope/buildout/eggs/packaging-16.8-py2.7.egg: > /opt/zope/buildout/eggs/zope.interface-4.2.0-py2.7-linux-x86 > _64.egg:/opt/zope/buildout/eggs/zodbpickle-0.6.0-py2.7-linux > -x86_64.egg:/opt/zope/buildout/eggs/zc.lockfile-1.0.2-py2.7. > egg:/opt/zope/buildout/eggs/ZConfig-3.1.0-py2.7.egg:/opt/ > zope/buildout/eggs/trollius-2.1-py2.7.egg:/opt/zope/ > buildout/eggs/futures-3.0.5-py2.7.egg:/opt/zope/buildout/ > eggs/zdaemon-4.2.0-py2.7.egg:/opt/zope/buildout/eggs/ > pyparsing-2.2.0-py2.7.egg:" > export PYTHONPATH INSTANCE_HOME > > RUNZEO="$ZODB3_HOME/ZEO/runzeo.py" > > exec "$PYTHON" "$RUNZEO" -C "$CONFIG_FILE" ${1+"$@“} > “”” > NFC. This doesn't look sane, but I didn't look too hard. :) But I suspect it has to do with $ZODB3_HOME/ZEO/runzeo.py which is running runzeo directly as if it's not in a package. Jim -- Jim Fulton http://jimfulton.info -- You received this message because you are subscribed to the Google Groups "zodb" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.