Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Replace redis with valkey and run tests with valkey service (#18500)

lucas-dzif34f20f8e24b
diff --git a/.devcontainer/backend.env b/.devcontainer/backend.env
index dddd0ad774..6d4563fc72 100644
--- a/.devcontainer/backend.env
+++ b/.devcontainer/backend.env
@@ -1,7 +1,8 @@
DATABASE_URL=postgres://saleor:saleor@db/saleor
DASHBOARD_URL=http://localhost:9000/
-CELERY_BROKER_URL=redis://redis:6379/1
+CACHE_URL=redis://cache:6379/0
+CELERY_BROKER_URL=redis://cache:6379/1
SECRET_KEY=changeme
# Mailpit
EMAIL_URL=smtp://mailpit:1025
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 9ff09863a7..06da09e2f1 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -7,7 +7,8 @@
8000,
"dashboard:9000",
"mailpit:8025",
- "db:5432"
+ "db:5432",
+ "cache:6379"
],
"portsAttributes": {
"8000": {
diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml
index e338f0dd00..5ffc564869 100644
--- a/.devcontainer/docker-compose.yml
+++ b/.devcontainer/docker-compose.yml
@@ -1,5 +1,3 @@
-version: "3.4"
-
services:
saleor:
image: saleor
@@ -12,7 +10,7 @@ services:
- backend.env
depends_on:
- db
- - redis
+ - cache
volumes:
- ..:/app
@@ -25,7 +23,7 @@ services:
db:
image: library/postgres:15-alpine
ports:
- - 5432:5432
+ - 5432:5432
restart: unless-stopped
volumes:
- saleor-db:/var/lib/postgresql/data
@@ -33,11 +31,11 @@ services:
- POSTGRES_USER=saleor
- POSTGRES_PASSWORD=saleor
- redis:
- image: library/redis:7.0-alpine
+ cache:
+ image: valkey/valkey:8.1-alpine
restart: unless-stopped
volumes:
- - saleor-redis:/data
+ - saleor-cache:/data
ports:
- 6379:6379
@@ -51,5 +49,5 @@ services:
volumes:
saleor-db:
driver: local
- saleor-redis:
+ saleor-cache:
driver: local
diff --git a/.env.example b/.env.example
index cd8ff2b196..3dccc32b2e 100644
--- a/.env.example
+++ b/.env.example
@@ -1,3 +1,4 @@
+CACHE_URL=redis://localhost:6379/0
CELERY_BROKER_URL=redis://localhost:6379/1
EMAIL_URL=smtp://localhost:1025
diff --git a/.github/workflows/tests-and-linters.yml b/.github/workflows/tests-and-linters.yml
index d837d579c1..0101625501 100644
--- a/.github/workflows/tests-and-linters.yml
+++ b/.github/workflows/tests-and-linters.yml
@@ -24,6 +24,7 @@ on:
env:
BENCH_PATH: ./queries-results.json
+ CACHE_URL: "redis://cache:6379/0"
DATABASE_URL: "postgres://saleor:saleor@postgres:5432/saleor"
SECRET_KEY: ci-test
@@ -50,6 +51,13 @@ jobs:
--health-interval 10s
--health-timeout 5s
--health-retries 5
+ cache:
+ image: valkey/valkey:8.1-alpine
+ options: >-
+ --health-cmd "valkey-cli ping | grep PONG"
+ --health-interval 10s
+ --health-timeout 5s
+ --health-retries 5
steps:
- uses: actions/checkout@v5
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 8dd173fac3..217d5a0e9b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -47,7 +47,7 @@ Clone this [repository](https://github.com/saleor/saleor) and setup database and
```shell
cd .devcontainer
-docker compose up db dashboard redis mailpit
+docker compose up db dashboard cache mailpit
```
To create virtualenv and install dependencies run in root of the repository:
diff --git a/setup.cfg b/setup.cfg
index f52e1ca3e6..bf3893381f 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -16,7 +16,7 @@ exclude_lines =
@overload
[tool:pytest]
-addopts = -n auto --record-mode=none --ds=saleor.tests.settings --disable-socket --allow-unix-socket --pdbcls=IPython.terminal.debugger:TerminalPdb
+addopts = -n auto --record-mode=none --ds=saleor.tests.settings --disable-socket --allow-hosts 127.0.0.1,::1,cache --allow-unix-socket --pdbcls=IPython.terminal.debugger:TerminalPdb
asyncio_mode = auto
asyncio_default_fixture_loop_scope = fixture
testpaths = saleor