Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add docs for installation into a virtualenv. - Update Sphinx paths to use '_' prefix. Closes #30.
- Loading branch information
Showing
10 changed files
with
288 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ eggs/ | |
include/ | ||
lib/ | ||
parts/ | ||
doc/.build/ | ||
doc/_build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
Installing Zope with ``virtualenv`` | ||
=================================== | ||
|
||
.. highlight:: bash | ||
|
||
This document describes how to install Zope into a ``virtualenv``. | ||
|
||
|
||
Create a Virtual Environment | ||
---------------------------- | ||
|
||
.. code-block:: sh | ||
$ /opt/Python-2.7.9/bin/virtualenv z213 | ||
New python executable in z213/bin/python | ||
Installing setuptools, pip, wheel...done. | ||
$ cd z213 | ||
Install the Zope2 2.13.22 Software Packages | ||
------------------------------------------- | ||
|
||
.. code-block:: sh | ||
$ bin/pip install \ | ||
--trusted-host download.zope.org \ | ||
--index http://download.zope.org/Zope2/index/2.13.22/ Zope2 | ||
Collecting Zope2 | ||
... | ||
Successfully installed ... | ||
Creating a Zope instance | ||
------------------------ | ||
|
||
Once you've installed Zope, you will need to create an "instance | ||
home". This is a directory that contains configuration and data for a | ||
Zope server process. The instance home is created using the | ||
``mkzopeinstance`` script: | ||
|
||
.. code-block:: sh | ||
$ bin/mkzopeinstance | ||
You can specify the Python interpreter to use for the instance | ||
explicitly: | ||
|
||
.. code-block:: sh | ||
$ bin/mkzopeinstance --python=bin/pythn | ||
You will be asked to provide a user name and password for an | ||
administrator's account during ``mkzopeinstance``. To see the available | ||
command-line options, run the script with the ``--help`` option: | ||
|
||
.. code-block:: sh | ||
$ bin/mkzopeinstance --help | ||
Using the ``virtualenv`` as the Zope Instance | ||
--------------------------------------------- | ||
|
||
You can choose to use the ``virtualenv`` as your Zope instance: | ||
|
||
.. code-block:: sh | ||
$ bin/mkzopeinstance -d . | ||
In this case, the instance files will be located in the | ||
subdirectories of the ``virtualenv``: | ||
|
||
- ``etc/`` will hold the configuration files. | ||
- ``log/`` will hold the log files. | ||
- ``var/`` will hold the database files. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
Running Zope2 as a WSGI Application | ||
=================================== | ||
|
||
|
||
This document assumes you have installed Zope into a ``virtualenv`` (see | ||
:doc:`INSTALL-virtualenv`). | ||
|
||
Install the Supporting Software | ||
------------------------------- | ||
|
||
To run as a WSGI application, you need to install some additional software. | ||
|
||
.. code-block:: sh | ||
$ bin/pip install \ | ||
--trusted-host download.zope.org \ | ||
--index http://download.zope.org/Zope2/index/2.13.22/ \ | ||
repoze.who repoze.tm2 repoze.retry Paste PasteDeploy PasteScript | ||
Collecting repoze.who | ||
... | ||
Successfully installed Paste-1.7.5.1 PasteDeploy-1.3.4 PasteScript-1.7.5 repoze.retry-1.2 repoze.tm2-1.0 repoze.who-2.0 | ||
Update the Zope Application Configuration | ||
----------------------------------------- | ||
|
||
The generated ``etc/zope.conf`` file assumes that Zope will be running | ||
using the built-in ``ZServer``. | ||
|
||
.. code-block:: sh | ||
$ vim etc/zope.conf | ||
Update the contents as follows. | ||
|
||
.. code-block:: apacheconf | ||
%define INSTANCE /path/to/virtualenv | ||
instancehome $INSTANCE | ||
.. note:: | ||
|
||
The ``%define instance /path/to/virtualenv`` element must | ||
point to the environment: there is no "relative to this file" support | ||
built in. | ||
|
||
Set up logging for the application. | ||
|
||
.. code-block:: apacheconf | ||
<eventlog> | ||
level info | ||
<logfile> | ||
path $INSTANCE/log/event.log | ||
level info | ||
</logfile> | ||
</eventlog> | ||
<logger access> | ||
level WARN | ||
<logfile> | ||
path $INSTANCE/log/Z2.log | ||
format %(message)s | ||
</logfile> | ||
</logger> | ||
Configure the database (note that you could use ``ZEO`` or ``Relstorage`` | ||
rather than a bare ``FileStorage``): | ||
|
||
.. code-block:: apacheconf | ||
<zodb_db main> | ||
# Main FileStorage database | ||
<filestorage> | ||
# See .../ZODB/component.xml for directives (sectiontype | ||
# "filestorage"). | ||
path $INSTANCE/var/Data.fs | ||
</filestorage> | ||
mount-point / | ||
</zodb_db> | ||
<zodb_db temporary> | ||
# Temporary storage database (for sessions) | ||
<temporarystorage> | ||
name temporary storage for sessioning | ||
</temporarystorage> | ||
mount-point /temp_folder | ||
container-class Products.TemporaryFolder.TemporaryContainer | ||
</zodb_db> | ||
Because we will be running a separately-configured WSGI server, remove any | ||
``<http-server>`` configuration from the file. | ||
|
||
Create the WSGI Server Configuration | ||
------------------------------------ | ||
|
||
.. code-block:: sh | ||
$ vim etc/zope.wsgi | ||
First, configure the "application" endpoint for Zope: | ||
|
||
.. code-block:: ini | ||
[app:zope] | ||
use = egg:Zope2#main | ||
zope_conf = %(here)s/zope.conf | ||
Next, set up the WSGI middleware pipeline: | ||
|
||
.. code-block:: ini | ||
[pipeline:main] | ||
pipeline = | ||
egg:paste#evalerror | ||
egg:repoze.retry#retry | ||
egg:repoze.tm2#tm | ||
zope | ||
The middleware layers are "wrapped" around the application endpoint as follows: | ||
|
||
- ``paste#evalerror`` is debugging middleware, which shows tracebacks for | ||
errors raised from the application. It should **not** be configured for | ||
production use. | ||
|
||
- ``repoze.retry#retry`` is middleware which retries requests when retriable | ||
exceptions are raised. By default, it retries 3 times, and only for | ||
requests which raise ``ZODB.ConflictError``. See | ||
http://repozeretry.rtfd.org/ for details on configuring it otherwise. | ||
|
||
- ``repoze.tm2#tm`` is middleware which begins a new transaction for each | ||
request, and then either aborts the transaction (if the request raises an | ||
exception) or commits it (if not). See | ||
http://repozetm2.rtfd.org/ for details on configuring it. | ||
|
||
Finally, configure the WSGI server: | ||
|
||
.. code-block:: ini | ||
[server:main] | ||
use = egg:paste#http | ||
host = localhost | ||
port = 8080 | ||
.. note:: | ||
|
||
Any server conforming to PEP 333/3333 should work, although the parameters | ||
could change. | ||
|
||
|
||
Set up the Admin User | ||
--------------------- | ||
|
||
Before starting the WSGI server, run the ``addzope2user`` script to configure | ||
the administrative user. | ||
|
||
.. code-block:: sh | ||
$ bin/addzope2user admin <yourpasswordhere> | ||
No handlers could be found for logger "ZODB.FileStorage" | ||
User admin created. | ||
Start the WSGI Server | ||
--------------------- | ||
|
||
.. code-block:: sh | ||
$ bin/paster serve etc/zope.wsgi | ||
Starting server in PID 24934. | ||
serving on http://127.0.0.1:8080 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Preserve "empty" directory under git. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Preserve "empty" directory under git. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.