Skip to content

chore(dev): replace redis with valkey #17861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ jobs:
POSTGRES_INITDB_ARGS: '--no-sync --set fsync=off --set full_page_writes=off'
# Set health checks to wait until postgres has started
options: --health-cmd "pg_isready --username=postgres --dbname=postgres" --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: ${{ (matrix.name == 'Tests') && 'redis:7.0' || '' }}
cache:
image: ${{ (matrix.name == 'Tests') && 'valkey/valkey:8-alpine' || '' }}
ports:
- 6379:6379
stripe:
Expand Down
2 changes: 1 addition & 1 deletion dev/environment
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DATABASE_URL=postgresql+psycopg://postgres@db/warehouse

OPENSEARCH_URL=http://opensearch:9200/development

REDIS_URL=redis://redis:6379
REDIS_URL=redis://cache:6379

SESSION_SECRET="an insecure development secret"

Expand Down
20 changes: 10 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ services:
ports:
- "12111:12111"

redis:
image: redis:7.0
cache:
image: valkey/valkey:8-alpine

opensearch:
build:
Expand Down Expand Up @@ -113,7 +113,7 @@ services:
condition: service_healthy
opensearch:
condition: service_started
redis:
cache:
condition: service_started
stripe:
condition: service_started
Expand All @@ -127,7 +127,7 @@ services:
depends_on:
db:
condition: service_healthy
redis:
cache:
condition: service_started
stripe:
condition: service_started
Expand Down Expand Up @@ -168,12 +168,12 @@ services:
- 8001:80
stop_signal: SIGKILL
environment:
- RSTUF_BROKER_SERVER=redis://redis/1
- RSTUF_REDIS_SERVER=redis://redis
- RSTUF_BROKER_SERVER=redis://cache/1
- RSTUF_REDIS_SERVER=redis://cache
- RSTUF_REDIS_SERVER_DB_RESULT=1
- RSTUF_REDIS_SERVER_DB_REPO_SETTINGS=2
depends_on:
redis:
cache:
condition: service_started

rstuf-worker:
Expand All @@ -186,15 +186,15 @@ services:
- RSTUF_STORAGE_BACKEND=LocalStorage
- RSTUF_ONLINE_KEY_DIR=/keyvault
- RSTUF_LOCAL_STORAGE_BACKEND_PATH=/var/opt/repository-service-tuf/storage
- RSTUF_BROKER_SERVER=redis://redis/1
- RSTUF_REDIS_SERVER=redis://redis
- RSTUF_BROKER_SERVER=redis://cache/1
- RSTUF_REDIS_SERVER=redis://cache
- RSTUF_REDIS_SERVER_DB_RESULT=1
- RSTUF_REDIS_SERVER_DB_REPO_SETTINGS=2
- RSTUF_SQL_SERVER=postgresql://postgres@db:5432/rstuf
depends_on:
db:
condition: service_healthy
redis:
cache:
condition: service_started

static:
Expand Down
2 changes: 1 addition & 1 deletion docs/dev/development/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ do this:

$ make shell
docker compose run --rm web python -m warehouse shell
Starting warehouse_redis_1 ...
Starting warehouse_cache_1...
...
(InteractiveConsole)
>>>
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ignore_missing_imports = true
[tool.pytest.ini_options]
addopts = [
"--disable-socket",
"--allow-hosts=localhost,::1,stripe,redis",
"--allow-hosts=localhost,::1,stripe,cache",
"--durations=20",
"--numprocesses=auto",
# Disable ddtrace for tests
Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def get_app_config(database, nondefaults=None):
"database.url": database,
"docs.url": "http://docs.example.com/",
"ratelimit.url": "memory://",
"db_results_cache.url": "redis://redis:0/",
"db_results_cache.url": "redis://cache:0/",
"opensearch.url": "https://localhost/warehouse",
"files.backend": "warehouse.packaging.services.LocalFileStorage",
"archive_files.backend": "warehouse.packaging.services.LocalArchiveFileStorage",
Expand Down Expand Up @@ -410,8 +410,8 @@ def app_config_dbsession_from_env(database):
"warehouse.db_create_session": lambda r: r.environ.get("warehouse.db_session"),
"breached_passwords.backend": "warehouse.accounts.services.NullPasswordBreachedService", # noqa: E501
"token.two_factor.secret": "insecure token",
# A running redis service is required for functional web sessions
"sessions.url": "redis://redis:0/",
# A running redis-like service is required for functional web sessions
"sessions.url": "redis://cache:0/",
}

return get_app_config(database, nondefaults)
Expand Down