uPortal-Project / uPortal

Enterprise open source portal built by and for the higher education community.
https://www.apereo.org/projects/uportal
Apache License 2.0
272 stars 273 forks source link

Add new 'uPortal-session' submodule which adds support for session cl… #2699

Closed groybal closed 11 months ago

groybal commented 12 months ago

…ustering / replication / failover.

Checklist
Description of change

A new uPortal-session submodule was added, which uses Spring Session in order to store the web sessions externally in Redis. This is disabled by default, but can be enabled with an environment variable or system property. The Redis connection can be configured for standalone, cluster, or sentinel modes.

jgribonvald commented 12 months ago

Nice starting work !

Also you should watch on the CAS lib to link the session to the CAS ticket to be able to interpret the CAS logout (not lib for CAS in a distributed context exist for with redis but it won't be too much to do)

Also for working with redis in a HA and fail-over context I would advice to use redis (cache mode and not database) + sentinel. And using HAProxy could be powerfull for optimizing where to make read of write request (https://www.willandskill.se/sv/articles/setup-a-highly-available-redis-cluster-with-sentinel-and-haproxy)

For code examples I've pushed some years ago a conf + unit test on CAS around that, watch there if it can help: https://github.com/apereo/cas/commit/171cf34089584e0c5efe2e4a412efa76f37dbc72 and follow the history of change around https://github.com/apereo/cas/commits/master/support/cas-server-support-redis-core/src/main/java/org/apereo/cas/redis/core/RedisObjectFactory.java

After that you would be able to put the cache into redis too and it will consume really less server ressources ;)

bjagg commented 11 months ago

@jgribonvald could we break out your suggestions into Issues that can be tackled at a later date? We just want to get the basic session replication support in before our next release.

Anything you think is really needed for this PR?

jgribonvald commented 11 months ago

@jgribonvald could we break out your suggestions into Issues that can be tackled at a later date? We just want to get the basic session replication support in before our next release.

Anything you think is really needed for this PR?

Don't worry 😉 it's OK for a first introduction of the feature.

But maybe one thing is missing, the test ?