β‘οΈ Quick Start
Installationβ
There are two main components to Lunar:
Interceptorβ
Intercepts API calls and sends them to the proxy. To install interceptors, see here and choose the language you are using to make API calls to see its installation instructions.
Lunar Proxyβ
Receives intercepted API calls and forwards them to the API, applying any policies that you have defined. See here for installation instructions.
Using an interceptor is recommended, as it includes failsafe mechanisms and some additional features. However, it is also possible to use Lunar without an interceptor. See here for more information.
Configurationβ
Configure the policies.yaml fileβ
After validaing the succussful installation of both Lunar Interceptor and Lunar Proxy, configure a remedy policy for optimizaing your current API consumption.
Edit your policies.yaml
file with the following strategy-based-throttling
plugin configuration.
global:
remedies:
- name: Strategy Based Throttling Quick Start
enabled: true
config:
strategy_based_throttling:
allowed_request_count: 100
window_size_in_seconds: 60
response_status_code: 429
In the above example, the plugin will enforce a limit of 100 requests per minute for all requests. If the limit is exceeded, the plugin will return a 429 HTTP status code.
Apply Policyβ
After making changes to your local policies.yaml
file, use the apply_policies
command to apply the new policies.
docker exec lunar-proxy apply_policies
Demoβ
Check out our demo video for a quick start here.
Lunar Sandboxβ
To try out Lunar without installing anything, check out our sandbox.
Getting Helpβ
For any questions, feel free to reach out to us at info@lunar.dev.
Testing / Lintingβ
Proxyβ
To run tests:
cd proxy/integration-tests
pipenv install --dev
pipenv run behave
Linting is described here.
Interceptorβ
To run tests:
cd interceptors/integration-tests
pipenv install --dev
export CLIENT_LANGUAGE=python CLIENT_VERSION=3.10 # For Python tests
# OR
export CLIENT_LANGUAGE=java # For Java tests
pipenv run behave