Crates.io | unleash-edge |
lib.rs | unleash-edge |
version | 19.6.1 |
source | src |
created_at | 2023-02-14 14:19:16.853302 |
updated_at | 2024-10-23 09:49:29.973368 |
description | Unleash edge is a proxy for Unleash. It can return both evaluated feature toggles as well as the raw data from Unleash's client API |
homepage | https://github.com/Unleash/unleash-edge |
repository | https://github.com/Unleash/unleash-edge |
max_upload_size | |
id | 784923 |
size | 876,286 |
Availability: Unleash v4.15+.
Unleash Edge is a fast and lightweight proxy layer between your Unleash API and SDKs. It acts as a read replica of your Unleash instance and is designed to help you scale Unleash. It allows you to support thousands of connected SDKs without increasing the number of requests you make to your Unleash instance.
Edge supports both client-side and server-side SDKs and has multi-environment and project awareness. You can daisy-chain Edge instances to support more complex setups, such as multi-cloud deployments.
Key features:
You can run Edge in two different modes: edge or offline. To learn about the different modes and other Edge concepts, visit Concepts.
Unleash Edge is the successor to Unleash Proxy. For help with migrating from Proxy to Edge, refer to the migration guide.
If you're looking for the simplest way to connect your client SDKs, explore our Frontend API. For additional recommendations on scaling your feature flag system, see our Best practices for building and scaling feature flags guide.
Our recommended approach is to bootstrap Edge with a client API token and upstream URL as command line arguments or container environment variables.
To run Edge in Docker:
docker run -it -p 3063:3063 -e STRICT=true -e UPSTREAM_URL=<your_unleash_instance> -e TOKENS=<your_client_token> unleashorg/unleash-edge:<mostrecentversion> edge
Availability: Unleash Edge v19.2+
Unleash Edge supports two behaviors when running in edge mode: strict and dynamic. We recommend using strict behavior, as dynamic is a legacy behavior. Behaviors are mutually exclusive.
When using strict behavior, Edge requires tokens at startup and refuses requests from SDKs that have a wider or different access scope than the initial tokens. Incoming requests must have a token that exactly matches the environment and projects specified in the initial tokens.
For example, if you start Edge with a wildcard token with access to the development environment (*:development.<some_token_string>
) and your clients use various tokens with access to specific projects in the development environment, Edge filters features to only grant access to the narrower scope.
To run Edge in strict mode, use the --strict
CLI argument or STRICT
environment variable.
Legacy behavior, use strict instead.
When using dynamic behavior, Edge validates any new client tokens against upstream. If valid, it configures a refresh job with the minimum set of tokens needed to fetch all observed projects and environments.
To run Edge in dynamic mode, use the --dynamic
CLI argument or DYNAMIC
environment variable.
Unleash Edge is distributed as a binary and as a Docker image.
cargo build --release
. The binary will be located in ./target/release
.unleashorg/unleash-edge:<version>
.ghcr.io/unleash/unleash-edge:<version>
.The docker run
command supports the same CLI arguments that are available when running a binary.
To run Edge in edge mode, use the command edge
. This is built from HEAD
on each commit.
docker run -p 3063:3063 -e STRICT=true -e UPSTREAM_URL=<your_unleash_instance> -e TOKENS=<your_client_token> unleashorg/unleash-edge:<version> edge
To run Edge in offline mode, use the command offline
and provide a volume with your feature toggles file. An example is available inside the examples folder.
docker run -v ./examples:/edge/data -p 3063:3063 -e BOOTSTRAP_FILE=/edge/data/features.json -e TOKENS=<your_client_token_1,your_client_token_2> unleashorg/unleash-edge:<version> offline
Availability: Unleash Edge v19.4+
Offline mode supports multiple token types.
For client tokens, use:
CLIENT_TOKENS
or TOKENS
environment variables--client-tokens
or --tokens
CLI flagsFor frontend tokens, use:
FRONTEND_TOKENS
environment variable--frontend-tokens
CLI flagWhen configured this way, Edge in offline mode can validate tokens and tell daisy-chained Edges instances the type of token calling the validate endpoint.
Availability: Unleash v5.9+. For daisy-chaining, ensure Edge v17+ is upstream of any Edge v19+ to preserve metrics.
Edge is designed to minimize load on its upstream by batching SDK usage metrics. Metrics are gathered over a set interval (METRICS_INTERVAL_SECONDS
) and sent upstream in a single batch.
Unleash versions older than 4.22 cannot process these metrics, so an update is required to see metrics from clients connected to Edge.
To monitor the health and performance of your Edge instances, you can consume Prometheus metrics at:
http://<your-edge-url>/internal-backstage/metrics
Unleash Edge adheres to Semantic Versioning (SemVer) on the API and CLI layers. If you're using Unleash Edge as a library in your projects, note that internal changes could affect your implementation, even in minor or patch versions.
You can view the internal state of Edge at:
http://<your-edge-url>/internal-backstage/tokens
: Displays the tokens known to Edge.http://<your-edge-url>/internal-backstage/features
: Shows the current state of features.Note: The /internal-backstage/*
endpoints should not be publicly accessible.
To enable verbose logging, adjust the RUST_LOG
environment variable. For example, to see logs originating directly from Edge but not its dependencies, you can raise the default log level from error
to warning
and set Edge to debug
, like this:
RUST_LOG="warn,unleash_edge=debug" ./unleash-edge #<command>
See more about available logging and log levels here.
To learn more about Unleash Edge, see the Concepts documentation.
For a list of available command-line arguments, see CLI.
For deployment instructions, see our Deploying Edge guide.
To migrate from the Unleash Proxy to Unleash Edge, refer to the migration guide.
For performance benchmarking, see our Benchmarking page.
See our Contributors guide as well as our development-guide.