Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Support multiple orgs on the same instance

Open engelgabriel opened this issue 11 years ago • 163 comments

Transparently divide a single server into several different instances shared between different groups of users.

Evaluate https://atmospherejs.com/mizzao/partitioner

engelgabriel avatar Sep 01 '15 23:09 engelgabriel

Hi! We might be interested in helping on this one.

Is it to be the same 'teams' feature as on Slack? Has anyone started on it yet?

mhurwi avatar Sep 13 '15 18:09 mhurwi

Cool. Please join the #contributors channel on the demo chat. Can definitely use the help, especially if you guys have experience in working with mizzao:partioner already!

Sing-Li avatar Sep 13 '15 19:09 Sing-Li

Not used it, but reading the docs and discussion, seems like a nice solution. Will see you in the chat room soon!

mhurwi avatar Sep 13 '15 22:09 mhurwi

Great, @mhurwi ! Catch you on demo soon. Can't wait to see what sort of real world performance hit partitioning brings. Day job's got me running 'round in circles on a Sunday :grinning:

Sing-Li avatar Sep 13 '15 23:09 Sing-Li

THe good news is, I just talked to 2 companies that want this feature so bad, they will allocate their own developers to contribute and build it :)

One of the companies if from around the block, so they will just come to the office for a few days and work from here.

engelgabriel avatar Sep 13 '15 23:09 engelgabriel

:+1: this is awesome

geekgonecrazy avatar Sep 13 '15 23:09 geekgonecrazy

Haha what a team! @mhurwi , you just got yourself some teamates from the real sunny south! :grinning:

Sing-Li avatar Sep 13 '15 23:09 Sing-Li

Partition is the same as "team" at slack? At slack, one user(email)can create and join multiple teams, can can switch team. If Partition is only a solution like load balance, rocket cloud add team feature at one instance first.

liuliming2008 avatar Sep 14 '15 04:09 liuliming2008

One thing about mizzao:meteor-partitioner: it seems set up to allow one user to belong to only one group.

https://github.com/mizzao/meteor-partitioner/blob/master/grouping.coffee#L19-L23

Partitioner.setUserGroup = (userId, groupId) ->
  check(userId, String)
  check(groupId, String)
  if Grouping.findOne(userId)
    throw new Meteor.Error(403, "User is already in a group")

This makes sense, compared to Slack. From my experience, Slack requires a unique new password for each team. That could mean that each team represents a new instance and behind the scenes, on Slack I have a separate account for each team I belong to.

Maybe using meteor-partitioner would require creating a new account for a user when they want to join a new group?

Not sure what you all think about this?

mhurwi avatar Sep 14 '15 16:09 mhurwi

Just copying a post from the other thread (use a context id):

Can we 'virtualise' the real email + an appearance id ... and then gen a unique guid email to be used by meteor?? just a thought

the appearance id might just be a 'context identifier', from which white-labeled instance (or a team name) the user is logging in from (as), for example:

([email protected] + 'rocketchat team') -> [email protected] ([email protected] + 'sings own family chat') -> [email protected]

Sing-Li avatar Sep 14 '15 16:09 Sing-Li

I think we should look into mizzao:partioner, but not use it, just understand it and apply some of the logic into our project. The main reason being that we want this behaviour to be optional. Some organization will just want a very simple Rocket.Chat deployment, for a single team. So we need to add the hooks on the right places, and only activate them via settings.

engelgabriel avatar Sep 14 '15 17:09 engelgabriel

I suggest to add the "team" feature as optional settings. And then consider how to expand one instance to more.

liuliming2008 avatar Sep 15 '15 02:09 liuliming2008

@liuliming2008 that's a completely separate thing and is being tracked here. RocketChat/Rocket.Chat#520

High Availability / Scaling to multiple instances.

geekgonecrazy avatar Sep 15 '15 02:09 geekgonecrazy

Lets implement that using the new abstraction layer at Rocket.Chat/packages/rocketchat-lib/server/models/_Base.coffee

engelgabriel avatar Oct 13 '15 21:10 engelgabriel

Althou we will use the word "TEAMS" to denominate the enviroment variable, the property name on the schema should be configurable, so we can keep compatibility with https://atmospherejs.com/mizzao/partitioner as they use _groupId

engelgabriel avatar Oct 13 '15 22:10 engelgabriel

Hello guys. I'll work on this issue on the next days! As @engelgabriel said before, we have a product that needs this feature and will be a pleasure for me to help.

Yesterday I was talking with @engelgabriel and @rodrigok about the first steps to develop and the suggestion was to start changing this file: https://github.com/joaocarloscabral/Rocket.Chat/blob/master/packages/rocketchat-lib/server/models/_Base.coffee

The idea is intercept all calls to DB, add a property named as _teamId and check if the property was not changed from the client.

Right? :)

joaocarloscabral avatar Oct 14 '15 12:10 joaocarloscabral

@joaocarloscabral Take a look on the link below for how to grab the connection object for that fiber. https://github.com/RocketChat/Rocket.Chat/compare/EnvironmentConnection#diff-e214084ef39ef04ea8cfce4bd72a420bR26

engelgabriel avatar Oct 14 '15 13:10 engelgabriel

@engelgabriel when I think teams i'm thinking of an organizational unit. A way to say this user is part of this team, this channel is part of this team. A way of visually organizing and displaying things. But essentially its still all in the same organization, and same instance and they could directly interact with other teams.

Like Company X has:

  • Sales Team
  • Marketing Team
  • Engineering Team

Etc, but they can still talk in general shared channels.

When I read through this thread, this looks like you guys are talking multi-organizational support? Or partitioning of a single server to be able to take care of multiple organizations. Completely separate but on the same instance.

I'm I correct in thinking this is actually multi-organization support not really teams?

geekgonecrazy avatar Oct 15 '15 15:10 geekgonecrazy

We are in favor of 'multi-organization'. We use slack this way-- each team is a different customer organization that we manage. These different organizations do not talk to each other.

'sales team' and 'marketing team' seem like people that belong to the same organization. They can use private channels to stay separate, but they can still direct message whoever they want and also join in the public channels.

mhurwi avatar Oct 20 '15 18:10 mhurwi

@mhurwi right that makes sense that you would have the option to separate out to a multi-org if you want isolation between teams.

@engelgabriel I'm going to go ahead and change this title so we its a little more clear.

geekgonecrazy avatar Oct 20 '15 20:10 geekgonecrazy