1084

How to share session across multiple docker containers?

Comments for “How to share session across multiple docker containers?”
 

Posted by siri on Tuesday 28th June 2022 at 13:51 GMT

Hi,
We are running Trongate application on a docker container. Based on the traffic my client decided to scale up the containers. (Roudn robin method -> I don't know about this , but my admin told me this -> handling requests across multiple containers) Ok after scaling up , when I try to login from /members/login I am not able to login and I am getting same login page again and again. But on a single container it is working fine. After searching stack over flow they mentioned add session_name("Some name") before session_start(). But this is not working. I have added this in engine/bootstrap.php Can any one please help me in this regards?
Thank you
Siri K
Early Adopter

siri

User Level: Early Adopter

Date Joined: 19/07/2019

Posted by DaFa on Tuesday 28th June 2022 at 15:11 GMT

Hi Siri, long time no speak... I hope all is well with you.

I haven't played with Trongate inside a Docker container, let alone multiple containers.
My suggestion would be to force the login to see if other things are working or put several echo "step1"; echo "step2.."; in the code to see where it is falling over.
Founding Member

DaFa

User Level: Founding Member

Date Joined: 30/11/2018

Posted by Davcon on Wednesday 29th June 2022 at 00:10 GMT

I think your issue is to do with Cocker not being able to handle state. So, things like sessions and cookies will break because your setup is over-engineered bullschitt.

So, you're gonna have to figure out an alternative way of storing tokens. If it was me, I'd look into encrypting tokens and storing them with localStorage, with javascript. JSON web tokens are another bullschitt thing that you could look into. Of course, it's all no fun at all.

I apologise for not having better news for you. I hardly know what to say. Choose an exotic setup and you get a bunch of exotic problems. It's just the way it goes, unfortunately.

This comment was edited by Davcon on Wednesday 29th June 2022 at 02:15 GMT

Founding Member

Davcon

User Level: Founding Member

Date Joined: 3/11/2018

Posted by DaFa on Monday 4th July 2022 at 03:08 GMT

Hi Siri,

Not sure if you are still having issues with this project as you have been quiet on this thread.

Are you bundling all your services in one Docker container or decoupled each service in it's own container?

Could you share your Dockerfile?
Founding Member

DaFa

User Level: Founding Member

Date Joined: 30/11/2018

Posted by siri on Monday 4th July 2022 at 06:40 GMT

Hi Simon.
sorry for late response. Currently we are deploying application on proxmox server with Jenkins pipe lines etc. That's why busy with that stuff. Once this is done then I will look into that and surely communicate with you.
Thank you very much
Siri K
Early Adopter

siri

User Level: Early Adopter

Date Joined: 19/07/2019

×