Skip to content

root: Improve Redis configuration#5395

Closed
PKizzle wants to merge 211 commits intogoauthentik:mainfrom
PKizzle:feature/add-redis-sentinel-support
Closed

root: Improve Redis configuration#5395
PKizzle wants to merge 211 commits intogoauthentik:mainfrom
PKizzle:feature/add-redis-sentinel-support

Conversation

@PKizzle
Copy link
Contributor

@PKizzle PKizzle commented Apr 27, 2023

Details

Resolves #5077, resolves #1285

  • Redis URL parser adapted from gitea project for Go implementation
  • Redisstore adapted from BoxGo for Go implementation

Changes

New Features

  • Uses one URL for configuration of Redis (shared between Go and Python)
  • The Python URL parser has been created in a way to resemble the Go version
  • By default uses Redis for broker, channel, backend (current state), but also allows for custom options
  • Moves part of configuration currently under redis category into new dedicated sections -> split into root: Restructure broker / cache / channel / result configuration #7097
  • Adds deprecation check to config parser to allow for easy transition between old and new configuration scheme
  • Old Redis configuration env vars are automatically converted to a Redis config URL if no Redis config URL has been configured otherwise they are ignored
  • The new Redis URL allows environment variables to be included in bash style ${VAR}

Breaking Changes

  • Several new Redis configuration env vars are no longer supported as everything is handled using the URL

Additional information

  • Newly supported Redis configurations are only available using the new Redis config URL environment variable
  • The Redis config URL requires special characters in parameters to be URL encoded (e.g. username, password)

Todo

PKizzle added 30 commits April 2, 2023 00:45
Use URL in order to configure redis instead of multiple configuration options. Switch to go-redis v9.
…feature/add-redis-sentinel-support

# Conflicts:
#	go.mod
#	go.sum
#	poetry.lock
…feature/add-redis-sentinel-support

# Conflicts:
#	lifecycle/wait_for_db.py
#	poetry.lock
Add link to license for provided source code
Allow to specify most Redis configuration options using a single URL. For Kombu provide separate configuration options as it requires a different URL format.
…feature/add-redis-sentinel-support

# Conflicts:
#	go.sum
#	lifecycle/wait_for_db.py
…feature/add-redis-sentinel-support

# Conflicts:
#	go.sum
…feature/add-redis-sentinel-support

# Conflicts:
#	Dockerfile
Usage of socket_timeout clashes with BRPOP
…feature/add-redis-sentinel-support

# Conflicts:
#	internal/config/struct.go
@PKizzle PKizzle marked this pull request as ready for review October 5, 2023 17:41
@PKizzle
Copy link
Contributor Author

PKizzle commented Oct 5, 2023

There are no tests for the added middleware as more discussion is needed whether Redis sentinel and unix socket configurations shall be tested e2e using the GitHub actions.

# Conflicts:
#	authentik/root/test_runner.py
#	lifecycle/system_migrations/to_0_13_authentik.py
# Conflicts:
#	lifecycle/system_migrations/to_0_13_authentik.py
PKizzle added a commit to PKizzle/authentik that referenced this pull request Oct 8, 2023
# Conflicts:
#	authentik/lib/config.py
#	lifecycle/system_migrations/to_0_13_authentik.py
@PKizzle PKizzle closed this Oct 9, 2023
@PKizzle PKizzle deleted the feature/add-redis-sentinel-support branch October 9, 2023 15:25
@gcarrarom
Copy link

@PKizzle Any reason to close this PR? Are we still looking at using Redis Cluster?

@PKizzle
Copy link
Contributor Author

PKizzle commented Oct 10, 2023

@gcarrarom I renamed the branch to better organise them locally and GitHub did not like that. The PR still lives on as #7118. It also includes Redis Cluster support. Please test it thoroughly and report any bugs.

BeryJu added a commit that referenced this pull request Nov 10, 2023
)

* Initial commit

* Remove any remaining mentions of Redis URL

This is handled in #5395

* Allow setting broker transport options

This enables usage of other brokers that require additional settings

* Remove remaining reference to Redis URL

This functionality is not part of this PR

* Reset default TLS requirements to none

* Fix linter errors

* Move dict from base64 encoded json to config.py

Additionally add tests

* Replace ast.literal_eval with json.loads

* Use default channel and cache backend configuration

If more customization is desired users shall look at goauthentik.io/docs/installation/configuration#custom-python-settings

* Send config deprecation notification to all superusers

* Remove duplicate method

* Add configuration explanation

For channel layer settings

* Use Event for deprecation warning

* Fix remove duplicated method

* Add missing comma

* Update authentik/lib/config.py

Signed-off-by: Jens L. <jens@beryju.org>

* Fix Event deprecation handling

---------

Signed-off-by: Jens L. <jens@beryju.org>
Co-authored-by: Jens L <jens@beryju.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redis (Unix) Socket? Support redis sentinel

3 participants