A couple things to share - 1) At that time, we also wanted to be a bit lean in the implementation. So we also asked people to use a local redis if that satisfies their requirements. With luajit, you can integrate with a library to interact with a local redis server through unix domain socket and just get/set your key/value pairs accordingly .Some example here - https://github.com/shukitchan/ats_lua_scripts/blob/master/connect_redis.lua
2) You can check out this PR for some inspiration on how to do this - https://github.com/apache/trafficserver/pull/1641 Although i do think that PR is actually stuffing too much in and also can be packaged as a separate lua module instead . Thanks. Kit On Wed, Dec 2, 2020 at 11:40 AM Lei Sun <[email protected]> wrote: > > Hi Shu, > > I'd be happy to help! > > I didn't do much C/C++ other than I was in school. Could you please send me a > bit more instruction on how to get it going, that would make things from > impossible to possible for me LOL. > > Cheers, > Lei > > > > On Wed, Dec 2, 2020 at 1:28 PM Shu Kit Chan <[email protected]> wrote: >> >> The shared dict feature was using TCL (for hashtable and related >> stuff) and we don't want to add a dependency at that time on TCL. So >> we took that feature out when we are adding the plugin to ATS repo. I >> think it is not that difficult to add this back in without TCL and >> contributions are welcome :) >> >> >> On Tue, Dec 1, 2020 at 10:12 PM Lei Sun <[email protected]> wrote: >> > >> > Hi Kit, >> > >> > Thank you so much for your help! I was able to get this working. >> > >> > I saw on the documentation >> > https://github.com/portl4t/ts-lua/wiki/Doc#tsshareddict, that there is the >> > ts.shared.DICT feature. However, I couldn't get it to work according to >> > the documentation. >> > >> > Could you please let me know if I'm missing something? >> > >> > Thanks, >> > Lei >> > >> > >> > >> > On Sun, Nov 29, 2020 at 11:44 PM Shu Kit Chan <[email protected]> wrote: >> >> >> >> Are you running the plugin as a remap plugin or not ? >> >> >> >> If you are using the lua plugin in plugin.config, then the entry >> >> functions are those that start with "do_global_" >> >> If you are using it in the remap.config, then the entry function is >> >> do_remap() >> >> >> >> Thanks. >> >> >> >> Kit >> >> >> >> On Sun, Nov 29, 2020 at 8:50 PM Lei Sun <[email protected]> wrote: >> >> > >> >> > Hi Guys, >> >> > >> >> > I'm trying to setup ATS with LUA. I started the server no problem, and >> >> > didn't see any issues loading the LUA plugin. >> >> > >> >> >> leisun@/usr/local/etc/trafficserver$ sudo traffic_server -T"ts_lua" >> >> >> Traffic Server 10.0.0 Nov 29 2020 15:56:51 Leis-MacBook-Pro.local >> >> >> traffic_server: using root directory '/usr/local' >> >> >> [Nov 29 22:43:54.442] DIAG: (ts_lua) [create_lua_vms] registered >> >> >> config string proxy.config.plugin.lua.max_states: with default [256] >> >> >> [Nov 29 22:43:54.443] DIAG: (ts_lua) [create_lua_vms] found >> >> >> proxy.config.plugin.lua.max_states: [256] >> >> > >> >> > >> >> > However, as I was curling the server, and the ATS seems to be doing >> >> > it's proxy job fine, but I cannot see any logs coming out of the >> >> > following LUA script. >> >> >> >> >> >> function send_request() >> >> >> local uri = ts.server_request.get_uri() >> >> >> ts.debug(uri) >> >> >> ts.note('send_request') >> >> >> ts.error('send_request') >> >> >> ts.warning('send_request') >> >> >> end >> >> >> >> >> >> function do_remap() >> >> >> ts.note('do_remap') >> >> >> ts.error('do_remap') >> >> >> ts.warning('do_remap') >> >> >> ts.hook(TS_LUA_HOOK_SEND_REQUEST_HDR, send_request) >> >> >> return 0 >> >> >> end >> >> > >> >> > >> >> > I spent 2 full days searching online, and didn't get much luck. >> >> > >> >> > Could someone please let me know what I missed? >> >> > >> >> > PS - how do I get invited to the Slack channel please? >> >> > >> >> > Thank you so much! >> >> > Lei >> >> > >> > >> > >>
