Skip to content

Flagsmith/edge-proxy

Repository files navigation

Feature Flag, Remote Config and A/B Testing platform, Flagsmith

Join the Discord chat

Flagsmith is an open source, fully featured, Feature Flag and Remote Config service. Use our hosted API, deploy to your own private cloud, or run on-premise.

Edge Proxy

The Flagsmith Edge Proxy allows you to run an instance of the Flagsmith Engine close to your servers. If you are running Flagsmith within a server-side environment and you want to have very low latency flags, you have two options:

  1. Run the Edge Proxy and connect to it from your server-side SDKs
  2. Run your server-side SDKs in Local Evaluation Mode.

The main benefit to running the Edge Proxy is that you reduce your polling requests against the Flagsmith API itself.

The main benefit to running server side SDKs in Local Evaluation Mode is that you get the lowest possible latency.

Local development

Prerequisites

Setup local environment

Install locked dependencies:

rye sync --no-lock

Install pre-commit hooks:

pre-commit install

Run tests:

rye test

Build and run Docker image locally

# Build image
docker build . -t edge-proxy-local

# Run image 
docker run --rm \
  -p 8000:8000 \
  edge-proxy-local

Configuration

See complete configuration reference.

Edge Proxy expects to load configuration from ./config.json.

Create an example configuration by running the edge-proxy-render-config entrypoint:

rye run edge-proxy-render-config

This will output the example configuration to stdout and write it to ./config.json.

Here's how to mount the file into Edge Proxy's Docker container:

docker run -v ./config.json:/app/config.json flagsmith/edge-proxy:latest

You can specify custom path to config.json, e.g.:

export CONFIG_PATH=/<path-to-config>/config.json

edge-proxy-render-config            # Will write an example configuration to custom path.
edge-proxy-serve             # Will read configuration from custom path.

You can also mount to custom path inside container:

docker run \
    -e CONFIG_PATH=/var/foo.json \
    -v /<path-to-config>/config.json:/var/foo.json \
    flagsmith/edge-proxy:latest

Load Testing

You can send post request with wrk like this:

cd load-test
wrk -t10 -c40 -d5 -s post.lua -H 'X-Environment-Key: <your environment key>' 'http://localhost:8001/api/v1/identities/?identifier=development_user_123456'

Documentation

See Edge Proxy documentation.

About

The Flagsmith Edge Proxy Docker Image

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages