blob: 7eaebd389aa0407bb1cb2d79cc5b8fab87f4fd18 [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
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010011 Compilation
12---------------
13
William Dauchyfcae4b62020-08-01 16:28:52 +020014The server currently supports Lua and Python. Type "make" with the options:
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010015USE_LUA=1 and/or USE_PYTHON=1.
16
17
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010018 Start the service
19---------------------
20
21After you have compiled it, to start the service, you just need to use "spoa"
22binary:
23
24 $> ./spoa -h
25 Usage: ./spoa [-h] [-d] [-p <port>] [-n <num-workers>]
26 -h Print this message
27 -d Enable the debug mode
28 -p <port> Specify the port to listen on (default: 12345)
29 -n <num-workers> Specify the number of workers (default: 5)
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010030 -f <file> Load script according with the supported languages
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010031
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010032The file processor is recognized using the extension. .lua or .luac for lua and
33.py for python. Start example:
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010034
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010035 $> ./spoa -d -f ps_lua.lua
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010036
Daniel Corbettc8029212019-06-11 10:08:53 -040037 $> ./spoa -d -f ps_python.py
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010038
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010039
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010040 Configure
41-------------
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010042
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010043Sample configuration are join to this server:
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010044
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010045 spoa-server.conf : The HAProxy configuration file using SPOE server
46 spoa-server.spoe.conf : The SPOP description file used by HAProxy
47 ps_lua.lua : Processing Lua example
48 ps_python.py : Processing Python example
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010049
50
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010051 Considerations
52------------------
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010053
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010054This server is a beta version. It works fine, but some improvement will be
55welcome:
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010056
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010057Main process:
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010058
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010059 * Improve log management: Today the log are sent on stdout.
60 * Improve process management: The dead process are ignored.
61 * Implement systemd integration.
62 * Implement threads: It would be fine to implement thread working. Shared
63 memory is welcome for managing database connection pool and something like
64 that.
65 * Add PHP support and some other languages.
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010066
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010067Python:
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010068
Ilya Shipitsine011bc32020-03-14 17:47:28 +050069 * Improve reporting: Catch python error message and report it in the right
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010070 place. Today the error are dumped on stdout. How using syslog for logging
71 stack traces ?
Thierry FOURNIERd8b5c772018-02-23 11:40:03 +010072
Thierry FOURNIER4d7bfa12018-02-25 21:28:05 +010073Maybe some other things...