Ops Tool is browser based application developed by DIKSHA to carry out various operations related tasks like accessing the details of Users, Contents etc and perform the support activities such as uploading the users, contents, downloading the reports, certificates etc., without explicitly providing the API access to each individual person in the operations team.
Installing Ops Tool requires three primary software components:
- Ops Tool web application or Angular Client
- Ops Tool Backend API interface or Node Server
- Database
Software dependencies | |
---|---|
Node | > 16.x.x |
Angular CLI | > 11.x.x |
MySQL Server | 8.0 |
nodemon | Latest version of nodemon: npm install -g nodemon |
Python | Python 3 |
ffmpeg | --- |
azcopy | --- |
-
Clone project
git clone https://github.com/DIKSHA-NCTE/Diksha-Support-Tool.git
Note: The setup steps from step 2 to step 7 can also be performed by an automated script (setup.sh) available in the root directory.
-
Install required dependencies
-
Ops Tool web application
- $ cd {PROJECT-FOLDER}/Ops-Tool-Client
- $ npm install
-
Ops tool backend API interface
- $ cd {PROJECT-FOLDER}/Ops-Tool-Server
- $ npm install
-
-
Configuring .env file
-
$ cd {PROJECT-FOLDER}/Ops-Tool-Server
-
Create a file with filename
.env
-
Copy paste the below contents in .env file and replace the values accordingly based on the environment (dev/production)
BASE=<host for adopter's instance> KEYCLOCKBASE=<base url of keycloak server> API_KEY=Bearer <api key> SECRET=<ops tool keycloak client secret> RESOURCE=<ops tool keycloak client id> DATAEXHAUSTKONGAPIURL=<exhaust report kong api url> BLOB_ACCOUNT=<blob account client> EXHAUSTREPORTSAS=<SAS token for exhaust report blob folder> BROADCASTCONTENTSAS=<SAS token for broadcast contents blob folder>
-
-
Edit the application configuration
Open
<PROJECT-FOLDER>/Ops-Tool-Client/src/environments/environtment.ts
in any available text editor and update the contents of the file so that it contains exactly the following values :export const environment = { production: false, PLAY_URL: '<host for adopter's instance>/play/content/', base : '<host for adopter's instance>/api/', key_base : '<host for adopter's instance>', LOCALHOST : '<host for adopter's ops tool instance>/api/', RESOURCE: '<ops tool keycloak client id>', };
Note: For production environment the above values need to be updated in
<PROJECT-FOLDER>/Ops-Tool-Client/src/environments/environtment.prod.ts
withproduction: true
value.
Open
<PROJECT-FOLDER>/Ops-Tool-Server/config/config.development.js
in any available text editor and update the contents of the file so that it contains exactly the following values :{ "database": { "connectionLimit": 10, "host": "localhost", "user": "root", "password": "<DB-password>", "database": "ETBPROCESS" }, "server": { "port": 3000 }, "keycloak": { "auth_server_url": "<host for adopter's instance>/auth", "resource": "<ops tool keycloak client id>" } }
Note: For production environment the above values need to be updated in
<PROJECT-FOLDER>/Ops-Tool-Server/config/config.production.js
. -
Database Setup
From terminal run below commands in the following order:
1. $ mysql -u root -p 2. $ source {PROJECT-FOLDER PATH}/Ops-Tool/Ops-Tool-Server/db-scripts/ETBPROCESS.sql 3. $ ETBPROCESS < {PROJECT-FOLDER PATH}/Ops-Tool/Ops-Tool-Server/db-scripts/constants.sql 4. $ ETBPROCESS < {PROJECT-FOLDER PATH}/Ops-Tool/Ops-Tool-Server/db-scripts/modules.sql
-
Creating static server directories
- $ cd {PROJECT-FOLDER}/Ops-Tool-Server
- $ mkdir uploads
- $ cd uploads
- $ mkdir course-reports csvOutput input self-signup-user-reports streamedOutput
-
Form Configuration
All the available forms for the Ops Tool can be found in
<PROJECT-FOLDER>/Ops-Tool-Server/config/forms
folder.Following is the sample curl for creating the forms for Ops Tool :
curl --location --request POST '{{host}}/api/data/v1/form/create' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer {{api_key}}' \ --data-raw '{ "request": { "type": "filter", "subType": "contents", "action": "search", "component": "tools", "framework": "*", "rootOrgId": "*", "data": { "templateName": "defaultTemplate", "action": "search", "fields": [ { "index": 0, "label": "Tenants", "description": "Choose from a list of tenants", "placeholder": "Choose a Tenant", "property": "rootOrgId", "dataType": "array", "inputType": "search", "options": [], "visible": true, "editable": true, "required": false, "multiple": false, "api": { "type": "tenant-search", "body": "{ \"request\": { \"filters\": { \"isRootOrg\": true, \"isTenant\": true }, \"offset\": 0, \"limit\": 1000, \"sort_by\": {}, \"fields\": [\"identifier\", \"orgName\", \"channel\", \"isTenant\", \"isRootOrg\"] } }", "token": true } } ] } } }'
Note: All the forms in the
<PROJECT-FOLDER>/Ops-Tool-Server/config/forms
folder need to be created by replacing the request body in above curl for each form. -
Google Authentication Setup
Follow the steps provided here to generate credentials.json
and token.json
files and copy these two files to PROJECT-FOLDER>/Ops-Tool-Server
folder.
-
Ops Tool web application
- Run the following command in the {PROJECT-FOLDER}/Ops-Tool-Client folder
- $ npm run build-dev (for development build) or $ npm run build-prod (for production build)
- 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}/Ops-Tool-Server folder
- $ npm run start-dev (for development environment)
-
The local HTTP server is launched at
http://localhost:3000