2016-03-15 16:57:26 +01:00
|
|
|
.. _topics-start-server:
|
|
|
|
|
|
|
|
|
|
=======================
|
|
|
|
|
How to start the server
|
|
|
|
|
=======================
|
|
|
|
|
|
|
|
|
|
Web service
|
|
|
|
|
===========
|
|
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
You can start the default web server bundled in ``trytond`` with this command
|
|
|
|
|
line:
|
2016-03-15 16:57:26 +01:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
|
|
$ trytond -c <config file>
|
2016-03-15 16:57:26 +01:00
|
|
|
|
|
|
|
|
The server will wait for client connections on the interface defined in the
|
2020-11-29 11:35:29 +00:00
|
|
|
``web`` section of the :ref:`configuration <topics-configuration>`.
|
2016-03-15 16:57:26 +01:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
When using multiple config files the order is important as last entered
|
|
|
|
|
files will override the items of first files
|
2016-08-22 11:28:25 +02:00
|
|
|
|
2021-11-20 00:11:56 +01:00
|
|
|
.. warning::
|
|
|
|
|
This runs the of `Werkzeug`_ development server which should not be used on
|
|
|
|
|
production systems.
|
|
|
|
|
|
|
|
|
|
.. _`Werkzeug`: https://werkzeug.palletsprojects.com/
|
|
|
|
|
|
2016-03-15 16:57:26 +01:00
|
|
|
WSGI server
|
|
|
|
|
-----------
|
|
|
|
|
|
|
|
|
|
If you prefer to run Tryton inside your own WSGI server instead of the simple
|
2022-04-06 18:19:49 +02:00
|
|
|
server of Werkzeug, you can use the application ``trytond.application.app``.
|
2017-07-19 10:10:04 +02:00
|
|
|
Following environment variables can be set:
|
|
|
|
|
|
2020-11-29 11:35:29 +00:00
|
|
|
* ``TRYTOND_CONFIG``: Point to :ref:`configuration <topics-configuration>`
|
|
|
|
|
file.
|
|
|
|
|
* ``TRYTOND_LOGGING_CONFIG``: Point to :ref:`logging <topics-logs>` file.
|
|
|
|
|
* ``TRYTOND_LOGGING_LEVEL``: An integer to set the default `logging level`_
|
|
|
|
|
(default: ``ERROR``).
|
|
|
|
|
* ``TRYTOND_COROUTINE``: Use coroutine for concurrency.
|
|
|
|
|
* ``TRYTOND_DATABASE_NAMES``: A list of database names in CSV format, using
|
2017-07-19 10:10:04 +02:00
|
|
|
python default dialect.
|
2016-03-15 16:57:26 +01:00
|
|
|
|
|
|
|
|
.. warning:: You must manage to serve the static files from the web root.
|
|
|
|
|
|
2020-02-13 18:02:05 +01:00
|
|
|
.. _`logging level`: https://docs.python.org/library/logging.html#logging-levels
|
2019-07-23 00:09:25 +02:00
|
|
|
|
2019-02-05 19:09:53 +01:00
|
|
|
Coroutine server
|
|
|
|
|
----------------
|
|
|
|
|
|
|
|
|
|
The Werkzeug server uses thread for concurrency. This is not optimal for the
|
|
|
|
|
long-polling request on the :ref:`bus <ref-bus>` as each client consumes
|
|
|
|
|
permanently one thread.
|
2020-11-29 11:35:29 +00:00
|
|
|
You can start the server with coroutine using the option ``--coroutine``.
|
2019-02-05 19:09:53 +01:00
|
|
|
|
2021-11-20 00:11:56 +01:00
|
|
|
.. note::
|
|
|
|
|
This will use the pure-Python, gevent-friendly `WSGI server
|
|
|
|
|
<http://www.gevent.org/api/gevent.pywsgi.html>`_.
|
|
|
|
|
|
2016-03-15 16:57:26 +01:00
|
|
|
Cron service
|
|
|
|
|
============
|
|
|
|
|
|
2019-04-12 15:59:25 +02:00
|
|
|
If you want to run some :ref:`scheduled actions <topics-cron>`, you must also
|
2022-03-27 16:06:09 +02:00
|
|
|
run the cron server with this command line:
|
2016-03-15 16:57:26 +01:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
|
|
$ trytond-cron -c <config file> -d <database>
|
2016-03-15 16:57:26 +01:00
|
|
|
|
|
|
|
|
The server will wake up every minutes and preform the scheduled actions defined
|
2020-11-29 11:35:29 +00:00
|
|
|
in the ``database``.
|
2020-07-25 08:03:02 +02:00
|
|
|
You can also launch the command every few minutes from a scheduler with the
|
2020-11-29 11:35:29 +00:00
|
|
|
option ``--once``.
|
2016-03-15 16:57:26 +01:00
|
|
|
|
2018-07-27 09:32:28 +02:00
|
|
|
Worker service
|
|
|
|
|
==============
|
|
|
|
|
|
|
|
|
|
If you want to use a pool of workers to run :ref:`asynchronously some tasks
|
2020-11-29 11:35:29 +00:00
|
|
|
<topics-task-queue>`, you must activate the worker in the ``queue`` section of
|
2018-07-27 09:32:28 +02:00
|
|
|
the :ref:`configuration <topics-configuration>` and run the worker manager with
|
2022-03-27 16:06:09 +02:00
|
|
|
this command line:
|
2018-07-27 09:32:28 +02:00
|
|
|
|
2022-03-27 16:06:09 +02:00
|
|
|
.. code-block:: console
|
|
|
|
|
|
|
|
|
|
$ trytond-worker -c <config file> -d <database>
|
2018-07-27 09:32:28 +02:00
|
|
|
|
|
|
|
|
The manager will dispatch tasks from the queue to a pool of worker processes.
|
|
|
|
|
|
2016-03-15 16:57:26 +01:00
|
|
|
Services options
|
|
|
|
|
================
|
|
|
|
|
|
2020-11-29 11:35:29 +00:00
|
|
|
You will find more options for those services by using ``--help`` arguments.
|