Skip to content

Latest commit

 

History

History
218 lines (144 loc) · 10.6 KB

README.md

File metadata and controls

218 lines (144 loc) · 10.6 KB

Interface Service

CircleCI Duplicated Lines (%) Coverage VulnerabilitiesPrettier Docs Docs

GitHub package.json version (subfolder of monorepo) License

CircleCI insights

CircleCI


The Interface service building block enables ELEVATE capabilities such as Mentoring, Projects, and Survey to be easily deployed into existing platforms with no changes needed in the respective core services. In any deployment of ELEVATE capabilities, all the components i.e. backend micro-services and portal talk to each other via the Interface service only, hence any one of them can be replaced with other similar blocks making it easy to integrate these capabilities into existing implementations. Changes, if any are done in isolated npm packages specific to each installation thereby leaving the rest of the services untouched and out of the risk of any issues being introduced.

Interface Service Deployment View

Mentoring

Project and Survey


System Requirements

  • Operating System: Ubuntu 22
  • Node.js: v20
  • Apache Kafka®: 3.5.0

Setup Options

Elevate interface-service services can be setup in local using two methods:

Dockerized service with local dependencies(Intermediate)

A. Dockerized Service With Local Dependencies

Expectation: Run single docker containerized service with existing local (in host) or remote dependencies.

Coming soon...

Local Service with local dependencies(Hardest)

B. Local Service With Local Dependencies

Expectation: Run single service with existing local dependencies in host (Non-Docker Implementation).

Installations

Install Node.js LTS

Refer to the NodeSource distributions installation scripts for Node.js installation.

$ curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

Install Build Essential

$ sudo apt-get install build-essential

Install PM2

Refer to How To Set Up a Node.js Application for Production on Ubuntu 22.04.

Run the following command

$ sudo npm install pm2@latest -g

Setting up Repository

Clone the mentoring repository to /opt/backend directory

opt/backend$ git clone -b develop-2.5 --single-branch "https://github.com/ELEVATE-Project/interface-service.git"

Install Npm packages from src directory

backend/interface-service/src$ sudo npm i

Create .env file in src directory

interface-service/src$ sudo nano .env

Copy-paste the following env variables to the .env file:

APPLICATION_PORT=3569
API_DOC_URL= /interface/api-doc
APPLICATION_ENV= development
MENTORING_SERVICE_BASE_URL= http://localhost:3000
NOTIFICATION_SERVICE_BASE_URL= http://localhost:7201
REQUIRED_PACKAGES= "[email protected] [email protected] [email protected]"
SCHEDULER_SERVICE_BASE_URL= http://localhost:7401
SUPPORTED_HTTP_TYPES= "GET POST PUT PATCH DELETE"
USER_SERVICE_BASE_URL= http://localhost:3001
created_time= "2024-02-07T04:51:22.789813746Z"
custom_metadata= null
destroyed= false
version= 21

Start the Service

Navigate to the src folder of interface service and run pm2 start command:

interface-service/src$ pm2 start app.js -i 2 --name elevate-interface

Run pm2 ls command

$ pm2 ls

Output should look like this (Sample output, might slightly differ in your installation):

┌────┬─────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name                    │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├────┼─────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 1  │ elevate-interface       │ default     │ 1.0.0   │ cluster │ 79252    │ 2D     │ 0    │ online    │ 0%       │ 79.2mb   │ jenkins  │ disabled │
│ 2  │ elevate-interface       │ default     │ 1.0.0   │ cluster │ 79262    │ 2D     │ 0    │ online    │ 0%       │ 78.7mb   │ jenkins  │ disabled │
└────┴─────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘

This concludes the interface service and dependency setup.

Save and exit.


Run tests

Integration tests

npm run test:integration

To know more about integration tests and their implementation refer to the project Wiki.

Unit tests

npm test

Used in

This project was built to be used with Mentoring Service, Project Service, Survey Service, User Service.

The frontend/mobile application for Mentoring repo and Projects and Survey repo

You can learn more about the full implementation of various capabilities of ELEVATE here .

Team


Open Source Dependencies

Several open source dependencies that have aided Mentoring's development:

NodeJS MongoDB Apache Kafka Jest Git