blob: fa039c1afcab221a677f9a300b45e8837baa887f [file] [log] [blame]
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +01001Multi script langyage Stream Processing Offload Agent
2-----------------------------------------------------
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +01003
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +01004This agent receive SPOP message and process it with script languages. The
5language register callback with a message. Each callback receive the list
6of arguments with types according with the language capabilities. The
7callback write variables which are sent as response when the processing
8is done.
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +01009
10
Aleksandar Lazica7144752019-07-03 08:16:17 +000011 Prerequirement
12----------------
13
14You have to install the development packages, either from the
15distribution repositories or from the source.
16
17CentOS/RHEL: yum install python-devel
18
19The current python version in use is 2.7.
20
21
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010022 Compilation
23---------------
24
25Actually, the server support Lua and Python. Type "make" with the options:
26USE_LUA=1 and/or USE_PYTHON=1.
27
Aleksandar Lazica7144752019-07-03 08:16:17 +000028You can add LUA_INC=.. LUA_LIB=.. to the make command to set the paths to
29the lua header files and lua libraries.
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010030
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010031 Start the service
32---------------------
33
34After you have compiled it, to start the service, you just need to use "spoa"
35binary:
36
37 $> ./spoa -h
38 Usage: ./spoa [-h] [-d] [-p <port>] [-n <num-workers>]
39 -h Print this message
40 -d Enable the debug mode
41 -p <port> Specify the port to listen on (default: 12345)
42 -n <num-workers> Specify the number of workers (default: 5)
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010043 -f <file> Load script according with the supported languages
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010044
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010045The file processor is recognized using the extension. .lua or .luac for lua and
46.py for python. Start example:
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010047
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010048 $> ./spoa -d -f ps_lua.lua
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010049
Daniel Corbettc8029212019-06-11 10:08:53 -040050 $> ./spoa -d -f ps_python.py
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010051
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010052
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010053 Configure
54-------------
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010055
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010056Sample configuration are join to this server:
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010057
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010058 spoa-server.conf : The HAProxy configuration file using SPOE server
59 spoa-server.spoe.conf : The SPOP description file used by HAProxy
60 ps_lua.lua : Processing Lua example
61 ps_python.py : Processing Python example
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010062
63
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010064 Considerations
65------------------
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010066
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010067This server is a beta version. It works fine, but some improvement will be
68welcome:
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010069
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010070Main process:
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010071
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010072 * Improve log management: Today the log are sent on stdout.
73 * Improve process management: The dead process are ignored.
74 * Implement systemd integration.
75 * Implement threads: It would be fine to implement thread working. Shared
76 memory is welcome for managing database connection pool and something like
77 that.
78 * Add PHP support and some other languages.
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010079
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010080Python:
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010081
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010082 * Improve repporting: Catch python error message and repport it in the right
83 place. Today the error are dumped on stdout. How using syslog for logging
84 stack traces ?
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010085
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010086Maybe some other things...