/usr/share/doc/pywps/html/deployment.html is in pywps-doc 4.0.0-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | <!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>Deployment to a production server — PyWPS 4.0.0 documentation</title>
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '4.0.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>
<script type="text/javascript" src="_static/mathjax/MathJax.js?config=tex-ams-mml_htmlormml"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="Migrating from PyWPS 3.x to 4.x" href="migration.html" />
<link rel="prev" title="Processes" href="process.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head>
<body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="deployment-to-a-production-server">
<span id="deployment"></span><h1>Deployment to a production server<a class="headerlink" href="#deployment-to-a-production-server" title="Permalink to this headline">¶</a></h1>
<p>As already described in the <a class="reference internal" href="install.html#installation"><span class="std std-ref">Installation</span></a> section, no specific deployment
procedures are for PyWPS when using flask-based server. But this formula is not
intended to be used in a production environment. For production, <a class="reference external" href="https://httpd.apache.org/">Apache httpd</a> or <a class="reference external" href="https://nginx.org/">nginx</a> servers are
more advised. PyWPS is runs as a <a class="reference external" href="https://wsgi.readthedocs.io/en/latest/">WSGI</a> application on those servers. PyWPS
relies on the <a class="reference external" href="http://werkzeug.pocoo.org/">Werkzeug</a> library for this purpose.</p>
<div class="section" id="deploying-an-individual-pywps-instance">
<h2>Deploying an individual PyWPS instance<a class="headerlink" href="#deploying-an-individual-pywps-instance" title="Permalink to this headline">¶</a></h2>
<p>PyWPS should be installed in your computer (as per the <a class="reference internal" href="install.html#installation"><span class="std std-ref">Installation</span></a>
section). As a following step, you can now create several instances of your WPS
server.</p>
<p>It is advisable for each PyWPS instance to have its own directory, where the
WSGI file along with available processes should reside. Therefore create a new
directory for the PyWPS instance:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ sudo mkdir /path/to/pywps/
# create a directory for your processes too
$ sudo mkdir /path/to/pywps/processes
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">In this configuration example it is assumed that there is only one
instance of PyWPS on the server.</p>
</div>
<p>Each instance is represented by a single <cite>WSGI</cite> script (written in Python),
which:</p>
<blockquote>
<div><ol class="arabic simple">
<li>Loads the configuration files</li>
<li>Serves processes</li>
<li>Takes care about maximum number of concurrent processes and similar</li>
</ol>
</div></blockquote>
</div>
<div class="section" id="creating-a-pywps-wsgi-instance">
<h2>Creating a PyWPS <cite>WSGI</cite> instance<a class="headerlink" href="#creating-a-pywps-wsgi-instance" title="Permalink to this headline">¶</a></h2>
<p>An example WSGI script is distributed along with PyWPS-Demo service, as
described in the <a class="reference internal" href="install.html#installation"><span class="std std-ref">Installation</span></a> section. The script is actually
straightforward - in fact, it’s a just wrapper around the PyWPS server with a
list of processes and configuration files passed as arguments. Here is an
example of a PyWPS WSGI script:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ $EDITOR /path/to/pywps/pywps.wsgi
</pre></div>
</div>
<div class="highlight-python"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="ch">#!/usr/bin/env python3</span>
<span class="kn">from</span> <span class="nn">pywps.app.Service</span> <span class="kn">import</span> <span class="n">Service</span>
<span class="c1"># processes need to be installed in PYTHON_PATH</span>
<span class="kn">from</span> <span class="nn">processes.sleep</span> <span class="kn">import</span> <span class="n">Sleep</span>
<span class="kn">from</span> <span class="nn">processes.ultimate_question</span> <span class="kn">import</span> <span class="n">UltimateQuestion</span>
<span class="kn">from</span> <span class="nn">processes.centroids</span> <span class="kn">import</span> <span class="n">Centroids</span>
<span class="kn">from</span> <span class="nn">processes.sayhello</span> <span class="kn">import</span> <span class="n">SayHello</span>
<span class="kn">from</span> <span class="nn">processes.feature_count</span> <span class="kn">import</span> <span class="n">FeatureCount</span>
<span class="kn">from</span> <span class="nn">processes.buffer</span> <span class="kn">import</span> <span class="n">Buffer</span>
<span class="kn">from</span> <span class="nn">processes.area</span> <span class="kn">import</span> <span class="n">Area</span>
<span class="n">processes</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">FeatureCount</span><span class="p">(),</span>
<span class="n">SayHello</span><span class="p">(),</span>
<span class="n">Centroids</span><span class="p">(),</span>
<span class="n">UltimateQuestion</span><span class="p">(),</span>
<span class="n">Sleep</span><span class="p">(),</span>
<span class="n">Buffer</span><span class="p">(),</span>
<span class="n">Area</span><span class="p">()</span>
<span class="p">]</span>
<span class="c1"># Service accepts two parameters:</span>
<span class="c1"># 1 - list of process instances</span>
<span class="c1"># 2 - list of configuration files</span>
<span class="n">application</span> <span class="o">=</span> <span class="n">Service</span><span class="p">(</span>
<span class="n">processes</span><span class="p">,</span>
<span class="p">[</span><span class="s1">'/path/to/pywps/pywps.cfg'</span><span class="p">]</span>
<span class="p">)</span>
</pre></div>
</td></tr></table></div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>The WSGI script is assuming that there are already some
processes at hand that can be directly included. Also it assumes, that
the configuration file already exists - which is not the case yet.</p>
<p class="last">The Configuration is described in next chapter (<a class="reference internal" href="configuration.html#configuration"><span class="std std-ref">Configuration</span></a>),
as well as process creation and deployment (<a class="reference internal" href="process.html#process"><span class="std std-ref">Processes</span></a>).</p>
</div>
</div>
<div class="section" id="deployment-on-apache2-httpd-server">
<h2>Deployment on Apache2 httpd server<a class="headerlink" href="#deployment-on-apache2-httpd-server" title="Permalink to this headline">¶</a></h2>
<p>First, the WSGI module must be installed and enabled:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ sudo apt-get install libapache2-mod-wsgi
$ sudo a2enmod wsgi
</pre></div>
</div>
<p>You then can edit your site configuration file
(<cite>/etc/apache2/sites-enabled/yoursite.conf</cite>) and add the following:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="c1"># PyWPS</span>
<span class="n">WSGIDaemonProcess</span> <span class="n">pywps</span> <span class="n">home</span><span class="o">=/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">pywps</span> <span class="n">user</span><span class="o">=</span><span class="n">www</span><span class="o">-</span><span class="n">data</span> <span class="n">group</span><span class="o">=</span><span class="n">www</span><span class="o">-</span><span class="n">data</span> <span class="n">processes</span><span class="o">=</span><span class="mi">2</span> <span class="n">threads</span><span class="o">=</span><span class="mi">5</span>
<span class="n">WSGIScriptAlias</span> <span class="o">/</span><span class="n">pywps</span> <span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">pywps</span><span class="o">/</span><span class="n">pywps</span><span class="o">.</span><span class="n">wsgi</span> <span class="n">process</span><span class="o">-</span><span class="n">group</span><span class="o">=</span><span class="n">pywps</span>
<span class="o"><</span><span class="n">Directory</span> <span class="o">/</span><span class="n">path</span><span class="o">/</span><span class="n">to</span><span class="o">/</span><span class="n">pywps</span><span class="o">/></span>
<span class="n">WSGIScriptReloading</span> <span class="n">On</span>
<span class="n">WSGIProcessGroup</span> <span class="n">pywps</span>
<span class="n">WSGIApplicationGroup</span> <span class="o">%</span><span class="p">{</span><span class="n">GLOBAL</span><span class="p">}</span>
<span class="n">Require</span> <span class="nb">all</span> <span class="n">granted</span>
<span class="o"></</span><span class="n">Directory</span><span class="o">></span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>WSGIScriptAlias</cite> points to the <cite>pywps.wsgi</cite> script created
before - it will be available under the url <a class="reference external" href="http://localhost/pywps">http://localhost/pywps</a></p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Please make sure that the <cite>logs</cite>, <cite>workdir</cite>, and <cite>outputpath</cite> directories are writeable to the Apache user.
The <cite>outputpath</cite> directory need also be accessible from the URL mentioned in <cite>outputurl</cite> configuration.</p>
</div>
<p>And of course restart the server:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>$ sudo service apache2 restart
</pre></div>
</div>
</div>
<div class="section" id="deployment-on-nginx">
<h2>Deployment on nginx<a class="headerlink" href="#deployment-on-nginx" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">We are currently missing documentation about <cite>nginx</cite>.
Please help documenting the deployment of PyWPS to nginx.</p>
</div>
<p>You should be able to deploy PyWPS on nginx as a standard WSGI application. The
best documentation is probably to be found at <a class="reference external" href="http://uwsgi-docs.readthedocs.io/en/latest/WSGIquickstart.html">Readthedocs</a>.</p>
</div>
<div class="section" id="testing-the-deployment-of-a-pywps-instance">
<span id="deployment-testing"></span><h2>Testing the deployment of a PyWPS instance<a class="headerlink" href="#testing-the-deployment-of-a-pywps-instance" title="Permalink to this headline">¶</a></h2>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">For the purpose of this documentation, it is assumed that you’ve
installed PyWPS using the <cite>localhost</cite> server domain name.</p>
</div>
<p>As stated, before, PyWPS should be available at <a class="reference external" href="http://localhost/pywps">http://localhost/pywps</a>, we now
can visit the url (or use <cite>wget</cite>):</p>
<div class="highlight-default"><div class="highlight"><pre><span></span># the --content-error parameter makes sure, error response is displayed
$ wget --content-error -O - "http://localhost/pywps"
</pre></div>
</div>
<p>The result should be an XML-encoded error message.</p>
<div class="highlight-xml"><div class="highlight"><pre><span></span><span class="cp"><?xml version="1.0" encoding="UTF-8"?></span>
<span class="nt"><ows:ExceptionReport</span> <span class="na">xmlns:ows=</span><span class="s">"http://www.opengis.net/ows/1.1"</span> <span class="na">xmlns:xsi=</span><span class="s">"http://www.w3.org/2001/XMLSchema-instance"</span> <span class="na">xsi:schemaLocation=</span><span class="s">"http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd"</span> <span class="na">version=</span><span class="s">"1.0.0"</span><span class="nt">></span>
<span class="nt"><ows:Exception</span> <span class="na">exceptionCode=</span><span class="s">"MissingParameterValue"</span> <span class="na">locator=</span><span class="s">"service"</span><span class="nt">></span>
<span class="nt"><ows:ExceptionText></span>service<span class="nt"></ows:ExceptionText></span>
<span class="nt"></ows:Exception></span>
<span class="nt"></ows:ExceptionReport></span>
</pre></div>
</div>
<p>The server responded with the <a class="reference internal" href="exceptions.html#pywps.exceptions.MissingParameterValue" title="pywps.exceptions.MissingParameterValue"><code class="xref py py-class docutils literal"><span class="pre">pywps.exceptions.MissingParameterValue</span></code></a>
exception, telling us that the parameter <cite>service</cite> was not set. This is
compliant with the OGC WPS standard, since each request mast have at least the
<cite>service</cite> and <cite>request</cite> parameters. We can say for now, that this PyWPS
instance is properly deployed on the server, since it returns proper exception
report.</p>
<p>We now have to configure the instance by editing the <cite>pywps.cfg</cite> file and adding
some processes.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo">
<a href="index.html">
<img class="logo" src="_static/pywps.png" alt="Logo"/>
</a>
</p>
<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="wps.html">OGC Web Processing Service (OGC WPS)</a></li>
<li class="toctree-l1"><a class="reference internal" href="pywps.html">PyWPS</a></li>
<li class="toctree-l1"><a class="reference internal" href="install.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="configuration.html">Configuration</a></li>
<li class="toctree-l1"><a class="reference internal" href="process.html">Processes</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Deployment to a production server</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#deploying-an-individual-pywps-instance">Deploying an individual PyWPS instance</a></li>
<li class="toctree-l2"><a class="reference internal" href="#creating-a-pywps-wsgi-instance">Creating a PyWPS <cite>WSGI</cite> instance</a></li>
<li class="toctree-l2"><a class="reference internal" href="#deployment-on-apache2-httpd-server">Deployment on Apache2 httpd server</a></li>
<li class="toctree-l2"><a class="reference internal" href="#deployment-on-nginx">Deployment on nginx</a></li>
<li class="toctree-l2"><a class="reference internal" href="#testing-the-deployment-of-a-pywps-instance">Testing the deployment of a PyWPS instance</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="migration.html">Migrating from PyWPS 3.x to 4.x</a></li>
<li class="toctree-l1"><a class="reference internal" href="external-tools.html">PyWPS and external tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">PyWPS API Doc</a></li>
<li class="toctree-l1"><a class="reference internal" href="development.html">Developers Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="exceptions.html">Exceptions</a></li>
</ul>
<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="footer">
©Copyright (C) 2014-2016 PyWPS Development Team, represented by Jachym Cepicky.This work is licensed under a Creative Commons Attribution 4.0 International License.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.7</a>
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
|
<a href="_sources/deployment.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>
|