Based on the existing C++ sdk polaris-cpp project of Polaris, this project implements the Lua layer encapsulation of Polaris service discovery, which can be integrated into OpenResty and other systems that use Lua scripts.
.
├── lua // Lua C static library, header file
│ ├── include
│ └── lib
│
`-- third_party
`-- polaris_cpp_sdk // Compile the generated polaris-cpp static library & dynamic library, header file, you need to compile it yourself
│
├── polaris_sdk_lua_wrapper.c // C API wrapper and entry function for lua
├── polaris.lua // Polaris service discovery module package at the lua layer
├── test // Test case
│ └── test_polaris_sdk_lua_wrapper.lua
│
├── pre_build.sh // Execute before compiling, identify the current system environment, link the appropriate Polaris SDK library
- Pull the latest code of Polaris c++ sdk,
git clone https://github.com/polarismesh/polaris-cpp
- Compile
polaris-cpp
and packagemake make test make package # package_name=polaris_cpp_sdk
- Copy the product
polaris_cpp_sdk
compiled bypolaris-cpp
tothird_party/polaris_cpp_sdk
under this project - Execute
bash pre_build.sh
- Execute
make
to generatepolariswrapper.so
- 将
polariswrapper.so
,polaris.lua
文件上传到 OpenResty 项目的合适路径,编写自己的业务 lua 文件使用,业务lua的编写示例可参考测试用例test_polaris_sdk_lua_wrapper.lua