Jump to content

Recommended Posts

Posted

Good day everyone! Hope you all safe and healthy!

I am thinking about a rather ambitious project (for me). It should consist of a number of ProcessWire based sites which will serve the same group of registered users. I need to make the user registration a one time process. And I need to share the user data across the sites. Single sign-in is also in plans. I am thinking about placing the user info and all the user data in one installation and somehow sharing it between all the other. But I am open to any suggestions.

Please share your thoughts and experience on the topic. I am only in the very beginning and trying to estimate is it even doable.

Posted

My first thought is to use Redis for your session storage. I have a modified SessionRedis module that works on PW3.x with Predis if you want a copy.

  • Like 2
Posted
10 hours ago, Rudy said:

a modified SessionRedis module that works on PW3.x with Predis if you want a copy.

 I want to have a copy, if I can. ?  ? 

Posted

@Rudy, surely I want a copy) But even more than that I want an explanation how to use it and how exactly will it fit my case. Could you please write a little more about it if you got time?

Posted

Here is the customized module. You will need to run:

composer require predis/predis

 to use it.

Add the following settings to your `config.php`

    $config->redis_session_server_ip     = '127.0.0.1';
    $config->redis_session_server_port   = 6379;
    $config->redis_session_server_db     = 0;
    $config->redis_session_server_prefix = "PHPSESSID:";
    $config->redis_session_server_ttl    = 1800;

Change the session prefix to whatever you want.

Once installed, you can then share the same session (using the prefix) across multiple sites as long as those sites are reading/writing to the same redis server.

SessionHandlerRedis.zip

  • Like 2
Posted

Cool stuff, @Rudy!

May I ask a few additional questions?

  1. Do you limit the ability to login/register to only one installation? How?
  2. You do not re-create users on all installations, do you?
  3. Are you using user info from one installation in all the others? I mean something like $user->hasRole() and things like finding users? How? Are you using API call to other instances?
Posted

@Ivan Gretsky my usage is slightly different than yours. It's more for running a website on a multiple servers through a load-balancer. I have my database running on AWS RDS and a separate Redis server.

I think you should:
- limit the login/register to only one installation
- use either database or redis to store your sessions
- use AppAPI module to make REST calls from the primary site

  • Like 2
Posted

Thanks for the great suggestions! Will make my mind around it and try.

If anyone has other ideas or experience on the topic, please share. I did not consider REST API for using $user data from the main registration site on the other installations (and do not have expertise in this). Are there other (simpler? more PW-ish?) ways to do it?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...