| 1 |
============================== |
| 2 |
Installing Cyborg API via WSGI |
| 3 |
============================== |
| 4 |
|
| 5 |
Cyborg-api service can be run either as a Python command that runs a web serve |
| 6 |
or As a WSGI application hosted by uwsgi. This document is a guide to deploy |
| 7 |
cyborg-api using uwsgi. In devstack, uwsgi is used by default for development. |
| 8 |
|
| 9 |
WSGI Application |
| 10 |
---------------- |
| 11 |
|
| 12 |
The function ``cyborg.api.wsgi_app.init_application`` will setup a WSGI |
| 13 |
application to run behind uwsgi. |
| 14 |
|
| 15 |
Cyborg API behind uwsgi |
| 16 |
----------------------- |
| 17 |
|
| 18 |
Create a ``cyborg-api-uwsgi`` file with content below: |
| 19 |
|
| 20 |
.. code-block:: ini |
| 21 |
|
| 22 |
[uwsgi] |
| 23 |
chmod-socket = 666 |
| 24 |
socket = /var/run/uwsgi/cyborg-wsgi-api.socket |
| 25 |
lazy-apps = true |
| 26 |
add-header = Connection: close |
| 27 |
buffer-size = 65535 |
| 28 |
hook-master-start = unix_signal:15 gracefully_kill_them_all |
| 29 |
thunder-lock = true |
| 30 |
plugins = python |
| 31 |
enable-threads = true |
| 32 |
worker-reload-mercy = 90 |
| 33 |
exit-on-reload = false |
| 34 |
die-on-term = true |
| 35 |
master = true |
| 36 |
processes = 2 |
| 37 |
wsgi-file = /usr/local/bin/cyborg-wsgi-api |
| 38 |
|
| 39 |
.. end |
| 40 |
|
| 41 |
Start cyborg-api: |
| 42 |
|
| 43 |
.. code-block:: console |
| 44 |
|
| 45 |
# uwsgi --ini /etc/cyborg/cyborg-api-uwsgi.ini |
| 46 |
|
| 47 |
.. end |