Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Background: 

Currently, Sunbird has one portal instance that has all the modules and has multiple tenant support. If a tenant request any changes to an existing feature or a new feature, all tenants will get these changes as well.

Problem statement:

Sunbird should support experimenting with the portal, which allows customers to load the different portal app/module with new features. This should follow the below principle

  1. Experiment feature should be isolated from the main app.
  2. Deployment of the experiment should not affect the main app.
  3. Loading of the experiment app should be configurable and loading logic should reside in the server.
  4. Determine experiment Id  and fetch experiment details before the app loads .
  5. It should not have any impact on the load times for the users who are not part of an experiment.
  6. All telemetry generated from the portal thereafter should contain the experiment id (in tags section)

Prerequisites :- 

  • APP_INITIALIZER :- The "APP_INITIALIZER" is an instance of InjectionToken in angular that  will be executed when an application is initialized. We will make use of it and perform our device register call and get the experiment details at this step.
  • Currently device register call is done after the app is initialized.

Loading Experiment specific app:

Solution :- 



Workflow for Anonymous users  : -

  1. Anonymous user opens the sunbird portal .
  2. App_initializer factory method is called before the app loads.
    1. generate the Did from browser. 
    2. Check whether any experiment is set for this user instance (inside locals).
    3. If no experiment is set then , check whether he/she is a non logged in user.
    4. By this time we will have the url and  did info.
    5. we will make a device register call passing "url and did"as extra parameters to fetch the experiment details .
      1. If no experiment is present then we will continue with the normal portal flow and load the default app . This will have no impact on the page load time.
      2. If any experiment is present then
        1. Reload the app passing experiment details in encoded form .
        2. There will be a middleware for the anonymous routes that will look for experiment details .
        3. Fetch the experiment build.
          1. Set the experiment Id and render the experiment app
        4. If no experiment dist found reload the app with normal app.
  3. App is reloaded with experiment Id set 
    1. Again App_initializer factory method is called before the app loads.
      1. this time experiment id is set so all steps are skipped and it loads the experiment app.
      2. initialise the telemetry with experiment id set in tags .


Workflow for Logged in users  : -

  1. Logged in User opens the sunbird portal .
  2. App_initializer factory method is called before the app loads.
    1. Check whether any experiment is set for this user instance (inside locals).
    2. If no experiment is set then , check whether he/she is a logged in user.
    3. By this time we will have the url , uid and did info.
    4. we will make a device register call passing "url ,did and userId "as extra parameters to fetch the experiment details .
      1. If no experiment is present then we will continue with the normal portal flow and load the default app . This will have no impact on the page load time.
      2. If any experiment is present then
        1. Reload the app passing experiment details in encoded form .
        2. There will be a middleware for the logged in routes that will look for experiment details .
        3. Fetch the experiment build.
          1. Set the experiment Id and render the experiment app
        4. If no experiment dist found reload the app with normal app.
  3. App is reloaded with experiment Id set 
    1. Again App_initializer factory method is called before the app loads.
      1. this time experiment id is set so all steps are skipped and it loads the experiment app.
      2. initialise the telemetry with experiment id set in tags .

Deployment:

Solution 1: Store experiment app build in common blob folder with experiment Id as a folder name.


                                    


Each experiment will have its respective repo/branch. Sunbird will have common blob folder for the experiment application folder. Each experiment can be deployed from different branches to a common folder. This isolates a different experiment build. One can happen without affecting other or core build. Deployment steps/config will be same for all experiment only config that changes are branch and dist folder. This should to same as experimentId.


  • No labels