Skip to main content

Self-hosting real-time flag updates

If you are self-hosting Flagsmith, using real-time flag updates requires deploying additional infrastructure. This document describes how to deploy, scale and monitor the infrastructure required for using real-time flags.

Prerequisites

Real-time flag updates require an Enterprise subscription.

This document assumes you already have the Flagsmith API deployed to your infrastructure.

Limitations

The Flagsmith Helm chart does not support deploying the infrastructure required for real-time flag updates.

The Redis server must not require authentication for the default user.

Architecture

Self-hosting real-time flags requires two additional infrastructure components:

  • Server-sent events (SSE) service containers, running the flagsmith/sse Docker image.
  • Redis or Redis-compatible key-value store, such as Valkey. All currently-supported Redis versions are supported.

The following sequence diagram describes how Flagsmith clients, the Flagsmith API and real-time components interact to deliver real-time flag updates. "Client" refers to any Flagsmith SDK that supports real-time updates.

Server-sent events (SSE) service

The flagsmith/sse service provides the following HTTP endpoints:

MethodRouteCalled byDescriptionAuthentication
GET/sse/environments/{environment}/streamClient applicationsSubscribe to an SSE stream for the given environment.None
POST/sse/environments/{environment}/queue-changeFlagsmith APINotify the SSE service that the given environment was updated.SSE_AUTHENTICATION_TOKEN

Configuration

flagsmith/sse uses the following environment variables for configuration:

Variable nameDescriptionDefaultExample
REDIS_HOSTHostname of the Redis server to use toRequiredlocalhost
REDIS_PORTPort number to use when connecting to Redis