src/build/html/zodb.html
changeset 0 d153941bb745
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/build/html/zodb.html	Sun Jan 14 11:48:51 2018 +0100
@@ -0,0 +1,238 @@
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+    <title>Creating ZODB &#8212; PyAMS User Guide 0.1.0 documentation</title>
+    <link rel="stylesheet" href="_static/pyramid.css" type="text/css" />
+    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
+    <script type="text/javascript">
+      var DOCUMENTATION_OPTIONS = {
+        URL_ROOT:    './',
+        VERSION:     '0.1.0',
+        COLLAPSE_INDEX: false,
+        FILE_SUFFIX: '.html',
+        HAS_SOURCE:  true,
+        SOURCELINK_SUFFIX: '.txt'
+      };
+    </script>
+    <script type="text/javascript" src="_static/jquery.js"></script>
+    <script type="text/javascript" src="_static/underscore.js"></script>
+    <script type="text/javascript" src="_static/doctools.js"></script>
+    <link rel="index" title="Index" href="genindex.html" />
+    <link rel="search" title="Search" href="search.html" />
+    <link rel="next" title="Installing PyAMS" href="install.html" />
+    <link rel="prev" title="Welcome to PyAMS_utils’s documentation!" href="index.html" />
+<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+<!--[if lte IE 6]>
+<link rel="stylesheet" href="_static/ie6.css" type="text/css" media="screen" charset="utf-8" />
+<![endif]-->
+
+  </head>
+  <body>
+
+    <div class="related" role="navigation" aria-label="related navigation">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="genindex.html" title="General Index"
+             accesskey="I">index</a></li>
+        <li class="right" >
+          <a href="py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li class="right" >
+          <a href="install.html" title="Installing PyAMS"
+             accesskey="N">next</a> |</li>
+        <li class="right" >
+          <a href="index.html" title="Welcome to PyAMS_utils’s documentation!"
+             accesskey="P">previous</a> |</li>
+        <li class="nav-item nav-item-0"><a href="index.html">PyAMS User Guide 0.1.0 documentation</a> &#187;</li> 
+      </ul>
+    </div>  
+
+    <div class="document">
+      <div class="documentwrapper">
+        <div class="bodywrapper">
+          <div class="body" role="main">
+            
+  <div class="section" id="creating-zodb">
+<span id="zodb"></span><h1>Creating ZODB<a class="headerlink" href="#creating-zodb" title="Permalink to this headline">¶</a></h1>
+<p>PyAMS primarily relies on a ZODB (Zope Objects DataBase) to store it’s configuration. Other packages may
+rely on other database(s), but <em>PyAMS_content</em> package also stores it’s contents in a ZODB.</p>
+<p>As some PyAMS packages start several processes (“synchronization” is done via <strong>ØMQ</strong>), concurrent accesses are
+required on the ZODB (even when you start your application in “single process” mode); several ZODB storages
+implementations providing a shared access are available: <a class="reference internal" href="#zeo">ZEO</a>, <a class="reference internal" href="#relstorage">RelStorage</a> and <a class="reference internal" href="#newt-db">Newt.DB</a>.</p>
+<div class="section" id="installing-a-zeo-server">
+<span id="zeo"></span><h2>Installing a ZEO server<a class="headerlink" href="#installing-a-zeo-server" title="Permalink to this headline">¶</a></h2>
+<p>ZEO (Zope Enterprise Objects) is the first available implementation available for concurrent access to a
+FileStorage, provided through the ZEO package.</p>
+<p>ZEO package documentation and complete configuration settings are available on PyPI.</p>
+<div class="section" id="creating-initial-buildout">
+<h3>Creating initial buildout<a class="headerlink" href="#creating-initial-buildout" title="Permalink to this headline">¶</a></h3>
+<p>PyAMS provides a ZEO server scaffold, called <em>zeo_server</em>, generated via a <em>cookiecutter</em> template.</p>
+<p>A simple option to create a ZEO server is to create a buildout environment including <em>ZEO</em> and <em>ZODB</em> packages:</p>
+<div class="highlight-bash"><div class="highlight"><pre><span></span><span class="c1"># mkdir /var/local/</span>
+<span class="c1"># pip3 install virtualenv</span>
+<span class="c1"># virtualenv --python=python3.5 env</span>
+<span class="c1"># cd env</span>
+<span class="c1"># . bin/activate</span>
+<span class="o">(</span>env<span class="o">)</span> <span class="c1"># pip3.5 install cookiecutter</span>
+<span class="o">(</span>env<span class="o">)</span> <span class="c1"># cookiecutter hg+http://hg.ztfy.org/pyams/scaffolds/zeo_server</span>
+</pre></div>
+</div>
+<p><em>CookieCutter</em> will ask you for a small set of input variables that you can change or not:</p>
+<ul class="simple">
+<li><strong>pyams_release</strong>: version of PyAMS configuration file to use. “latest” (default value) will point to last release;
+you can also choose to point to a given release (“0.1.4” for example)</li>
+<li><strong>project_name</strong>: current environment name in “human form”</li>
+<li><strong>project_slug</strong>: “technical” package name, based on project name</li>
+<li><strong>eggs_directory</strong>: relative or absolute path to directory containing downloaded eggs; this directory can be
+shared with other projects (“eggs” as default)</li>
+<li><strong>run_user</strong>: user name under which ZEO process will run (“zeoadm” as default)</li>
+<li><strong>run_group</strong>: group name under which ZEO process will run (“zeo” as default)</li>
+<li><strong>zeo_server_port</strong>: listening port of ZEO server (“8100” as default)</li>
+<li><strong>zeo_monitor_port</strong>: listening port of ZEO monitor (“8101” as default)</li>
+<li><strong>zeo_storage</strong>: name of first ZEO storage; default value is based on project name</li>
+<li><strong>use_zeo_auth</strong>: specify if ZEO authentication should be used</li>
+<li><strong>zeo_auth_user</strong>: name of ZEO authenticated user (if ZEO authentication is used)</li>
+<li><strong>zeo_auth_password</strong>: password of ZEO authenticated user (if ZEO authentication is used)</li>
+<li><strong>zeo_pack_report</strong>: email address to which pack reports should be sent</li>
+<li><strong>logs_directory</strong>: absolute path to directory containing ZEO’s log files.</li>
+</ul>
+<p>A message is displayed after initialization to finalize environment creation:</p>
+<div class="code highlight-default"><div class="highlight"><pre><span></span><span class="n">Your</span> <span class="n">ZEO</span> <span class="n">environment</span> <span class="ow">is</span> <span class="n">initialized</span><span class="o">.</span>
+<span class="n">To</span> <span class="n">finalize</span> <span class="n">it</span><span class="s1">&#39;&#39;</span><span class="n">s</span> <span class="n">creation</span><span class="p">,</span> <span class="n">just</span> <span class="nb">type</span><span class="p">:</span>
+<span class="o">-</span> <span class="n">cd</span> <span class="n">zeo_server</span>
+<span class="o">-</span> <span class="n">python3</span><span class="o">.</span><span class="mi">5</span> <span class="n">bootstrap</span><span class="o">.</span><span class="n">py</span>
+<span class="o">-</span> <span class="o">./</span><span class="nb">bin</span><span class="o">/</span><span class="n">buildout</span>
+
+<span class="n">To</span> <span class="n">initialize</span> <span class="n">authentication</span> <span class="n">database</span><span class="p">,</span> <span class="n">please</span> <span class="n">run</span> <span class="n">following</span> <span class="n">command</span> <span class="n">after</span> <span class="n">buildout</span><span class="p">:</span>
+<span class="o">./</span><span class="nb">bin</span><span class="o">/</span><span class="n">zeopasswd</span> <span class="o">-</span><span class="n">f</span> <span class="n">etc</span><span class="o">/</span><span class="n">auth</span><span class="o">.</span><span class="n">db</span> <span class="o">-</span><span class="n">p</span> <span class="n">digest</span> <span class="o">-</span><span class="n">r</span> <span class="s2">&quot;ZEO_server&quot;</span> <span class="n">zeouser</span> <span class="n">xxxx</span>
+</pre></div>
+</div>
+</div>
+<div class="section" id="zeo-server-configuration">
+<h3>ZEO server configuration<a class="headerlink" href="#zeo-server-configuration" title="Permalink to this headline">¶</a></h3>
+<p>All ZEO configuration files are generated in “etc” subdirectory. These includes:</p>
+<ul class="simple">
+<li><strong>etc/zeo_server-zdaemon.conf</strong>: ZDaemon configuration file</li>
+<li><strong>etc/zeo_server-zeo.conf</strong>: ZEO server configuration file</li>
+<li><strong>etc/auth.db</strong>: ZEO authentication file; WARNING: this file is not created automatically, you have to create it
+after buildout.</li>
+</ul>
+<p>In these file names, always replace “zeo_server” with the value which was given to “project_slug” variable during
+<em>CookieCutter</em> template creation.</p>
+</div>
+<div class="section" id="zeo-server-tools">
+<h3>ZEO server tools<a class="headerlink" href="#zeo-server-tools" title="Permalink to this headline">¶</a></h3>
+<p>A set of system configuration files are produced to handle your ZEO environment. These includes:</p>
+<ul class="simple">
+<li><strong>etc/init.d/zeo-zeo_server</strong>: ZEO server start/stop script in Init-D format. Create a link to this file in
+<em>/etc/init.d</em> and update Init.d scripts (<em>update-rc.d zeo-zeo_server defaults</em>) to include ZEO in server start/stop
+process. You can also use this script to start/stop ZEO by hand with <em>start</em> and <em>stop</em> arguments.</li>
+<li><strong>etc/systemd/zeo-zeo_server.service</strong>: SystemD service configuration file for ZEO server. Create a link to this
+file in <em>/etc/systemd/system</em> and reload SystemD daemon (<em>systemctl daemon-reload</em>) before activating ZEO service
+(<em>systemctl enable zeo-zeo_server.service</em> and <em>systemctl start zeo-zeo_server.service</em>).</li>
+<li><strong>etc/logrotate.d/zeo-zeo_server</strong>: LogRotate configuration file for ZEO log files. Create a link to this file in
+<em>/etc/logrotate.d</em> to activate log rotation for ZEO server.</li>
+<li><strong>etc/cron.d/pack-zeo-zeo_server</strong>: Cron configuration file for ZEO database packing. Just create a link to this
+file in <em>/etc/cron.d</em> directory to enable ZODB packing on a weekly basis (by default).</li>
+</ul>
+<p>In these file names, always replace “zeo_server” with the value which was given to “project_slug” variable during
+<em>CookieCutter</em> template creation. All directory names are those used on a Debian GNU/Linux distribution and may have
+to be changed on other distributions.</p>
+</div>
+</div>
+<div class="section" id="installing-a-relstorage-server">
+<span id="relstorage"></span><h2>Installing a RelStorage server<a class="headerlink" href="#installing-a-relstorage-server" title="Permalink to this headline">¶</a></h2>
+<p>RelStorage (<a class="reference external" href="http://relstorage.readthedocs.io/en/latest">http://relstorage.readthedocs.io/en/latest</a>) is an alternate ZODB storage implementation, that stores
+Python pickles in a relational database; PostgreSQL (&gt;= 9.0), MySQL (&gt;= 5.0.32) and Oracle (&gt; 10g) databases are
+supported.</p>
+<p>To create a database compatible with RelStorage, you just have to install the database server and create a database
+dedicated to RelStorage; schema initialization is then completely done by RelStorage on application startup.</p>
+<p>RelStorage is supposed to provide better performances than ZEO, notably under high load. RelStorage can also get
+benefit from many extensions (clustering, fail-over, hot-standby…) provided by these databases.</p>
+</div>
+<div class="section" id="installing-a-newtdb-server">
+<span id="newt-db"></span><h2>Installing a NewtDB server<a class="headerlink" href="#installing-a-newtdb-server" title="Permalink to this headline">¶</a></h2>
+<p>NewtDB (<a class="reference external" href="http://www.newtdb.org/en/latest">http://www.newtdb.org/en/latest</a>) is another ZODB storage implementation. It’s using RelStorage but is
+dedicated to PostgreSQL (&gt;= 9.5).</p>
+<p>NewtDB adds conversion of data from the native serialization used by ZODB to JSON, stored in a PostgreSQL JSONB
+column. The JSON data supplements the native data to support indexing, search, and access from non-Python application.
+Because the JSON format is lossy, compared to the native format, the native format is still used for loading
+objects from the database. For this reason, the JSON data are read-only.</p>
+<p>Newt adds a search API for searching the Postgres JSON data and returning persistent objects. It also provides a
+convenient API for raw data searches.</p>
+<p>Database creation is done as with RelStorage, but NewtDB add several schema objects. Migration scripts are available
+if you need to switch from a classic RelStorage database to a Newt database.</p>
+</div>
+</div>
+
+
+          </div>
+        </div>
+      </div>
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
+        <div class="sphinxsidebarwrapper">
+  <h3><a href="index.html">Table Of Contents</a></h3>
+  <ul>
+<li><a class="reference internal" href="#">Creating ZODB</a><ul>
+<li><a class="reference internal" href="#installing-a-zeo-server">Installing a ZEO server</a><ul>
+<li><a class="reference internal" href="#creating-initial-buildout">Creating initial buildout</a></li>
+<li><a class="reference internal" href="#zeo-server-configuration">ZEO server configuration</a></li>
+<li><a class="reference internal" href="#zeo-server-tools">ZEO server tools</a></li>
+</ul>
+</li>
+<li><a class="reference internal" href="#installing-a-relstorage-server">Installing a RelStorage server</a></li>
+<li><a class="reference internal" href="#installing-a-newtdb-server">Installing a NewtDB server</a></li>
+</ul>
+</li>
+</ul>
+
+  <h4>Previous topic</h4>
+  <p class="topless"><a href="index.html"
+                        title="previous chapter">Welcome to PyAMS_utils’s documentation!</a></p>
+  <h4>Next topic</h4>
+  <p class="topless"><a href="install.html"
+                        title="next chapter">Installing PyAMS</a></p>
+<div id="searchbox" style="display: none" role="search">
+  <h3>Quick search</h3>
+    <form class="search" action="search.html" method="get">
+      <div><input type="text" name="q" /></div>
+      <div><input type="submit" value="Go" /></div>
+      <input type="hidden" name="check_keywords" value="yes" />
+      <input type="hidden" name="area" value="default" />
+    </form>
+</div>
+<script type="text/javascript">$('#searchbox').show(0);</script>
+        </div>
+      </div>
+      <div class="clearer"></div>
+    </div>
+    <div class="related" role="navigation" aria-label="related navigation">
+      <h3>Navigation</h3>
+      <ul>
+        <li class="right" style="margin-right: 10px">
+          <a href="genindex.html" title="General Index"
+             >index</a></li>
+        <li class="right" >
+          <a href="py-modindex.html" title="Python Module Index"
+             >modules</a> |</li>
+        <li class="right" >
+          <a href="install.html" title="Installing PyAMS"
+             >next</a> |</li>
+        <li class="right" >
+          <a href="index.html" title="Welcome to PyAMS_utils’s documentation!"
+             >previous</a> |</li>
+        <li class="nav-item nav-item-0"><a href="index.html">PyAMS User Guide 0.1.0 documentation</a> &#187;</li> 
+      </ul>
+    </div>
+    <div class="footer" role="contentinfo">
+        &#169; Copyright 2017, Thierry Florac.
+      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.6.5.
+    </div>
+  </body>
+</html>
\ No newline at end of file