Argus icon indicating copy to clipboard operation
Argus copied to clipboard

Allow disabling redis

Open elfjes opened this issue 2 years ago • 6 comments

Add a boolean environment variable "ARGUS_DISABLE_REDIS" that, when set, will tell channels to use an InMemoryChannel instead of Redis so that we may run the backend without having a redis server running

elfjes avatar Apr 23 '24 09:04 elfjes

  1. While disabling Redis might be fine in a development environment, this setting needs to come with a big fat warning that it is not suitable for production use. In-memory channels are single-process only, and that's not how you would deploy the Argus in any production setting.

What @lunkwill42 is probably trying to say is that you need to document the setting where the other settings are in the docs, and maybe only turn it on if DEBUG is also on. after rebasing :) I should really write that "how to merge"-doc...

hmpf avatar Apr 25 '24 11:04 hmpf

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 84.39%. Comparing base (d8e30c8) to head (ab91dc4). Report is 5 commits behind head on htmx.

Additional details and impacted files
@@            Coverage Diff             @@
##             htmx     #785      +/-   ##
==========================================
- Coverage   84.62%   84.39%   -0.23%     
==========================================
  Files          75       78       +3     
  Lines        3752     3787      +35     
==========================================
+ Hits         3175     3196      +21     
- Misses        577      591      +14     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Apr 25 '24 13:04 codecov-commenter

I've limited the flag only when debug is also set, but this doesn't work if debug is managed statically in a different file. Consider the following:

For security reasons, DEBUG is set statically to False in settings.prod. However, this is done only after settings.base has been imported. This means that in theory DEBUG and ARGUS_DISABLE_REDIS may be set as environment variables, which would trigger disabling redis. Then DEBUG would be reset to False in settings.prod, but redis would still be disabled. Sounds like a (minor) issue, but I'm not quite sure how to deal with that (ie only evaluate ARGUS_DISABLE_REDIS after all other settings have been loaded...

elfjes avatar Apr 25 '24 13:04 elfjes

Test results

       7 files     574 suites   21m 33s :stopwatch:    462 tests    461 :heavy_check_mark: 1 :zzz: 0 :x: 3 234 runs  3 227 :heavy_check_mark: 7 :zzz: 0 :x:

Results for commit 8809dcc7.

github-actions[bot] avatar Apr 25 '24 13:04 github-actions[bot]

If I'm reading #630 correctly, the mechanism it introduces will also use Redis for conveying messages about notifications to the new qcluster command. We'd have to remember to also include a warning in #630 that disabling Redis would disable notifications and possibly all other background processing functionality we might add using django-q2 later. This could also be ok in a development environment, but it could also be very bad, depending on what you're developing.

lunkwill42 avatar Apr 30 '24 06:04 lunkwill42