Skip to content

Multi Organizations/Users setup #82

@ceckoslab

Description

@ceckoslab

We would like to experiment and find out how Basic RUM can work with more than one Organizations. Today we assume that Basic RUM is used by exactly one organization and this will be happening for the majority of the cases what if more than one organizations would like to use the same Basic RUM backoffice?

I can't be sure what is the right way for implementing this but we need to start from somewhere, so below is the proposal:

Proposal:

We should be able to define a list of users/organizations that are using a given instance of Basic RUM.

For this let's use a configuration file that will be placed in the same folder from where we run the binary of front_basicrum_go. Let's call this file users-map.yaml.

An example of the file will look like:

--- # Multi-user configuration for Basic RUM
- user:
    prefix: fashion_bg
    brum_trace: BY83kR5MS5PM
    expire: 2023-12-25

- user:
    prefix: sofia_news
    brum_trace: ENPu8ctP6zda
    expire: 2023-11-22 

We will have file watcher that reads this file every minute. This will allow us to add new users without restart the Front Basic RUM component.

Database:

Front Basic RUM must create a new table for each new user added in the file. This will be happening on runtime so no restart of Front Basic RUM is required.

We also should account for schema migrations. If we add new columns Basic RUM we should be automatically make migrations for all user tables.

What each configuration filed means:

prefix

Prefix will be used as prefix for the ClickHouse table that the user will be assigned to. Also this prefix will be used as the folder name where we will be doing backups on the file system.

trace

Each user will be given an unique identifier. This identifier will be present on the beacons that will be send by Boomerang JS. The beacon parameter from where we will be reading the trace will be brum_trace. After we read the beacon brum_trace we will be comparing it with the brum_trace we configured in users-map.yaml. If there is a match we will be persisting the data for the respective user to the CluckHouse table and backup folder.

If there is no match we will be just doing a backup of the data to a folder called unknown. We don't need to store this data in ClickHouse.

expire

We will be checking the configured expire date:

  1. If the check passes then we will be persisting the data for the respective user to the CluckHouse table and backup folder.
  2. If the check does not pass we will be just doing a backup of the data to a folder called expired. We don't need to store this data in ClickHouse.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions