Skip to content
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

Allow to have a unique user-id across sessions #1023

Merged

Conversation

mathieu-benoit
Copy link
Contributor

@mathieu-benoit mathieu-benoit commented Sep 2, 2022

This introduces a new environment variable for the frontend app: ENABLE_SINGLE_SHARED_SESSION. This allows to have a unique User Id across the sessions. The default behavior is one User Id per session.

Fixing #615 + allows more scenarios to showcase:

  • Multi-clusters Mesh setup (like here with BoA) where the in-cluster redis database is just in 1 cluster, see that the data are accessible from cartservice and frontend from different clusters.
  • Multi-clusters (HA on different regions for example) talking to one Memorystore (redis) instance, see that the data are accessible from cartservice and frontend from different clusters.
  • Same setup than previously but soon with Spanner ;)

If you set this environment variable to "true" on the frontend app, here is how to test this new behavior:

  • if you open your internet browser you will see the user-id at the bottom of the website (associated cookie) with the value: ``. If you open your internet browser now in InPrivate/Incognito mode, you will see the same value.
  • if you try to add items in your shopping cart, you will see the same items in your shopping cart accross your InPrivate/Incognito mode or the other.

Notes:

  • This implementation with this PR is not updating the Kubernetes manifest, if someone wants to leverage this feature they could edit the frontend's Deployment manifest or for example run this command: kubectl set env deployment/frontend ENABLE_SINGLE_SHARED_SESSION="true".
  • No doc update either yet.
  • Later, we may want to have a Kustomize flavor/overlay with that.

@mathieu-benoit mathieu-benoit requested a review from a team as a code owner September 2, 2022 02:05
@mathieu-benoit mathieu-benoit marked this pull request as draft September 2, 2022 02:07
@mathieu-benoit mathieu-benoit linked an issue Sep 2, 2022 that may be closed by this pull request
@mathieu-benoit mathieu-benoit changed the title ENABLE_UNIQUE_USER_ID_ACROSS_SESSIONS Allow to have a unique user-id across sessions Sep 2, 2022
@mathieu-benoit mathieu-benoit added the lang: go Issues specific to Go. label Sep 2, 2022
@github-actions
Copy link

github-actions bot commented Sep 2, 2022

🚲 PR staged at http://34.118.205.234

@github-actions
Copy link

github-actions bot commented Sep 2, 2022

🚲 PR staged at http://34.118.205.234

@github-actions
Copy link

github-actions bot commented Sep 2, 2022

🚲 PR staged at http://34.118.205.234

@mathieu-benoit mathieu-benoit marked this pull request as ready for review September 2, 2022 13:56
@mathieu-benoit
Copy link
Contributor Author

mathieu-benoit commented Sep 2, 2022

Just did my tests, ready for your review, thanks!

Sorry for the confusion while I was doing my test in draft mode, if there is still confusion or your need clarification, feel free to ping me :)

The default behavior is still the same, now if someone wants a unique user id across sessions, they could use this env var ENABLE_UNIQUE_USER_ID_ACROSS_SESSIONS = true on the frontend's Deployment.

@github-actions
Copy link

github-actions bot commented Sep 2, 2022

🚲 PR staged at http://34.118.205.234

1 similar comment
@github-actions
Copy link

github-actions bot commented Sep 2, 2022

🚲 PR staged at http://34.118.205.234

@mathieu-benoit mathieu-benoit merged commit c04cf77 into main Sep 3, 2022
@mathieu-benoit mathieu-benoit deleted the mathieu-benoit/enable-unique-user-id-across-sessions branch September 3, 2022 00:52
D-Mwanth pushed a commit to D-Mwanth/microservices-demo that referenced this pull request Mar 6, 2024
…#1023)

* ENABLE_UNIQUE_USER_ID_ACROSS_SESSIONS

* Update middleware.go

* fix ENABLE_UNIQUE_USER_ID_ACROSS_SESSIONS test with the value "true"

* ENABLE_SINGLE_SHARED_SESSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: go Issues specific to Go.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing Database in Multi-cluster with Istio
2 participants