Skip to content

launchdarkly/lua-server-sdk

Repository files navigation

LaunchDarkly Server-Side SDK for Lua

Actions Status Documentation

LaunchDarkly overview

LaunchDarkly is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. Get started using LaunchDarkly today!

Twitter Follow

Supported Lua versions

This version of the LaunchDarkly SDK is known to be compatible with the Lua 5.1-5.3 interpreter, and LuaJIT 2.0.5.

Supported C++ server-side SDK versions

This version of the Lua server-side SDK depends on the LaunchDarkly C++ Server-side SDK.

If Redis support is desired, then it optionally depends on the C++ server-side SDK's Redis Source.

Dependency Minimum Version Notes
C++ Server-Side SDK 3.3.3 Required dependency.
C++ Server-Side SDK with Redis 2.1.3 Optional, if using Redis as a data source.

3rd Party Dependencies

Depending on how the C++ server-side SDK was built, the Lua SDK may require additional runtime dependencies to work properly.

Dependency If C++ SDK compiled with.. Notes
OpenSSL LD_DYNAMIC_LINK_OPENSSL=ON If linking OpenSSL dynamically, it must be present on target system.
Boost LD_DYNAMIC_LINK_BOOST=ON If linking Boost dynamically, it must be present on the target system.

Note: The CI process builds against the C++ Server-side SDK's Linux shared libraries, which were compiled with LD_DYNAMIC_LINK_BOOST=ON so Boost is fetched as part of the build process.

Getting started

Refer to the SDK documentation for instructions on getting started with using the SDK.

The following examples are available in addition to the usage guide linked above:

Example Purpose
hello-lua-server Demonstrates basic example of Lua SDK usage from the command line.
hello-haproxy Demonstrates usage of the Lua SDK as a HAproxy module via Docker.
hello-nginx Demonstrates usage of the Lua SDK as a nginx OpenResty module via Docker.

Before you start using the SDK, you'll need to install it.

There are two paths to installing the SDK. In both cases, you must first install the native LaunchDarkly C++ Server-side SDK.

You may build the C++ SDK from source using CMake, or obtain pre-built artifacts from the releases page. Ensure you install the correct variant (with or without Redis support) as defined by your requirements.

Please note that the Lua SDK uses the C++ server-side SDK's C bindings, so if you're using prebuilt artifacts then only a C99 compiler is necessary. See the Build Requirements.

Once the C++ SDK is available, install the LuaRocks package manager.

Install via luarocks install

The LuaRocks project maintains a registry of Lua modules. You may install the SDK from the registry using luarocks install.

Install the base SDK only

luarocks install launchdarkly-server-sdk \
LD_DIR=./path-to-cpp-sdk-installation

Install the base SDK with Redis support

luarocks install launchdarkly-server-sdk-redis \
LDREDIS_DIR=./path-to-cpp-sdk-with-redis-support-installation

Install via luarocks make

If you don't want to install from LuaRocks, it's possible to compile the modules locally in this git repo by using luarocks make.

Install the base SDK only

luarocks make launchdarkly-server-sdk-2.1.0-0.rockspec \
LD_DIR=./path-to-installed-cpp-sdk

Install the base SDK with Redis support

luarocks make launchdarkly-server-sdk-redis-2.1.0-0.rockspec \
LDREDIS_DIR=./path-to-cpp-sdk-with-redis-support-installation

Learn more

Read our documentation for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the complete reference guide for this SDK.

Testing

We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.

Contributing

We encourage pull requests and other contributions from the community. Check out our contributing guidelines for instructions on how to contribute to this SDK.

About LaunchDarkly

  • LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
    • Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
    • Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
    • Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
    • Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
  • LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read our documentation for a complete list.
  • Explore LaunchDarkly