SunbirdED Portal
The Sunbird portal is the browser-based interface for the Sunbird application stack. It provides a web app through which all Sunbird functionality can be accessed.
Getting started
To get started with the Sunbird portal, please try out our cloud-based demo site at: https://staging.sunbirded.org
Table of contents
Prerequisites
Operating System
MAC OS X 10.0 and above/Linux Windows (not verified). Take it with your own expertise(no community support, but open for contribution).
RAM
> 6 Gb
CPU
2 cores, >2 GHz
> 14.x.x (Install the latest release of LTS version)
> 11.x.x (Install the latest Angular CLI version)
Latest version of yarn: npm install --global yarn
Latest version of nodemon: npm install -g nodemon
Project Setup
Clone project
git clone https://github.com/Sunbird-Ed/SunbirdEd-portal.git
Note: Stable versions of the sunbird portal are available via tags for each release, and the master branch contains latest stable release. For latest stable release refer
Install required dependencies
Sunbird portal or web application
$ cd {PROJECT-FOLDER}/src/app/client
$ yarn install
Sunbird services stack or the backend API interface
$ cd {PROJECT-FOLDER}/src/app
$ yarn install
Configuring the Environment and Services Stack
Configure the following system environment variables in the terminal which you have opened
| Environment Variable | Value | Data Type | | :------------------------ | ------- | --------- | | sunbird_environment | local | string | | sunbird_instance | sunbird | string | | sunbird_default_channel | sunbird | string | | sunbird_default_tenant | sunbird | string |
The initialization of these environmental variables can take place in a common place like in your .bashrc or .bash_profile
Edit the Application Configuration
Open
<PROJECT-FOLDER>/src/app/helpers/environmentVariablesHelper.js
in any available text editor and update the contents of the file so that it contains exactly the following valuesmodule.exports = { // 1. LEARNER_URL LEARNER_URL: env.sunbird_learner_player_url || <'https://<host for adopter's instance>', // 2. CONTENT_URL CONTENT_URL: env.sunbird_content_player_url || <'https://<host for adopter's instance>', // 3. CONTENT_PROXY CONTENT_PROXY_URL: env.sunbird_content_proxy_url || <'https://<host for adopter's instance>', PORTAL_REALM: env.sunbird_portal_realm || 'sunbird', // 4. PORTAL_AUTH_SERVER_URL PORTAL_AUTH_SERVER_URL: env.sunbird_portal_auth_server_url || <'https://<host for adopter's instance>', PORTAL_AUTH_SERVER_CLIENT: env.sunbird_portal_auth_server_client || "portal", ... PORTAL_PORT: env.sunbird_port || 3000, // 5. PORTAL_API_AUTH_TOKEN PORTAL_API_AUTH_TOKEN: env.sunbird_api_auth_token || User generated API auth token ... // 6. PORTAL_ECHO_API_URL PORTAL_ECHO_API_URL: env.sunbird_echo_api_url || '', ... }
These are the mandatory keys required to run the application in Local environment. Please update them with appropriate values in
<PROJECT-FOLDER>/src/app/helpers/environmentVariablesHelper.js
| Environment Variable | Data Type | Description | | :-------------------------------------| ---------- | ------------------------------------- | | sunbird_azure_account_name | string | Azure account Name | | sunbird_azure_account_key | string | Azure Account Key | | sunbird_aws_region | string | Region for AWS account | | KONG_DEVICE_REGISTER_ANONYMOUS_TOKEN | boolean | Flag value to allow anonymous user | | sunbird_anonymous_device_register_api| string |The API for registering anonymous device| | sunbird_anonymous_register_token | string | Token to register anonymous device | | SB_DOMAIN | string | The host for Sunbird Environment | | PORTAL_API_AUTH_TOKEN | string | User generated API auth token |
Once the file is updated with appropriate values, then you can proceed with running the application
Running Application
Sunbird portal or web application
Run the following command in the {PROJECT-FOLDER}/src/app/client folder
$ ng build --watch=true
Wait for the build process to complete before proceeding to the next step
Sunbird services stack or the backend API interface
Run the following command in the {PROJECT-FOLDER}/src/app folder
$ npm run server
The local HTTP server is launched at
http://localhost:3000
Project Structure
.
βββ Sunbirded-portal
| βββ /.circleci #
β | βββ config.yml # Circleci Configuration file
| βββ /experiments # -|-
| βββ /src/app # Sunbird portal or web application
β | βββ /client # -|-
β | | βββ src # -|-
β | βββ /helpers # Helpers and Service file
β | βββ /libs # Sunbird utilities
β | βββ /proxy # Redirection to respective services
β | βββ /resourcebundles # Language resources
β | βββ /routes # Sunbird Backend Routes
β | βββ /sunbird-plugins # Sunbird plugins for editors
β | βββ /tests # Test case scripts for helpers and routes
β | βββ framework.config.js # Default framework configuration
β | βββ gulp-tenant.js # -|-
β | βββ gulpfile.js # Gulp build configuration
β | βββ package.json # Contains Node packages as specified as dependencies in package.json
β | βββ server.js # Main application program file / entry file for Sunbird services stack or the backend API interface
βββββββ .gitignore # git configuration to ignore some files and folder
Testing
Sunbird portal or web application
1. $ cd {PROJECT-FOLDER}/src/app/client 2. $ npm run test 3. With Coverage $ npm run test-coverage
Sunbird services stack or the backend API interface
1. $ cd {PROJECT-FOLDER}/src/app 2. $ npm run backend-test 3. With Coverage $ npm run backend-test-with-coverage
Last updated