[659] | 1 | .. _kernel_config: |
---|
| 2 | |
---|
| 3 | ZOO-Kernel configuration |
---|
[713] | 4 | ======================== |
---|
[659] | 5 | |
---|
| 6 | Main configuration file |
---|
| 7 | ----------------------- |
---|
| 8 | |
---|
| 9 | ZOO-Kernel general settings are defined in a configuration file called |
---|
| 10 | ``main.cfg``. This file is stored in the same directory as ZOO-Kernel |
---|
| 11 | (``/usr/lib/cgi-bin/`` in most cases). It provides usefull metadata information on your ZOO-Kernel installation. |
---|
| 12 | |
---|
| 13 | .. warning:: |
---|
| 14 | ZOO-Kernel (``/usr/lib/cgi-bin/zoo_loader.cgi``) and its |
---|
| 15 | configuration file (``/usr/lib/cgi-bin/main.cfg``) must be in the |
---|
| 16 | same directory. |
---|
| 17 | |
---|
| 18 | .. note:: |
---|
| 19 | Information contained by ``/usr/lib/cgi-bin/main.cfg`` is accessible from WPS Services at runtime, so when *Execute* requests are used. |
---|
| 20 | |
---|
| 21 | Default main.cfg |
---|
| 22 | ............................... |
---|
| 23 | |
---|
| 24 | An example *main.cfg* file is given here as reference. |
---|
| 25 | |
---|
| 26 | .. code-block:: guess |
---|
| 27 | :linenos: |
---|
| 28 | |
---|
| 29 | [headers] |
---|
| 30 | X-Powered-By=ZOO@ZOO-Project |
---|
| 31 | |
---|
| 32 | [main] |
---|
| 33 | version=1.0.0 |
---|
| 34 | encoding=utf-8 |
---|
| 35 | dataPath=/var/data |
---|
| 36 | tmpPath=/var/www/temp |
---|
| 37 | cacheDir=/var/www/cache |
---|
| 38 | sessPath=/tmp |
---|
| 39 | serverAddress=http://localhost/cgi-bin/zoo_loader.cgi |
---|
| 40 | lang=fr-FR,ja-JP |
---|
| 41 | language=en-US |
---|
| 42 | mapserverAddress=http://localhost/cgi-bin/mapserv.cgi |
---|
| 43 | msOgcVersion=1.0.0 |
---|
| 44 | tmpUrl=http:/localhost/temp/ |
---|
| 45 | |
---|
| 46 | [identification] |
---|
| 47 | keywords=t,ZOO-Project, ZOO-Kernel,WPS,GIS |
---|
| 48 | title=ZOO-Project demo instance |
---|
| 49 | abstract= This is ZOO-Project, the Open WPS platform. |
---|
| 50 | accessConstraints=none |
---|
| 51 | fees=None |
---|
| 52 | |
---|
| 53 | [provider] |
---|
| 54 | positionName=Developer |
---|
| 55 | providerName=GeoLabs SARL |
---|
| 56 | addressAdministrativeArea=False |
---|
| 57 | addressDeliveryPoint=1280, avenue des Platanes |
---|
| 58 | addressCountry=fr |
---|
| 59 | phoneVoice=+33467430995 |
---|
| 60 | addressPostalCode=34970 |
---|
| 61 | role=Dev |
---|
| 62 | providerSite=http://geolabs.fr |
---|
| 63 | phoneFacsimile=False |
---|
| 64 | addressElectronicMailAddress=gerald@geolabs.fr |
---|
| 65 | addressCity=Lattes |
---|
| 66 | individualName=Gerald FENOY |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | Main section |
---|
| 70 | ............................... |
---|
| 71 | |
---|
| 72 | The main.cfg ``[main]`` section parameters are explained bellow. |
---|
| 73 | |
---|
| 74 | * ``version``: Supported WPS version. |
---|
| 75 | * ``encoding``: Default encoding of WPS Responses. |
---|
| 76 | * ``dataPath``: Path to the directory where data files are stored (used to store mapfiles and data when MapServer support is activated). |
---|
| 77 | * ``tmpPath``: Path to the directory where temporary files are stored (such as *ExecuteResponse* when *storeExecuteResponse* is set to true). |
---|
| 78 | * ``cacheDir``: Path to the directory where cached request files [#f1]_ are stored (optional). |
---|
| 79 | * ``serverAddress``: URL to the ZOO-Kernel instance. |
---|
| 80 | * ``tmpUrl``: URL of the temporary files directory. |
---|
| 81 | * ``mapservAddress``: URL to the MapServer instance (optional). |
---|
| 82 | * ``msOgcVersion``: Version of all supported OGC Web Services output [#f2]_ |
---|
| 83 | (optional). |
---|
| 84 | * ``lang``: Supported natural languages separated by a coma (the first is the default one), |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | Identification and Provider |
---|
| 88 | .......................................... |
---|
| 89 | |
---|
| 90 | The ``[identification]`` and ``[provider]`` sections are not ZOO-Project |
---|
| 91 | specific. They provide OGC metadata [#f3]_ and should be set according |
---|
| 92 | to the `XML Schema Document |
---|
| 93 | <http://schemas.opengis.net/ows/1.1.0/ows19115subset.xsd>`__ which |
---|
| 94 | encodes the parts of ISO 19115 used by the common |
---|
| 95 | *ServiceIdentification* and *ServiceProvider* sections of the |
---|
| 96 | *GetCapabilities* operation response, known as the service metadata |
---|
| 97 | XML document. |
---|
| 98 | |
---|
| 99 | Details of the common OWS 1.1.0 *ServiceIdentification* section can be |
---|
| 100 | found in this `XML Schema Document |
---|
| 101 | <http://schemas.opengis.net/ows/1.1.0/owsServiceIdentification.xsd>`__. |
---|
| 102 | |
---|
| 103 | Details of the common OWS 1.1.0 *ServiceProvider* section can be |
---|
| 104 | found in this `XML Schema Document |
---|
| 105 | <http://schemas.opengis.net/ows/1.1.0/owsServiceProvider.xsd>`__. |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | Additional sections |
---|
| 109 | -------------------------------- |
---|
| 110 | |
---|
| 111 | Headers section |
---|
| 112 | ............................... |
---|
| 113 | |
---|
| 114 | The ``[headers]`` section can be set in order to define a specific HTTP |
---|
| 115 | Response header, which will be used for every response. As an example, |
---|
| 116 | you can check http://zoo-project.org using *curl* command line tool |
---|
| 117 | and notice the specific header *X-Powered-By: Zoo-Project@Trac*. |
---|
| 118 | |
---|
| 119 | env section |
---|
| 120 | ............................... |
---|
| 121 | |
---|
| 122 | The ``[env]`` section can be used to store specific environment |
---|
| 123 | variables to be set prior the loading of *Services Provider* and Service execution. |
---|
| 124 | |
---|
| 125 | A typical example is when a Service requires the access to a X server |
---|
| 126 | running on *framebuffer*, which takes to set the DISPLAY environnement |
---|
| 127 | variable, as follow: |
---|
| 128 | |
---|
| 129 | .. code-block:: guess |
---|
| 130 | :linenos: |
---|
| 131 | |
---|
| 132 | [env] |
---|
| 133 | DISPLAY=:1 |
---|
| 134 | |
---|
| 135 | lenv section |
---|
| 136 | ............................... |
---|
| 137 | |
---|
| 138 | The ``lenv`` can be used to store runtime informations automatically |
---|
| 139 | set by ZOO-Kernel before and during the execution of a WPS service, |
---|
| 140 | with the following parameters: |
---|
| 141 | |
---|
| 142 | * ``sid`` (r): The WPS Service unique identifier, |
---|
| 143 | * ``status`` (rw): The current progress value ( a value between 0 and |
---|
| 144 | 100 in percent (**%**) ), |
---|
| 145 | * ``cwd`` (r): The current working directory of ZOO-Kernel, |
---|
| 146 | * ``message`` (rw): An error message used when ``SERVICE_FAILED`` is returned (optional), |
---|
| 147 | * ``cookie`` (rw): The cookie to be returned to the client (for |
---|
| 148 | example for authentication purpose). |
---|
| 149 | |
---|
| 150 | senv section |
---|
| 151 | ............................... |
---|
| 152 | |
---|
| 153 | The ``senv`` section can be used to store sessions information on the |
---|
| 154 | server side. Such information can then be accessed automatically from |
---|
| 155 | the Service if the server is requested using a valid cookie (as |
---|
| 156 | defined in ``lenv`` section). ZOO-Kernel will store the values set in the |
---|
| 157 | ``senv`` maps on disk, load it and dynamically replace its content to |
---|
| 158 | the one in the ``main.cfg``. The ``senv`` section must contain the |
---|
| 159 | following parameter at least: |
---|
| 160 | |
---|
| 161 | * ``XXX``: The session unique identifier where ``XXX`` is the name |
---|
| 162 | included in the cookie which is returned. |
---|
| 163 | |
---|
| 164 | .. _cookie_example: |
---|
| 165 | |
---|
| 166 | For instance, adding the following in the Service source code : |
---|
| 167 | |
---|
[713] | 168 | .. code:: python |
---|
[659] | 169 | |
---|
| 170 | conf["lenv"]["cookie"]="XXX=XXX1000000; path=/" |
---|
| 171 | conf["senv"]={"XXX": "XXX1000000","login": "demoUser"} |
---|
| 172 | |
---|
| 173 | means that ZOO-Kernel will create a file named ``sess_XXX1000000.cfg`` |
---|
| 174 | in the ``cacheDir`` directory, and will return the specified cookie to the client. Each time the client will |
---|
| 175 | request ZOO-Kernel using this cookie, it will automatically load the |
---|
[683] | 176 | value stored before the Service execution. |
---|
[659] | 177 | |
---|
[713] | 178 | .. _zoo_activate_db_backend: |
---|
[659] | 179 | |
---|
[713] | 180 | Database section |
---|
[683] | 181 | ............................... |
---|
| 182 | |
---|
[713] | 183 | The database section allows to configure the |
---|
| 184 | :ref:`ZOO-Kernel optional database support <zoo_install_db_backend>`. |
---|
[683] | 185 | |
---|
[697] | 186 | .. code-block:: guess |
---|
[683] | 187 | |
---|
[697] | 188 | [database] |
---|
| 189 | dbname=zoo_project |
---|
| 190 | port=5432 |
---|
| 191 | user=username |
---|
| 192 | host=127.0.0.1 |
---|
| 193 | type=PG |
---|
| 194 | schema=public |
---|
[683] | 195 | |
---|
[713] | 196 | This will generate strings to be passed to GDAL to connect the |
---|
| 197 | database server: |
---|
[697] | 198 | |
---|
[713] | 199 | .. code-block:: guess |
---|
[710] | 200 | |
---|
[713] | 201 | <type>:host=<host> port=<port> user=<user> dbname=<dbname> |
---|
[710] | 202 | |
---|
| 203 | |
---|
[713] | 204 | With the previous database section, it will give the following: |
---|
[710] | 205 | |
---|
[713] | 206 | .. code-block:: guess |
---|
| 207 | |
---|
| 208 | PG:"dbname=zoo_project host=127.0.0.1 port=5432 user=username" |
---|
| 209 | |
---|
| 210 | .. _zoo_create_db_backend: |
---|
| 211 | |
---|
| 212 | To create a new database to be used by the ZOO-Kernel, you have |
---|
| 213 | to load the `schema.sql |
---|
| 214 | <http://zoo-project.org/trac/browser/trunk/zoo-project/zoo-kernel/sql/schema.sql>`_ |
---|
| 215 | file. For instance, you may run the following: |
---|
| 216 | |
---|
| 217 | .. code:: |
---|
| 218 | |
---|
| 219 | createdb zoo_project |
---|
| 220 | psql zoo_project -f zoo-project/zoo-kernel/sql/schema.sql |
---|
| 221 | |
---|
| 222 | .. note:: |
---|
| 223 | You can choose another schema to store ZOO-Kernel specific |
---|
| 224 | informations. In such a case, you would need to edit the |
---|
| 225 | schema.sql file to uncomment line `33 |
---|
| 226 | <http://zoo-project.org/trac/browser/trunk/zoo-project/zoo-kernel/sql/schema.sql#L33>`_ |
---|
| 227 | and `34 |
---|
| 228 | <http://zoo-project.org/trac/browser/trunk/zoo-project/zoo-kernel/sql/schema.sql#L34>`_. |
---|
| 229 | |
---|
| 230 | |
---|
| 231 | |
---|
[710] | 232 | |
---|
[659] | 233 | .. rubric:: Footnotes |
---|
| 234 | |
---|
[697] | 235 | .. [#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. |
---|
[659] | 236 | .. [#f2] Usefull when the :ref:`kernel-mapserver` is activated (available since ZOO-Project version 1.3.0). |
---|
[697] | 237 | .. [#f3] ZOO-Kernel and MapServer are sharing the same metadata for OGC Web Services if the :ref:`kernel-mapserver` is activated. |
---|
[659] | 238 | |
---|
| 239 | |
---|