feat(standalone): support Redis Sentinel connections - #54
Open
omarzeineddine-ai wants to merge 2 commits into
Open
feat(standalone): support Redis Sentinel connections#54omarzeineddine-ai wants to merge 2 commits into
omarzeineddine-ai wants to merge 2 commits into
Conversation
The standalone server only accepted REDIS_URL, so Sentinel-managed Redis deployments couldn't use the Docker image. Connection config now comes from connectionFromEnv(): - REDIS_SENTINELS (comma-separated host:port, port defaults to 26379) plus REDIS_SENTINEL_NAME select Sentinel mode; ioredis resolves the current master through the sentinels and follows failovers. - REDIS_SENTINEL_PASSWORD, REDIS_USERNAME, REDIS_PASSWORD and REDIS_DB are optional and apply to both modes. - REDIS_URL behavior is unchanged, except a container started with no connection config at all now fails fast with a clear message instead of silently dialing localhost:6379 inside the container. Closes pontusab#44
|
@omarzeineddine-ai is attempting to deploy a commit to the Pontus Abrahamsson's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Closes #44
The standalone Docker image only accepts
REDIS_URL, so Sentinel-managed Redis deployments can't use it — there's no way to hand BullMQ a sentinel connection.Solution
Connection config moves to a small, tested
connectionFromEnv()module with two modes:REDIS_SENTINELShost:portlist (port defaults to26379). Enables Sentinel mode.REDIS_SENTINEL_NAMEmymaster). Required withREDIS_SENTINELS.REDIS_SENTINEL_PASSWORDREDIS_USERNAME/REDIS_PASSWORD/REDIS_DBioredis (via BullMQ) resolves the current master through the listed sentinels and follows failovers automatically. The same connection object flows into the alert store, so alert persistence follows the master too.
REDIS_URLbehavior is unchanged — the URL path emits the exact{ url }connection object the old code inlined (pinned by a unit test). One deliberate change: a container started with no connection config now fails fast withSet REDIS_URL (single instance) or REDIS_SENTINELS + REDIS_SENTINEL_NAME (Sentinel)instead of the old{ url: undefined }, which made ioredis silently diallocalhost:6379inside the container.Docs updated: standalone README env table + Sentinel example, and the
standalone-dockerdocs page.Verification
connection.test.ts): sentinel parsing (defaults, malformed entries), mode precedence, required-name validation, auth/db passthrough, and the exact URL-mode output shape.REDIS_URL: healthcheck and/api/queuesserve live counts — single-instance behavior unchanged.tsc --noEmit,bun build, and biome all pass.Heads-up for reviewers: I did not run a live Sentinel failover topology against the built image — sentinel mode is verified at the config-shape level (the options object handed to BullMQ is standard ioredis
sentinels/nameconfig). Happy to add a compose-based sentinel smoke test if you'd like one in-repo.