haproxy/contrib/spoa_server
Thierry FOURNIER 4d7bfa1cd1 MINOR/DOC: spoe-server: Add documentation
This is the documentation and examples.
2019-05-13 17:43:47 +02:00
..
Makefile MINOR: spoa-server: Add python 2019-05-13 17:43:47 +02:00
print_r.lua MINOR/DOC: spoe-server: Add documentation 2019-05-13 17:43:47 +02:00
ps_lua.c MINOR: spoa-server: Add Lua processing 2019-05-13 17:43:47 +02:00
ps_lua.lua MINOR/DOC: spoe-server: Add documentation 2019-05-13 17:43:47 +02:00
ps_python.c MINOR: spoa-server: Add python 2019-05-13 17:43:47 +02:00
ps_python.py MINOR/DOC: spoe-server: Add documentation 2019-05-13 17:43:47 +02:00
README MINOR/DOC: spoe-server: Add documentation 2019-05-13 17:43:47 +02:00
spoa-server.conf MINOR/DOC: spoe-server: Add documentation 2019-05-13 17:43:47 +02:00
spoa-server.spoe.conf MINOR/DOC: spoe-server: Add documentation 2019-05-13 17:43:47 +02:00
spoa.c MINOR: spoa-server: Execute registered callbacks 2019-05-13 17:43:47 +02:00
spoa.h MINOR: spoa-server: Prepare responses 2019-05-13 17:43:47 +02:00

Multi script langyage Stream Processing Offload Agent
-----------------------------------------------------

This agent receive SPOP message and process it with script languages. The
language register callback with a message. Each callback receive the list
of arguments with types according with the language capabilities. The
callback write variables which are sent as response when the processing
is done.


  Compilation
---------------

Actually, the server support Lua and Python. Type "make" with the options:
USE_LUA=1 and/or USE_PYTHON=1.


  Start the service
---------------------

After you have compiled it, to start the service, you just need to use "spoa"
binary:

    $> ./spoa  -h
    Usage: ./spoa [-h] [-d] [-p <port>] [-n <num-workers>]
        -h                  Print this message
        -d                  Enable the debug mode
        -p <port>           Specify the port to listen on (default: 12345)
        -n <num-workers>    Specify the number of workers (default: 5)
        -f <file>           Load script according with the supported languages

The file processor is recognized using the extension. .lua or .luac for lua and
.py for python. Start example:

    $> ./spoa -d -f ps_lua.lua

	 $> ./spoa -d -f ps_pyhton.py


  Configure
-------------

Sample configuration are join to this server:

  spoa-server.conf      : The HAProxy configuration file using SPOE server
  spoa-server.spoe.conf : The SPOP description file used by HAProxy
  ps_lua.lua            : Processing Lua example
  ps_python.py          : Processing Python example


  Considerations
------------------

This server is a beta version. It works fine, but some improvement will be
welcome:

Main process:

 * Improve log management: Today the log are sent on stdout.
 * Improve process management: The dead process are ignored.
 * Implement systemd integration.
 * Implement threads: It would be fine to implement thread working. Shared
   memory is welcome for managing database connection pool and something like
   that.
 * Add PHP support and some other languages.

Python:

 * Improve repporting: Catch python error message and repport it in the right
   place. Today the error are dumped on stdout. How using syslog for logging
   stack traces ?

Maybe some other things...