Skip to content

Commit 2fb12a0

Browse files
Switch CI test and docker compose infrastructure to Valkey (PP-4544) (#3498)
## Description Switches the test and dev infrastructure from `redis/redis-stack-server` to the `valkey/valkey:9.0` image, in both the tox (`[docker:valkey-circ]`) and `docker-compose` stacks. `9.0` is a rolling tag, so the stacks pick up the latest 9.0.x patch automatically (matching the floating `postgres:16` style already used here). The container/service is renamed to reflect the engine it actually runs (`valkey-circ` in tox; the `valkey` compose service, with its `depends_on` and `redis://valkey:6379` host references updated, and a `valkey-cli` healthcheck). The `redis://` URL scheme and all `PALACE_*REDIS*` config keys are deliberately left unchanged, since they name the protocol/contract rather than the instance — Valkey is protocol- and command-compatible and we still use the `redis-py` client. The README `### Redis` section becomes `### Valkey`, noting that we run and test against Valkey while Redis remains a supported drop-in. This change also drops the unused ElastiCache detection (`Redis.elasticache`) and its now-orphaned `cached_property` import. The property had no callers, and we run Valkey directly now. > Note: I'm going to keep this in draft until we've updated our infrastructure to valkey, but its ready for code review any time. ## Motivation and Context We want to evaluate (and move to) Valkey instead of Redis. Our usage is limited to core Redis commands (strings, sets, expiry, `WATCH`/pipelines, and Lua scripts via `EVALSHA`) plus Celery as a broker/result backend — none of the Redis Stack modules our old image bundled — so Valkey is a true drop-in. We pin to the `9.0` line because that is the version AWS ElastiCache for Valkey currently runs, which is our intended upgrade target; testing against it directly keeps the test stack aligned with production. JIRA: PP-4544 ## How Has This Been Tested? - Tests run in CI ## Checklist - [x] I have updated the documentation accordingly. - [x] All new and existing tests passed.
1 parent 0eb4915 commit 2fb12a0

4 files changed

Lines changed: 17 additions & 26 deletions

File tree

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,15 @@ CREATE USER palace with password 'test';
175175
grant all privileges on database circ to palace;
176176
```
177177

178-
### Redis
178+
### Valkey
179179

180-
Redis is used as the broker for Celery and the caching layer. You can run Redis with docker using the following command:
180+
[Valkey](https://valkey.io/) is used as the broker for Celery and the caching layer. We run and test
181+
against Valkey, but Redis works as well — Valkey is a protocol- and command-compatible fork of Redis, so
182+
the same `redis://` connection URLs point at either. You can run Valkey with docker using the following
183+
command:
181184

182185
```sh
183-
docker run -d --name redis -p 6379:6379 redis/redis-stack-server
186+
docker run -d --name valkey -p 6379:6379 valkey/valkey:9.0
184187
```
185188

186189
### Environment variables

docker-compose.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ x-cm-variables: &cm
1515
PALACE_SECRET_KEY: "SECRET_KEY_USED_FOR_ADMIN_UI_COOKIES"
1616
PALACE_PATRON_WEB_HOSTNAMES: "*"
1717
PALACE_BASE_URL: "http://localhost:6500"
18-
PALACE_CELERY_BROKER_URL: "redis://redis:6379/0"
19-
PALACE_CELERY_RESULT_BACKEND: "redis://redis:6379/2"
18+
PALACE_CELERY_BROKER_URL: "redis://valkey:6379/0"
19+
PALACE_CELERY_RESULT_BACKEND: "redis://valkey:6379/2"
2020
PALACE_CELERY_BROKER_TRANSPORT_OPTIONS_GLOBAL_KEYPREFIX: "test"
2121
PALACE_CELERY_CLOUDWATCH_STATISTICS_DRYRUN: "true"
22-
PALACE_REDIS_URL: "redis://redis:6379/1"
22+
PALACE_REDIS_URL: "redis://valkey:6379/1"
2323
PALACE_GOOGLE_DRIVE_SERVICE_ACCOUNT_INFO_JSON: "${PALACE_GOOGLE_DRIVE_SERVICE_ACCOUNT_INFO_JSON-}"
2424

2525
# Set up the environment variables used for testing as well
@@ -28,7 +28,7 @@ x-cm-variables: &cm
2828
PALACE_TEST_MINIO_URL: "http://minio:9000"
2929
PALACE_TEST_MINIO_USER: "palace"
3030
PALACE_TEST_MINIO_PASSWORD: "test123456789"
31-
PALACE_TEST_REDIS_URL: "redis://redis:6379/3"
31+
PALACE_TEST_REDIS_URL: "redis://valkey:6379/3"
3232

3333
depends_on:
3434
pg:
@@ -37,7 +37,7 @@ x-cm-variables: &cm
3737
condition: service_healthy
3838
os:
3939
condition: service_healthy
40-
redis:
40+
valkey:
4141
condition: service_healthy
4242

4343
x-cm-build: &cm-build
@@ -115,10 +115,10 @@ services:
115115
timeout: 10s
116116
retries: 5
117117

118-
redis:
119-
image: "redis/redis-stack-server:7.4.0-v0"
118+
valkey:
119+
image: "valkey/valkey:9.0"
120120
healthcheck:
121-
test: ["CMD", "redis-cli", "ping"]
121+
test: ["CMD", "valkey-cli", "ping"]
122122
interval: 30s
123123
timeout: 20s
124124
retries: 3

src/palace/manager/service/redis/redis.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from abc import ABC, abstractmethod
44
from collections.abc import Sequence
5-
from functools import cached_property
65
from typing import TYPE_CHECKING, Any
76

87
import redis
@@ -152,17 +151,6 @@ def pipeline(self, transaction: bool = True, shard_hint: Any = None) -> Pipeline
152151
key_generator=self.get_key,
153152
)
154153

155-
@cached_property
156-
def elasticache(self) -> bool:
157-
"""
158-
Check if this Redis instances is actually connected to AWS ElastiCache rather than Redis.
159-
160-
AWS ElastiCache is supposed to be API compatible with Redis, but there are some differences
161-
that can cause issues. This property can be used to detect if we are connected to ElastiCache
162-
and handle those differences.
163-
"""
164-
return self.info().get("os") == "Amazon ElastiCache"
165-
166154

167155
class Pipeline(RedisPipeline, RedisPrefixCheckMixin):
168156
"""

tox.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ setenv =
2828
docker =
2929
docker: db-circ
3030
docker: minio-circ
31-
docker: redis-circ
31+
docker: valkey-circ
3232
# Default OpenSearch is the current production version (1.x). The os219/os35
3333
# factors are a temporary bandaid for the migration to 3.5: they swap in a
3434
# newer OpenSearch container. Remove them (and the sections below) once
@@ -123,8 +123,8 @@ expose =
123123
host_var =
124124
PALACE_TEST_MINIO_URL_HOST
125125

126-
[docker:redis-circ]
127-
image = redis/redis-stack-server:7.4.0-v0
126+
[docker:valkey-circ]
127+
image = valkey/valkey:9.0
128128
expose =
129129
PALACE_TEST_REDIS_URL_PORT=6379/tcp
130130
host_var =

0 commit comments

Comments
 (0)