/platform-api

Cross modal, cross cultural, cross lingual, cross domain, and cross site global OER network

Primary LanguageJavaScriptBSD 2-Clause "Simplified" LicenseBSD-2-Clause

X5GON Platform API

Node Node.js CI Linux Build OSX Build License

The X5GON project stands for easily implemented freely available innovative technology elements that will converge currently scattered Open Educational Resources (OER) available in various modalities across Europe and the globe.

preprocessing pipeline

This project contains the code base used to setup the main component that connects different services together. The project contains various services:

  • Platform API. Contains the Platform API and redirections to other microservices. The code is found in the platform folder. In addition, the platform service also serves the frontend, which can be found in ./platform/frontend folder. The frontend is a submodule whose code base is found here.

  • Recommender Engine. Contains the code for providing recommendations. The code is found in the recsys folder.

  • Search API. The Search API is included as a submodule. The code will be stored in the search folder, but The whole documentation and code of the service is found here.

A component that is not included within this repository is the X5GON Processing Pipelines. The code is separated so that the data processing part can be done on another machine. The communication between the Platform and Processing Pipelines is done through the Apache Kafka, which is part of the Processing Pipeline code base.

Prerequisites

  • A running Elasticsearch service (one can download and install it from here or use a docker image). NOTE: Required for the Search API

  • PostgreSQL version 10 or greater

  • NodeJS version 10 or greater

    To test that your nodejs version is correct, run node --version in the command line.

Installation

  • Have a running PostgreSQL database and Elasticsearch service

  • Make a clone of this repository

    git clone https://github.com/X5GON/platform-api.git
    # navigate into the project
    cd platform-api
  • Recursively download all submodules (i.e. the search and frontend).

    git submodule update --init
  • Create an .env file in the /env folder (see instructions).

  • Install the nodejs dependencies and prepare submodule dependencies:

    npm run build
  • Configure submodule dependencies:

  • Create the x5gon database where all of the data is going to be stored:

    # switch to the postgres user and create the 'x5gon' database
    sudo su postgres && createdb x5gon && exit
    # create the tables in the database
    npm run postgres:create
  • Create the recommendation models:

    npm run recsys:create  

Running the Services

The easiest way to run the services is with PM2. This will run them in the background, will automatically restart if the services crash and is fully configurable through the ./ecosystem.config.services.yml file.

To install PM2 one must run

# global install PM2
npm install -g pm2

To run the service using PM2 one must simply run the following command:

pm2 start ecosystem.config.services.yml --env production

This will also run the pipelines in the background. To control the pm2 services please see their documentation.