source: trunk/docs/kernel/configuration.rst @ 944

Last change on this file since 944 was 944, checked in by djay, 5 years ago

Fix #172 and add the documentation on how to use the curl section to define cainfo.

  • Property svn:keywords set to Date Author
  • Property svn:mime-type set to text/plain
File size: 14.5 KB
Line 
1
2.. _kernel_config:
3
4ZOO-Kernel configuration
5========================
6
7Main configuration file
8-----------------------
9
10ZOO-Kernel general settings are defined in a configuration file called
11``main.cfg``. This file is stored in the same directory as ZOO-Kernel
12(``/usr/lib/cgi-bin/`` in most cases). It provides usefull metadata information on your ZOO-Kernel installation.     
13
14.. warning::
15  ZOO-Kernel (``/usr/lib/cgi-bin/zoo_loader.cgi``) and its
16  configuration file (``/usr/lib/cgi-bin/main.cfg``) must be in the
17  same directory.
18 
19.. note::
20  Information contained by ``/usr/lib/cgi-bin/main.cfg`` is accessible from WPS Services at runtime, so when *Execute* requests are used.
21
22Default main.cfg
23...............................
24
25An example *main.cfg* file is given here as reference.
26
27.. code-block:: guess
28    :linenos:
29   
30    [headers]
31    X-Powered-By=ZOO@ZOO-Project
32   
33    [main]
34    version=1.0.0
35    encoding=utf-8
36    dataPath=/var/data
37    tmpPath=/var/www/temp
38    cacheDir=/var/www/cache
39    sessPath=/tmp
40    serverAddress=http://localhost/cgi-bin/zoo_loader.cgi
41    lang=fr-FR,ja-JP
42    language=en-US
43    mapserverAddress=http://localhost/cgi-bin/mapserv.cgi
44    msOgcVersion=1.0.0
45    tmpUrl=http:/localhost/temp/
46    cors=false
47   
48    [identification]
49    keywords=t,ZOO-Project, ZOO-Kernel,WPS,GIS
50    title=ZOO-Project demo instance
51    abstract= This is ZOO-Project, the Open WPS platform.
52    accessConstraints=none
53    fees=None
54   
55    [provider]
56    positionName=Developer
57    providerName=GeoLabs SARL
58    addressAdministrativeArea=False
59    addressDeliveryPoint=1280, avenue des Platanes
60    addressCountry=fr
61    phoneVoice=+33467430995
62    addressPostalCode=34970
63    role=Dev
64    providerSite=http://geolabs.fr
65    phoneFacsimile=False
66    addressElectronicMailAddress=gerald@geolabs.fr
67    addressCity=Lattes
68    individualName=Gerald FENOY
69
70
71Main section
72...............................
73
74The main.cfg ``[main]`` section parameters are explained bellow.
75
76 * ``version``: Supported WPS version.
77 * ``encoding``: Default encoding of WPS Responses.
78 * ``dataPath``: Path to the directory where data files are stored (used to store mapfiles and data when MapServer support is activated).
79 * ``tmpPath``: Path to the directory where temporary files are stored (such as *ExecuteResponse* when *storeExecuteResponse* is set to true).
80 * ``tmpUrl``: URL to access the temporary files directory (cf. ``tmpPath``).
81 * ``cacheDir``: Path to  the directory where cached request files [#f1]_ are stored (optional).
82 * ``serverAddress``: URL to the ZOO-Kernel instance.
83 * ``mapservAddress``: URL to the MapServer instance (optional).
84 * ``msOgcVersion``: Version of all supported OGC Web Services output [#f2]_
85   (optional).
86 * ``lang``: Supported natural languages separated by a coma (the first is the default one),
87 * ``cors``: Define if the ZOO-Kernel should support `Cross-Origin
88   Resource Sharing <https://www.w3.org/TR/cors/>`__. If this
89   parameter is not defined, then the ZOO-Kernel won't support CORS.
90 * ``servicePath``: Define a specific location to search for services
91   rather than using the ZOO-Kernel directory. If this parameter is
92   not defined, then the ZOO-Kernel will search for services using its
93   directory.
94 * ``libPath``: (Optional) Path to a directory where the ZOO-kernel should search for
95   service providers, e.g., shared libraries with service implementations
96   (the ``serviceProvider`` parameter in the service configuration (.zcfg) file).   
97 * ``memory``: (Optional) can take the value ``load`` to ensure that
98   the value field of the inputs data will be filled by the ZOO-Kernel
99   or ``protected`` to have only the ``cache_file`` filled.
100
101
102.. warning::
103  The ``libPath`` parameter is currently only recognized by services implemented
104  in C/C++ or PHP, and may be moved to another section in future versions.
105
106
107.. warning::
108  Depending on the ``memory`` parameter the WPS Service will receive
109  different fields (``value`` or ``cache_file``).
110   
111In case you have activated the MapServer support, please refer to
112:ref:`this specific section <kernel-mapserver-main.cfg>`.
113
114
115Identification and Provider
116..........................................
117
118The ``[identification]`` and ``[provider]`` sections are not ZOO-Project
119specific. They provide OGC metadata [#f3]_ and should be set according
120to the `XML Schema Document
121<http://schemas.opengis.net/ows/1.1.0/ows19115subset.xsd>`__ which
122encodes the parts of ISO 19115 used by the common
123*ServiceIdentification* and *ServiceProvider* sections of the
124*GetCapabilities* operation response, known as the service metadata
125XML document.
126
127Details of the common OWS 1.1.0 *ServiceIdentification* section can be
128found in this `XML Schema Document
129<http://schemas.opengis.net/ows/1.1.0/owsServiceIdentification.xsd>`__.
130
131Details of the common OWS 1.1.0 *ServiceProvider* section can be
132found in this `XML Schema Document
133<http://schemas.opengis.net/ows/1.1.0/owsServiceProvider.xsd>`__.
134
135
136Additional sections
137--------------------------------
138
139All the additional sections discribed in the following section are
140optional.
141
142Headers section
143...............................
144
145The ``[headers]`` section can be set in order to define a specific HTTP
146Response header, which will be used for every response. As an example,
147you can check http://zoo-project.org using *curl* command line tool
148and notice the specific header *X-Powered-By: Zoo-Project@Trac*.
149
150In case you want to allow CORS support for POST requests coming from
151``myhost.net``, then you should define the following minimal
152parameters in this section:
153
154.. code-block:: guess
155    :linenos:
156   
157    Access-Control-Allow-Origin=myhost.net
158    Access-Control-Allow-Methods=POST
159    Access-Control-Allow-Headers=content-type
160
161curl section
162...............................
163
164The `[curl]` section is used on windows platform to specify, using the
165`cainfo` parameter, where is located the
166`cacert.pem <https://curl.haxx.se/docs/caextract.html>`__ file on your
167machine. An example bellow is provided to illustrate sur a setting.
168
169.. code-block:: guess
170    :linenos:
171   
172    [curl]
173    cainfo=./cacert.pem
174
175
176
177env section
178...............................
179
180The ``[env]`` section can be used to store specific environment
181variables to be set prior the loading of *Services Provider* and Service execution.
182
183A typical example is when a Service requires the access to a X server
184running on *framebuffer*, which takes to set the DISPLAY environnement
185variable, as follow:
186
187.. code-block:: guess
188    :linenos:
189   
190    [env]
191    DISPLAY=:1
192
193In case you have activated the OTB support, please refer to :ref:`this
194specific section <kernel-orfeotoolbox-main.cfg>`.
195
196lenv section
197...............................
198
199The ``lenv`` section is used by the ZOO-Kernel to store runtime informations
200before the execution of a WPS service, it contains the following
201parameters:
202
203 * ``sid`` (r): The WPS Service unique identifier,
204 * ``status`` (rw): The current progress value ( a value between 0 and
205   100 in percent (**%**) ),
206 * ``cwd`` (r): The current working directory of ZOO-Kernel,
207 * ``message`` (rw): An error message used when ``SERVICE_FAILED`` is returned (optional),
208 * ``cookie`` (rw): The cookie to be returned to the client (for
209   example for authentication purpose).
210 * ``file.pid`` (r): The file used by the ZOO-Kernel to store process identifier.
211 * ``file.sid`` (r): The file used by the ZOO-Kernel to store service identifier.
212 * ``file.responseInit`` (r): The file used by the ZOO-Kernel to store
213   the initial (then final) WPS response.
214 * ``file.responseFinal`` (r): The file used by the ZOO-Kernel to
215   temporary store the final WPS response.
216
217renv section
218...............................
219
220The ``renv`` section is automatically created by the ZOO-Kernel before
221the execution of a WPS service, it contains all the environment
222variables available at runtime (so including the header fields in case
223it is used through http, refer to [https://tools.ietf.org/html/rfc3875
224rfc3875] for more details).
225
226
227senv section
228...............................
229
230The ``senv`` section can be used to store sessions information on the
231server side. Such information can then be accessed automatically from
232the Service if the server is requested using a valid cookie (as
233defined in ``lenv`` section). ZOO-Kernel will store the values set in the
234``senv`` maps on disk, load it and dynamically replace its content to
235the one in the ``main.cfg``. The ``senv`` section must contain the
236following parameter at least:
237
238 * ``XXX``: The session unique identifier where ``XXX`` is the name
239   included in the cookie which is returned.
240
241.. _cookie_example:
242
243For instance, adding the following in the Service source code  :
244
245.. code:: python
246   
247    conf["lenv"]["cookie"]="XXX=XXX1000000; path=/"
248    conf["senv"]={"XXX": "XXX1000000","login": "demoUser"}
249
250means that ZOO-Kernel will create a file named ``sess_XXX1000000.cfg``
251in the ``cacheDir`` directory, and will return the specified cookie to the client. Each time the client will
252request ZOO-Kernel using this cookie, it will automatically load the
253value stored before the Service execution.
254
255Security section
256...............................
257
258The ``[security]`` section can be used to define what headers, the
259ZOO-Kernel has initially received in the request, should be passed
260to other servers for accessing resources (such as WMS, WFS, WCS
261or any other file passed as a reference). This section contains two
262parameters:
263
264 * ``attributes``: The header to pass to other servers (such as
265   Authorization, Cookie, User-Agent ...),
266 * ``hosts``: The host for wich the restriction apply (can be "*" to
267   forward header to every server or a coma separated list of host
268   names, domain, IP).
269
270Both parameters are mandatory.
271
272Suppose you need to share Authorization, Cookie and User-Agent to
273every server for accessing ressources, then yo ucan use the following
274section definition:
275
276.. code::
277
278    [security]
279    attributes=Authorization,Cookie,User-Agent
280    hosts=*
281
282In case only local servers require such header forwarding, you may use
283the following definition:
284
285.. code::
286
287    [security]
288    attributes=Authorization,Cookie,User-Agent
289    hosts=localhost,127.0.0.1
290
291Optionaly, you can also define the shared url(s), meaning that even if
292the ressource requires authentication to be accessed, this
293authentifcation won't be used to define the name for storing the
294file. Hence, two user with different authentication will use the same
295file as it is considerated as shared. You can find bellow a sample
296security section containing the shared parameter. In this example,
297every requests to access the coverage using the url defined in the
298shared parameter (``myHost/cgi-bin/WCS_Server``) will be shared
299between users.
300
301.. code::
302
303    [security]
304    attributes=Authorization,Cookie,User-Agent
305    hosts=localhost,127.0.0.1
306    shared=myHost/cgi-bin/WCS_Server
307
308.. _zoo_activate_db_backend:
309
310Database section
311...............................
312
313The database section allows to configure the
314:ref:`ZOO-Kernel optional database support <zoo_install_db_backend>`.
315
316.. code-block:: guess
317
318        [database]
319        dbname=zoo_project
320        port=5432
321        user=username
322        host=127.0.0.1
323        type=PG
324        schema=public
325
326This will generate strings to be passed to GDAL to connect the
327database server:
328
329.. code-block:: guess
330   
331    <type>:host=<host> port=<port>  user=<user> dbname=<dbname>
332
333
334With the previous database section, it will give the following:
335
336.. code-block:: guess
337
338    PG:"dbname=zoo_project host=127.0.0.1 port=5432 user=username"
339
340Please refer to this `section <zoo_create_db_backend>`_ to learn how
341to setup the database.
342
343.. _zoo_activate_metadb:
344
345Metadb section
346...............................
347
348The metadb section allows to configure the ZOO-Kernel to access :ref:`the
349metadata information about WPS Services <zoo_create_metadb>` by using
350a PostgreSQL database in addition to the zcfg files.
351
352.. code-block:: guess
353
354        [metadb]
355        dbname=zoo_metadb
356        port=5432
357        user=username
358        host=127.0.0.1
359        type=PG
360
361This will generate strings to be passed to GDAL to connect the
362database server:
363
364.. code-block:: guess
365   
366    <type>:host=<host> port=<port>  user=<user> dbname=<dbname>
367
368
369With the previous database section, it will give the following:
370
371.. code-block:: guess
372
373    PG:"dbname=zoo_metadb host=127.0.0.1 port=5432 user=username"
374
375Please refer to this `section <zoo_create_metadb>`_ to learn how
376to setup the database.
377
378Include section
379...............................
380
381The ``[include]`` section (optional) lists explicitely a set of service configuration files
382the the ZOO-Kernel should parse, e.g.,
383
384
385.. code-block:: guess
386    :linenos:
387   
388    [include]
389    servicename1 = /my/service/repository/service1.zcfg
390    servicename2 = /my/service/repository/service2.zcfg
391
392The ``[include]`` section may be used to control which services are exposed to particular user groups.
393While service configuration files (.zcfg) may be located in a common repository or in arbitrary folders,
394main.cfg files at different URLs may include different subsets of services.
395
396When the ZOO-Kernel handles a request, it will first check if there is an ``[include]``
397section in main.cfg and then search for other .zcfg files in the current working directory (CWD) and
398subdirectories. If an included service happens to be located in a CWD (sub)directory,
399it will be published by its name in the ``[include]`` section. For example, the service
400``/[CWD]/name/space/myService.zcfg``
401would normally be published as name.space.myService, but if it is listed in the ``[include]`` section
402it will be published simply as myService:
403
404.. code-block:: guess
405    :linenos:
406   
407    [include]
408    myService =  /[CWD]/name/space/myService.zcfg
409
410On the other hand, with
411
412.. code-block:: guess
413    :linenos:
414   
415    [include]
416    myService =  /some/other/dir/myService.zcfg
417
418there would be two distinct services published as myService and name.space.myService, respectively,
419with two different zcfg files.
420
421.. note::
422  As currently implemented, the ZOO-Kernel searches the CWD for the library files of
423  included services if the ``libPath`` parameter is not set.
424
425     
426.. rubric:: Footnotes
427
428.. [#f1] If GET requests are passed through ``xlink:href`` to the ZOO-Kernel , the latter will execute the request the first time and store the result  on disk. The next time the same request is executed, the cached file will be used and this will make your process run much faster. If ``cachedir`` was not specified in the ``main.cfg`` then the ``tmpPath`` value will be used.
429.. [#f2] Usefull when the :ref:`kernel-mapserver` is activated (available since ZOO-Project version 1.3.0).
430.. [#f3] ZOO-Kernel and MapServer are sharing the same metadata for OGC Web Services if the :ref:`kernel-mapserver` is activated.
431
432   
Note: See TracBrowser for help on using the repository browser.

Search

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png