brbzull0 opened a new pull request #7478: URL: https://github.com/apache/trafficserver/pull/7478
Hello community, as agreed during our last ATS Meetup, I'm putting this *draft* pr so we can share the work that is going on around the new JSONRPC mechanism that is being implemented in TS. You will find all the relevant documentation for this first approach of an administrative JSONRPC server here along with some explanations. ### Roughly first Draft contains several things. - A new RPC server which uses [JSONRPC 2.0](https://www.jsonrpc.org/specification) as the underlying protocol. The server implements an IPC iterative style server, docs [here](https://brbzull0.github.io/ats/developer-guide/jsonrpc/jsonrpc-architecture.en.html#server) - A new set of function handlers to serve the administrative JSONRPC API, docs [here](https://brbzull0.github.io/ats/admin-guide/jsonrpc/index.en.html#api) - A new `traffic_ctl` tool that uses jsonrpc as protocol, docs [here](https://brbzull0.github.io/ats/appendices/command-line/traffic_ctl_jsonrpc.en.html?highlight=traffic_ctl) - Unit test for basic protocol specs/rpc server. ### Some other important documentation: - Basic Architecture notes(RPC, JSON Parsing, Protocol, Errors, etc) can be found [here](https://brbzull0.github.io/ats/developer-guide/jsonrpc/jsonrpc-architecture.en.html) - Implementing a new API handler, docs [here](https://brbzull0.github.io/ats/developer-guide/jsonrpc/jsonrpc-handler-development.en.html) - Implementing new `traffic_ctl` commands, docs [here](https://brbzull0.github.io/ats/developer-guide/jsonrpc/traffic_ctl-development.en.html) - Configuration [docs](https://brbzull0.github.io/ats/admin-guide/jsonrpc/index.en.html#configuration) - Records [API](https://brbzull0.github.io/ats/admin-guide/jsonrpc/index.en.html#records) - Raw interaction with the RPC server using `traffic_ctl`(no specific api), [here](https://brbzull0.github.io/ats/appendices/command-line/traffic_ctl_jsonrpc.en.html?highlight=traffic_ctl#traffic-ctl-rpc) - Can’t remember all the `traffic_ctl`? No worries, you can use [this](https://gist.github.com/brbzull0/6933ae5097db9b32000bedec055a2b95) which will give you bash completion for it. All the documentation that is in this Draft, is online [here](https://brbzull0.github.io/ats/index.html) I will keep this up to date with any changes. Now, this draft pr contains several commits, but some of the newest commits contains significant changes that can invalidate the early ones, so I do not recommend to review commit by commit. Just look at it as a whole. ### Few other things to consider: - Although you do not need it, we still have `traffic_manager` in this branch. If cloning this branch to play with, just start TS and use `traffic_ctl` as usual. :crossed_fingers: - There is a new folder called `mgmt2` which is where I’m putting all the code that is relevant to this new rpc system, also to start clean and avoid issues in the future when removing `traffic_manager`. I will be slowly moving what can/should be keept inside this new folder. At some point will revert the name to `mgmt` or something more relevant. - There are some code like `FileManager.cc/h` which was copy/paste from `traffic_manager` sources with some modifications in order to be reused. For instance `FileManager` now fusions `FileManager` and `ConfigManager` together. - Existing management handler(mgmt_*) lives along with the new ones from the JSONRPC handlers, this is useful during dev so I can compare and see if both behave similarly. - Incoming messages are validated using `yamlcpp` library, basically to check if the data on the wire is good to be consumed, this may change as it’s not very performant as we are parsing the message twice. - JSONRPC protocol is not 100% honoured as the parsing library(`yamlcpp`) has some limitations when dealing with straight `json`. - Some of the validity checks when setting a new config variable was copy/paste (like 'recordValidityCheck') from the original source, there are better ways to achieve this, this code may change in the future. - I left some TODOs so I can revisit some things. ### Some known issues that I will be fixing. - Autest failing because: - - Some issues with the socket unix path that `traffic_ctl` cannot read as it cannot get it from the Layout tool. - There are some coupled modules that have dependencies from the current mgmt. ### TODOs: - [ ] Unit test for the actual API handlers, this can/should be done using `autest` and either `traffic_ctl` or a new extension that connects directly to the rpc. - [ ] Production run. We haven’t run this yet in production, `traffic_ctl` was migrated to `jsonrpc` proto in the last weeks so this is something that will happen shortly. - [ ] Performance test, Improve some code. - [ ] Some of the `traffic_ctl server` (restart, start, backtrace, etc) commands do not work because there is no `traffic_manager` running. This may need to involve some scripting that can be executed from `traffic_ctl`, or work with the OS system managers, like `systemctl`, etc, depending on the OS. - [ ] There is a discussion going on to replace the iterative RPC server for something different, we are considering to have a `ET_RPC` thread to handle all rpc stuffs. You can find the original Issue created to tackle this effort https://github.com/apache/trafficserver/issues/6633 Please feel free to clone it and try it out, any feedback would be appreciated. Thanks, Damian ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
