Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 1 | Multi script langyage Stream Processing Offload Agent |
| 2 | ----------------------------------------------------- |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 3 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 4 | This agent receive SPOP message and process it with script languages. The |
| 5 | language register callback with a message. Each callback receive the list |
| 6 | of arguments with types according with the language capabilities. The |
| 7 | callback write variables which are sent as response when the processing |
| 8 | is done. |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 9 | |
| 10 | |
Aleksandar Lazic | a714475 | 2019-07-03 08:16:17 +0000 | [diff] [blame] | 11 | Prerequirement |
| 12 | ---------------- |
| 13 | |
| 14 | You have to install the development packages, either from the |
| 15 | distribution repositories or from the source. |
| 16 | |
Gilchrist Dadaglo | 3e235d3 | 2020-05-06 12:25:31 +0000 | [diff] [blame] | 17 | CentOS/RHEL: sudo yum install python3-devel |
Aleksandar Lazic | a714475 | 2019-07-03 08:16:17 +0000 | [diff] [blame] | 18 | |
Gilchrist Dadaglo | 3e235d3 | 2020-05-06 12:25:31 +0000 | [diff] [blame] | 19 | The current minimal python version compatible with this library is 2.7. |
| 20 | It's recommended to use python version 3 where possible due to python 2 deprecation. |
Aleksandar Lazic | a714475 | 2019-07-03 08:16:17 +0000 | [diff] [blame] | 21 | |
| 22 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 23 | Compilation |
| 24 | --------------- |
| 25 | |
| 26 | Actually, the server support Lua and Python. Type "make" with the options: |
| 27 | USE_LUA=1 and/or USE_PYTHON=1. |
| 28 | |
Aleksandar Lazic | a714475 | 2019-07-03 08:16:17 +0000 | [diff] [blame] | 29 | You can add LUA_INC=.. LUA_LIB=.. to the make command to set the paths to |
| 30 | the lua header files and lua libraries. |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 31 | |
Gilchrist Dadaglo | 3e235d3 | 2020-05-06 12:25:31 +0000 | [diff] [blame] | 32 | Similarly, you can add PYTHON_INC=.. PYTHON_LIB=.. to the make command to set the paths to |
| 33 | the python header files and python libraries. |
| 34 | By default, it will try to compile by detecting the default python 3 parameters. |
| 35 | It will fall back to python 2 if python 3 is not available. |
| 36 | |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 37 | Start the service |
| 38 | --------------------- |
| 39 | |
| 40 | After you have compiled it, to start the service, you just need to use "spoa" |
| 41 | binary: |
| 42 | |
| 43 | $> ./spoa -h |
| 44 | Usage: ./spoa [-h] [-d] [-p <port>] [-n <num-workers>] |
| 45 | -h Print this message |
| 46 | -d Enable the debug mode |
| 47 | -p <port> Specify the port to listen on (default: 12345) |
| 48 | -n <num-workers> Specify the number of workers (default: 5) |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 49 | -f <file> Load script according with the supported languages |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 50 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 51 | The file processor is recognized using the extension. .lua or .luac for lua and |
| 52 | .py for python. Start example: |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 53 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 54 | $> ./spoa -d -f ps_lua.lua |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 55 | |
Daniel Corbett | c802921 | 2019-06-11 10:08:53 -0400 | [diff] [blame] | 56 | $> ./spoa -d -f ps_python.py |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 57 | |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 58 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 59 | Configure |
| 60 | ------------- |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 61 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 62 | Sample configuration are join to this server: |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 63 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 64 | spoa-server.conf : The HAProxy configuration file using SPOE server |
| 65 | spoa-server.spoe.conf : The SPOP description file used by HAProxy |
| 66 | ps_lua.lua : Processing Lua example |
| 67 | ps_python.py : Processing Python example |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 68 | |
| 69 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 70 | Considerations |
| 71 | ------------------ |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 72 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 73 | This server is a beta version. It works fine, but some improvement will be |
| 74 | welcome: |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 75 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 76 | Main process: |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 77 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 78 | * Improve log management: Today the log are sent on stdout. |
| 79 | * Improve process management: The dead process are ignored. |
| 80 | * Implement systemd integration. |
| 81 | * Implement threads: It would be fine to implement thread working. Shared |
| 82 | memory is welcome for managing database connection pool and something like |
| 83 | that. |
| 84 | * Add PHP support and some other languages. |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 85 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 86 | Python: |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 87 | |
Ilya Shipitsin | 1fae8db | 2020-03-14 17:47:28 +0500 | [diff] [blame] | 88 | * Improve reporting: Catch python error message and report it in the right |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 89 | place. Today the error are dumped on stdout. How using syslog for logging |
| 90 | stack traces ? |
Thierry FOURNIER | d8b5c77 | 2018-02-23 11:40:03 +0100 | [diff] [blame] | 91 | |
Thierry FOURNIER | 4d7bfa1 | 2018-02-25 21:28:05 +0100 | [diff] [blame] | 92 | Maybe some other things... |