Skip to content

Commit

Permalink
docs, determine wsgi option based on presense of ZServer
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Nov 7, 2018
1 parent 8e801be commit d2e51d8
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 22 deletions.
13 changes: 11 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
Changelog
=========

5.0.2 (unreleased)
6.0.0 (unreleased)
------------------

Breaking changes:

- *add item here*
- Determine whether to set up a WSGI-based instanced
automatically based on whether ZServer is included in the eggs,
instead of explicitly using the ``wsgi`` option.
[davisagli]

- For WSGI-based instances, generate a zdaemon-based instance script
that works similarly to ZServer-based instances, instead of a
script that only handles running the WSGI server.
[davisagli]

New features:

Expand Down Expand Up @@ -57,6 +65,7 @@ Bug fixes:

- Python 3 compatibility with sixer
[ale-rt]

- Fix import. zopectl moved to ZServer
[pbauer]

Expand Down
34 changes: 21 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ ip-address
implementations will listen for requests. If this is unset, Zope will listen
on all IP addresses supported by the machine. This directive can be
overridden on a per-server basis in the servers section. Defaults to not
setting an ip-address.
setting an ip-address. Used for ZServer only, not WSGI.

zodb-cache-size
Set the ZODB cache size, i.e. the number of objects which the ZODB cache
will try to hold. Defaults to 30000.

zserver-threads
Specify the number of threads that Zope's ZServer web server will use to
service requests. The recipes default is 2.
service requests. The recipes default is 2. Used for ZServer only, not WSGI.

environment-vars
Define arbitrary key-value pairs for use as environment variables during
Expand Down Expand Up @@ -221,25 +221,28 @@ log levels or configure `mailinglogger`.
event-log
The filename of the event log. Defaults to ${buildout:directory}/var/log/${partname}.log
Setting this value to 'disable' will make the <eventlog> section to be omitted,
disabling logging events by default to a .log file.
disabling logging events by default to a .log file. Used for ZServer only, not WSGI.

event-log-level
Set the level of the console output for the event log. Level may be any of
CRITICAL, ERROR, WARN, INFO, DEBUG, or ALL. Defaults to INFO.
Used for ZServer only, not WSGI.

event-log-max-size
Maximum size of event log file. Enables log rotation.
Used for ZServer only, not WSGI.

event-log-old-files
Number of previous log files to retain when log rotation is enabled.
Defaults to 1.
Defaults to 1. Used for ZServer only, not WSGI.

event-log-custom
A custom section for the eventlog, to be able to use another
event logger than `logfile`
event logger than `logfile`. Used for ZServer only, not WSGI.

mailinglogger
A mailinglogger section added into the event log. Example snippet::
A mailinglogger section added into the event log.
Used for ZServer only, not WSGI. Example snippet::

<mailing-logger>
level error
Expand All @@ -255,22 +258,23 @@ mailinglogger
z2-log
The filename for the Z2 access log. Defaults to var/log/${partname}-Z2.log.
Setting this value to 'disable' will make the <logger access> section to be omitted,
disabling logging access events to a .log file
disabling logging access events to a .log file. Used for ZServer only, not WSGI.

z2-log-level
Set the log level for the access log. Level may be any of CRITICAL, ERROR,
WARN, INFO, DEBUG, or ALL. Defaults to WARN.
WARN, INFO, DEBUG, or ALL. Defaults to WARN. Used for ZServer only, not WSGI.

access-log-max-size
Maximum size of access log file. Enables log rotation.
Used for ZServer only, not WSGI.

access-log-old-files
Number of previous log files to retain when log rotation is enabled.
Defaults to 1.
Defaults to 1. Used for ZServer only, not WSGI.

access-log-custom
Like `event-log-custom`, a custom section for the access logger, to be able
to use another event logger than `logfile`.
to use another event logger than `logfile`. Used for ZServer only, not WSGI.

Load non-setuptools compatible Python libraries
-----------------------------------------------
Expand Down Expand Up @@ -386,6 +390,7 @@ enable-product-installation

ftp-address
Give a port for the FTP server. This enables the FTP server.
Used for ZServer only, not WSGI.

http-force-connection-close
Set to `on` to enforce Zope to set ``Connection: close header``.
Expand All @@ -398,6 +403,7 @@ http-fast-listen

icp-address
Give a port for the ICP server. This enables the ICP server.
Used for ZServer only, not WSGI.

import-directory
Used to configure the import directory for instance.
Expand Down Expand Up @@ -439,10 +445,12 @@ var
Defaults to ${buildout:directory}/var.

webdav-address
Give a port for the WebDAV server. This enables the WebDAV server
Give a port for the WebDAV server. This enables the WebDAV server.
Used for ZServer only, not WSGI.

webdav-force-connection-close
Valid options are off and on. Defaults to off
Valid options are off and on. Defaults to off.
Used for ZServer only, not WSGI.

zlib-storage
Adds support for file compression on a file storage database. The
Expand Down Expand Up @@ -496,7 +504,7 @@ zopectl-umask
http-header-max-length
Manually set the maximum size of received HTTP header being processed by Zope.
The request is discarded and considered as a DoS attack if the header size exceeds
this limit. Default: 8192
this limit. Default: 8192. Used for ZServer only, not WSGI.

Example::

Expand Down
4 changes: 2 additions & 2 deletions src/plone/recipe/zope2instance/ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,14 +641,14 @@ def main(args=None):
options.interpreter += '-script.py'
if HAS_ZSERVER:
from ZServer.Zope2.Startup import run
script = run.__file__
script = os.path.join(os.path.dirname(run.__file__), 'run.py')
options.program = [
options.python, options.interpreter, script, '-C',
options.configfile
]
else:
from Zope2.Startup import serve
script = serve.__file__
script = os.path.join(os.path.dirname(serve.__file__), 'serve.py')
wsgi_ini = os.path.join(options.directory, 'etc', 'wsgi.ini')
options.program = [
options.python, options.interpreter, script, wsgi_ini
Expand Down
13 changes: 8 additions & 5 deletions src/plone/recipe/zope2instance/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def __init__(self, buildout, name, options):
buildout['buildout'].get('include-site-packages', 'false')
) not in ('off', 'disable', 'false')

self.wsgi = options.get('wsgi') in ('waitress', 'on')
# Get Scripts' attributes
return Scripts.__init__(self, buildout, name, options)

Expand All @@ -96,13 +95,18 @@ def install(self, update=False):
make.make_instance(options.get('user', None), location, version)

try:
# Make a new zope.conf and wsgi.ini based on options in buildout.cfg
requirements, ws = self.egg.working_set(
['plone.recipe.zope2instance'])
self.wsgi = 'zserver' not in ws.by_key

# Make a new zope.conf and wsgi.ini
# based on options in buildout.cfg
self.build_zope_conf()
if self.wsgi:
self.build_wsgi_ini()

# Install extra scripts
installed.extend(self.install_scripts())
installed.extend(self.install_scripts(ws))

# Add zcml files to package-includes
self.build_package_includes()
Expand Down Expand Up @@ -605,7 +609,7 @@ def build_wsgi_ini(self):
with open(wsgi_ini_path, 'w') as f:
f.write(wsgi_ini)

def install_scripts(self):
def install_scripts(self, ws):
options = self.options
location = options['location']

Expand All @@ -618,7 +622,6 @@ def install_scripts(self):
zopectl_umask = options.get('zopectl-umask', '')

extra_paths = options.get('extra-paths', '').split()
requirements, ws = self.egg.working_set(['plone.recipe.zope2instance'])
reqs = [self.options.get('control-script', self.name)]
reqs.extend(['plone.recipe.zope2instance.ctl', 'main'])
reqs = [tuple(reqs)]
Expand Down

0 comments on commit d2e51d8

Please sign in to comment.