Skip to content

Commit 4fda41e

Browse files
docker compose: switch to Valkey as message broker (#13331)
* docker compose: switch to valkey as message broker * docker compose: switch to valkey as message broker * docker compose: switch to valkey as message broker * docker compose: switch to valkey as message broker * docker compose: switch to valkey as message broker * Update 2.52.md * Update docs/content/en/open_source/upgrading/2.52.md Co-authored-by: kiblik <5609770+kiblik@users.noreply.github.com> * Update 2.52.md * Update docs/content/en/open_source/upgrading/2.52.md * Revise 2.52 upgrade notes for Valkey integration Updated documentation for version 2.52 to reflect the transition from Redis to Valkey as the message broker, including UI fixes and deduplication improvements. --------- Co-authored-by: kiblik <5609770+kiblik@users.noreply.github.com>
1 parent 554b531 commit 4fda41e

File tree

8 files changed

+60
-24
lines changed

8 files changed

+60
-24
lines changed

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
run: ln -s docker-compose.override.integration_tests.yml docker-compose.override.yml
7777

7878
- name: Start Dojo
79-
run: docker compose up --no-deps -d postgres nginx celerybeat celeryworker mailhog uwsgi redis
79+
run: docker compose up --no-deps -d postgres nginx celerybeat celeryworker mailhog uwsgi valkey
8080
env:
8181
DJANGO_VERSION: ${{ matrix.os }}
8282
NGINX_VERSION: alpine

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ cd django-DefectDojo
5656
# Building Docker images
5757
docker compose build
5858

59-
# Run the application (for other profiles besides postgres-redis see
60-
# https://github.com/DefectDojo/django-DefectDojo/blob/dev/readme-docs/DOCKER.md)
59+
# Run the application
60+
# (see https://github.com/DefectDojo/django-DefectDojo/blob/dev/readme-docs/DOCKER.md for more info)
6161
docker compose up -d
6262

6363
# Obtain admin credentials. The initializer can take up to 3 minutes to run.
@@ -67,7 +67,7 @@ docker compose logs initializer | grep "Admin password:"
6767

6868
## For Docker Compose V1
6969

70-
You can run Compose V1 by calling `docker-compose` (by adding the hyphen (-) between `docker compose`).
70+
You can run Compose V1 by calling `docker-compose` (by adding the hyphen (-) between `docker compose`).
7171

7272
Following commands are using original version so you might need to adjust them:
7373
```sh
@@ -132,8 +132,8 @@ Moderators can help you with pull requests or feedback on dev ideas:
132132
* Blake Owens ([@blakeaowens](https://github.com/blakeaowens))
133133

134134
## Hall of Fame
135-
* Jannik Jürgens ([@alles-klar](https://github.com/alles-klar)) - Jannik was a long time contributor and moderator for
136-
DefectDojo and made significant contributions to many areas of the platform. Jannik was instrumental in pioneering
135+
* Jannik Jürgens ([@alles-klar](https://github.com/alles-klar)) - Jannik was a long time contributor and moderator for
136+
DefectDojo and made significant contributions to many areas of the platform. Jannik was instrumental in pioneering
137137
and optimizing deployment methods.
138138
* Valentijn Scholten ([@valentijnscholten](https://github.com/valentijnscholten) |
139139
[Sponsor](https://github.com/sponsors/valentijnscholten) |

docker-compose.override.unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ services:
4242
POSTGRES_DB: ${DD_TEST_DATABASE_NAME:-test_defectdojo}
4343
volumes:
4444
- defectdojo_postgres_unit_tests:/var/lib/postgresql/data
45-
redis: !reset
45+
valkey: !reset
4646
"webhook.endpoint":
4747
image: mccutchen/go-httpbin:2.18.3@sha256:3992f3763e9ce5a4307eae0a869a78b4df3931dc8feba74ab823dd2444af6a6b
4848
volumes:

docker-compose.override.unit_tests_cicd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ services:
4141
POSTGRES_DB: ${DD_TEST_DATABASE_NAME:-test_defectdojo}
4242
volumes:
4343
- defectdojo_postgres_unit_tests:/var/lib/postgresql/data
44-
redis: !reset
44+
valkey: !reset
4545
"webhook.endpoint":
4646
image: mccutchen/go-httpbin:2.18.3@sha256:3992f3763e9ce5a4307eae0a869a78b4df3931dc8feba74ab823dd2444af6a6b
4747
volumes:

docker-compose.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ services:
4141
condition: service_completed_successfully
4242
postgres:
4343
condition: service_started
44-
redis:
44+
valkey:
4545
condition: service_started
4646
entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST:-postgres}:${DD_DATABASE_PORT:-5432}', '-t', '30', '--', '/entrypoint-uwsgi.sh']
4747
environment:
4848
DD_DEBUG: 'False'
4949
DD_DJANGO_METRICS_ENABLED: "${DD_DJANGO_METRICS_ENABLED:-False}"
5050
DD_ALLOWED_HOSTS: "${DD_ALLOWED_HOSTS:-*}"
5151
DD_DATABASE_URL: ${DD_DATABASE_URL:-postgresql://defectdojo:defectdojo@postgres:5432/defectdojo}
52-
DD_CELERY_BROKER_URL: ${DD_CELERY_BROKER_URL:-redis://redis:6379/0}
52+
DD_CELERY_BROKER_URL: ${DD_CELERY_BROKER_URL:-redis://valkey:6379/0}
5353
DD_SECRET_KEY: "${DD_SECRET_KEY:-hhZCp@D28z!n@NED*yB!ROMt+WzsY*iq}"
5454
DD_CREDENTIAL_AES_256_KEY: "${DD_CREDENTIAL_AES_256_KEY:-&91a*agLqesc*0DJ+2*bAbsUZfR*4nLw}"
5555
DD_DATABASE_READINESS_TIMEOUT: "${DD_DATABASE_READINESS_TIMEOUT:-30}"
@@ -65,12 +65,12 @@ services:
6565
condition: service_completed_successfully
6666
postgres:
6767
condition: service_started
68-
redis:
68+
valkey:
6969
condition: service_started
7070
entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST:-postgres}:${DD_DATABASE_PORT:-5432}', '-t', '30', '--', '/entrypoint-celery-beat.sh']
7171
environment:
7272
DD_DATABASE_URL: ${DD_DATABASE_URL:-postgresql://defectdojo:defectdojo@postgres:5432/defectdojo}
73-
DD_CELERY_BROKER_URL: ${DD_CELERY_BROKER_URL:-redis://redis:6379/0}
73+
DD_CELERY_BROKER_URL: ${DD_CELERY_BROKER_URL:-redis://valkey:6379/0}
7474
DD_SECRET_KEY: "${DD_SECRET_KEY:-hhZCp@D28z!n@NED*yB!ROMt+WzsY*iq}"
7575
DD_CREDENTIAL_AES_256_KEY: "${DD_CREDENTIAL_AES_256_KEY:-&91a*agLqesc*0DJ+2*bAbsUZfR*4nLw}"
7676
DD_DATABASE_READINESS_TIMEOUT: "${DD_DATABASE_READINESS_TIMEOUT:-30}"
@@ -85,12 +85,12 @@ services:
8585
condition: service_completed_successfully
8686
postgres:
8787
condition: service_started
88-
redis:
88+
valkey:
8989
condition: service_started
9090
entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST:-postgres}:${DD_DATABASE_PORT:-5432}', '-t', '30', '--', '/entrypoint-celery-worker.sh']
9191
environment:
9292
DD_DATABASE_URL: ${DD_DATABASE_URL:-postgresql://defectdojo:defectdojo@postgres:5432/defectdojo}
93-
DD_CELERY_BROKER_URL: ${DD_CELERY_BROKER_URL:-redis://redis:6379/0}
93+
DD_CELERY_BROKER_URL: ${DD_CELERY_BROKER_URL:-redis://valkey:6379/0}
9494
DD_SECRET_KEY: "${DD_SECRET_KEY:-hhZCp@D28z!n@NED*yB!ROMt+WzsY*iq}"
9595
DD_CREDENTIAL_AES_256_KEY: "${DD_CREDENTIAL_AES_256_KEY:-&91a*agLqesc*0DJ+2*bAbsUZfR*4nLw}"
9696
DD_DATABASE_READINESS_TIMEOUT: "${DD_DATABASE_READINESS_TIMEOUT:-30}"
@@ -127,12 +127,14 @@ services:
127127
POSTGRES_PASSWORD: ${DD_DATABASE_PASSWORD:-defectdojo}
128128
volumes:
129129
- defectdojo_postgres:/var/lib/postgresql/data
130-
redis:
131-
# Pinning to this version due to licensing constraints
132-
image: redis:7.2.11-alpine@sha256:1a34bdba051ecd8a58ec8a3cc460acef697a1605e918149cc53d920673c1a0a7
130+
valkey:
131+
image: valkey/valkey:7.2.11-alpine@sha256:7b2019b47ad58be661fa6eba5ea66106eadde03459387113aaed29a464a5876b
133132
volumes:
133+
# we keep using the redis volume as renaming is not possible and copying data over
134+
# would require steps during downtime or complex commands in the intializer
134135
- defectdojo_redis:/data
135136
volumes:
136137
defectdojo_postgres: {}
137138
defectdojo_media: {}
138139
defectdojo_redis: {}
140+

docs/content/en/open_source/installation/architecture.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ dynamic content.
2121
## Message Broker
2222

2323
The application server sends tasks to a [Message Broker](https://docs.celeryq.dev/en/stable/getting-started/backends-and-brokers/index.html)
24-
for asynchronous execution. Currently, only [Redis](https://github.com/redis/redis) is supported as a broker.
24+
for asynchronous execution. Currently, only [Valkey](https://valkey.io/) is supported as a broker in the docker compose setup.
25+
The Helm chart still uses [Redis](https://github.com/redis/redis) is supported as a broker, but will be migrated to Valkey shortly.
26+
2527

2628
## Celery Worker
2729

docs/content/en/open_source/upgrading/2.52.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 'Upgrading to DefectDojo Version 2.52.x'
33
toc_hide: true
44
weight: -20251006
5-
description: MobSF parsers & Helm chart changes.
5+
description: Replaced Redis with Valkey & Helm chart changes & MobSF parser merge
66
---
77

88
## Fix UI overwriting service field from parsers
@@ -23,9 +23,34 @@ See [PR 13517](https://github.com/DefectDojo/django-DefectDojo/pull/13517) for m
2323
A bug was fixed in the `UNIQUE_ID_OR_HASH_CODE` algorithm where it stopped processing candidate findings with equal `unique_id_from_tool` or `hash_code` value.
2424
Strictly speaking this is not a breaking change, but we wanted to make you aware that you can see more (better) more deduplicatation for parsers using this algorithm.
2525

26-
## Merge of MobSF parsers
26+
## Valkey in `docker compose`
2727

28-
Mobsfscan Scan" has been merged into the "MobSF Scan" parser. The "Mobsfscan Scan" scan_type has been retained to keep deduplication working for existing Tests, but users are encouraged to move to the "MobSF Scan" scan_type.
28+
Since the license change at Redis the fork ValKey has become widely popular and is backed by industry giants such as AWS. AWS is advising to use ValKey over Redis and is using lower prices for ValKey compared to Redis.
29+
30+
Defect Dojo 2.52 now uses ValKey as a message broker. Teh existing redit volume can be used by Valkey, so this is just a drop in replacement.
31+
32+
If you want to know more or have a setup where you cannot just re-use the existing volume, please visit https://valkey.io/topics/migration/.
33+
34+
When you shutdown Defect Dojo to perform the upgrade, the celery tasks that are in the queue are stored to disk. After the upgrade, the celery workers will process these tasks as normal.
35+
36+
If you want to be 110% sure no tasks will be lost you could perform the upgrade in two steps:
37+
38+
1) Stop nginx, uwsgi, celerybeat to prevent new tasks from being created:
39+
40+
`docker compose down nginx, uwsgi, celerybeat`
41+
42+
2) Observe the Redis queue and/or the logs of the celeryworker(s) and wait until all tasks are finished:
43+
44+
`docker compose exec redis redis-cli llen celery` -- should output 0
45+
`docker compose logs celeryworker` -- should stop outputting new task logs
46+
47+
3) Stop the remaining services:
48+
49+
`docker compose down`
50+
51+
4) Continue the upgrade as normal per the [upgrade guide](upgrading_guide)
52+
`docker compose pull`
53+
`docker compose up -d`
2954

3055
## Helm Chart Changes
3156

@@ -62,3 +87,10 @@ The following Helm chart values have been modified in this release:
6287
- **Extra annotations**: Now we can add common annotations to all resources.
6388

6489
There are other instructions for upgrading to 2.52.x. Check the [Release Notes](https://github.com/DefectDojo/django-DefectDojo/releases/tag/2.52.0) for the contents of the release.
90+
91+
## Merge of MobSF parsers
92+
93+
Mobsfscan Scan" has been merged into the "MobSF Scan" parser. The "Mobsfscan Scan" scan_type has been retained to keep deduplication working for existing Tests, but users are encouraged to move to the "MobSF Scan" scan_type.
94+
95+
## Release notes
96+
Check the [Release Notes](https://github.com/DefectDojo/django-DefectDojo/releases/tag/2.52.0) for the contents of the release.

run-integration-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ while [[ $# -gt 0 ]]; do
4141
esac
4242
done
4343

44-
echo "Running docker compose unit tests with profile postgres-redis and test case $TEST_CASE ..."
44+
echo "Running docker compose unit tests and test case $TEST_CASE ..."
4545

4646
# Compose V2 integrates compose functions into the Docker platform,
4747
# continuing to support most of the previous docker-compose features
@@ -50,8 +50,8 @@ echo "Running docker compose unit tests with profile postgres-redis and test cas
5050
echo "Building images..."
5151
./docker/setEnv.sh integration_tests
5252
docker compose build
53-
echo "Setting up DefectDojo with Postgres and Redis..."
54-
DD_INTEGRATION_TEST_FILENAME="$TEST_CASE" docker compose -d postgres nginx celerybeat celeryworker mailhog uwsgi redis
53+
echo "Setting up DefectDojo"
54+
DD_INTEGRATION_TEST_FILENAME="$TEST_CASE" docker compose -d postgres nginx celerybeat celeryworker mailhog uwsgi valkey
5555
echo "Initializing DefectDojo..."
5656
DD_INTEGRATION_TEST_FILENAME="$TEST_CASE" docker compose --exit-code-from initializer initializer
5757
echo "Running the integration tests..."

0 commit comments

Comments
 (0)