chore: replace the redis cluster in docker-compose with valkey - #2140
Merged
Conversation
Swap the six-node Redis cluster for Valkey 9.1: valkey/valkey images, valkey-server/valkey-cli, data under ./data/valkey, and the compose profile renamed from `redis` to `valkey`. redis.conf becomes valkey.conf with masteruser/masterauth renamed to primaryuser/primaryauth. REDISCLI_AUTH stays, as valkey-cli still reads the password from it. Valkey bootstraps a cluster the same way Redis does, but the surrounding compose setup is tidied up while we are here: - the six node services differ only in name, port and data directory, so they now share an x-valkey-node anchor - the init service waits for the nodes to be healthy instead of sleeping for a fixed 10s, and passes --cluster-yes rather than piping in a yes - init is idempotent: it only creates the cluster when node-1 still knows just itself, so a restart on existing data no longer fails. It checks known nodes rather than cluster_state because nodes.conf is loaded at startup while the state only turns ok once the nodes have gossiped redisinsight is replaced by valkey-admin, which serves the same purpose for Valkey and takes its connection from the environment, so there is no manual setup in the UI. It listens on 8080, published as 8090 because the server service already publishes 8080. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The cluster init idempotency check uses a potentially incorrect ERE regex ($$) that can cause fresh cluster creation to be skipped.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the development Docker Compose setup to replace the existing Redis Cluster services with a Valkey (9.1) cluster, including updated node configuration and an updated optional admin UI service.
Changes:
- Replace the six Redis cluster node services and init container with Valkey equivalents (including YAML anchors to reduce duplication).
- Update cluster node configuration from Redis
masteruser/masterauthto Valkeyprimaryuser/primaryauth. - Update the dev
application.ymlcomment to refer to Valkey (keeping Spring Redis property keys unchanged).
File summaries
| File | Description |
|---|---|
| docker-compose.yml | Replaces Redis cluster services with Valkey services, introduces shared node anchor, updates init flow and adds Valkey Admin UI service. |
| valkey.conf | Updates node config header and switches replication auth directives to Valkey’s primary* names. |
| server/src/dev/resources/application.yml | Updates comment wording to reference Valkey instead of Redis. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Valkey Admin discovers the topology from the pre-configured connection once at startup and never retries, so it has to start after the cluster exists - otherwise it comes up alongside the nodes, finds no cluster and sits idle with no collectors. Wait for valkey-cluster-init to complete. That dependency crosses a profile boundary, so the cluster services join the valkey-admin profile as well: `--profile valkey-admin` now brings up the cluster plus the UI, while `--profile valkey` stays cluster-only. Also set DEPLOYMENT_MODE and VALKEY_AUTH_TYPE explicitly. Both match the image defaults, but they are what upstream's Docker deployment docs spell out for a pre-configured connection. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
In Web mode the UI manages connections itself, so pre-configuring the connection starts metrics collection but does not populate the UI - it still asks for one on first use. Record the values that work, including why the published localhost ports are not among them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Author
|
the valkey-admin interface is really cool, was not aware that something like this exists before working on that PR |
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.
Replaces the six-node Redis cluster in
docker-compose.ymlwith Valkey 9.1, and tidies up the surrounding compose setup.Redis → Valkey
valkey/valkey:9.1images,valkey-server/valkey-cli, data under./data/valkey, services renamedredis-node-*→valkey-node-*, profile renamedredis→valkey.redis.conf→valkey.conf, withmasteruser/masterauthrenamed to Valkey'sprimaryuser/primaryauth.REDISCLI_AUTHstays as-is:valkey-clistill reads the password from that exact variable (there is noVALKEYCLI_AUTH), so there is a comment in the file to stop it looking like a leftover.server/src/dev/resources/application.ymlstill points at the right nodes. Only its comment wording is updated — the property keys stayspring.data.redis, as required by the Jedis client.Compose cleanups
Valkey bootstraps a cluster exactly the way Redis does (
valkey-cli --cluster create; the official image has no env-driven cluster bootstrap, and no self-forming cluster config exists in 8.x or 9.x). These are improvements to our own setup rather than anything Valkey-specific:x-valkey-nodeanchor. The block goes from ~145 lines to ~55.condition: service_healthyfor all six nodes instead ofsleep 10, and passes--cluster-yesinstead of piping in ayes(which also drops thebash -cwrapper).upon existing data failed with[ERR] Node redis-node-1:7000 is not empty; it now creates the cluster only when node-1 still knows just itself. It checkscluster_known_nodesrather thancluster_state, becausenodes.confis loaded at node startup while the state only turnsokonce the nodes have gossiped — gating on the state is racy against the health check.redisinsight → valkey-admin
redisinsightis replaced byvalkey/valkey-admin, which serves the same purpose for Valkey and takes its connection fromVALKEY_HOST/VALKEY_PORT/VALKEY_USERNAME/VALKEY_PASSWORD, so there is no manual setup in the UI. It listens on 8080 and is published as 8090, since theserverservice already publishes 8080.Usage is now
docker compose --profile valkey up -d, plus--profile valkey-adminfor the UI at http://localhost:8090.Testing
Run against the actual compose file:
up: cluster forms with 3 primaries / 3 replicas, all 16384 slots covered, all nodes agreeing on slot config, init exits 0.master_link_status:upon a replica confirmsprimaryauthworks with thedefaultuser disabled.valkey cluster already initializedand exits 0.valkey-adminreachable on 8090 and connected — node-1's client list showsvalkey_admin_orchestrator_clientauthenticated asopenvsxissuingcluster slots.🤖 Generated with Claude Code