Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

REQUIREMENTS

In order to install Learning Locker you will require a machine that has these minimum requirements:

GCC AND GIT

A good minimum set of requirements for Git and the GCC toolchain can be installed with the following commands:

FEDORA BASED SYSTEMS

Code Block
yum update
yum -y install curl git python make automake gcc gcc-c++ kernel-devel xorg-x11-server-Xvfb git-core

UBUNTU/DEBIAN BASED SYSTEMS

Code Block
apt-get update && apt-get upgrade
apt-get -y install curl git python build-essential xvfb apt-transport-https

NODE AND YARN INSTALLATION

There are multiple ways to install Node and Yarn (a package management system for Node). We would recommend the excellent NVM (Node Version Manager) which can be installed by following instructions here: https://github.com/creationix/nvm

...

Code Block
npm install -g yarn

PROCESS MANAGEMENT

PM2 is an excellent tool that can be used to manage the Node processes. It also handles log management/rotation and can automatically restart failed services. Learning Locker comes pre-packaged with some pm2 configuration scripts.

...

Code Block
pm2 install pm2-logrotate
pm2 set pm2-logrotate:compress true

USER BEST PRACTICE

It is always preferable that you do not run your Node processes as the root user. For this reason we would always suggest creating a new system user under which installation, builds and services can be run.

SETUP

The Learning Locker application is divided into two logically separate codebases, each of which can be configured to talk to the same Mongo and Redis instances.

...

More distribution specific information can be found inside the install script source code.

INSTALLING AND BUILDING THE LEARNING LOCKER UI, API AND WORKER

CLONE AND INSTALL

Clone the Learning Locker application into a new working directory on your server.

...

Code Block
npm_config_build_from_source=true yarn install --ignore-engines

BUILD

You are now ready to build the code. You have different option here depending on how you wish to deploy the services. The codebase has 5 distinct services that can be built:

...

If you wish to run the UI, API and Worker on the same machine and run CLI commands, you will probably want to build all the services in one simple command:

Code Block
yarn build-all

CONFIGURATION

Copy the .env.example into a new .env file and edit as required.

MIGRATIONS

The database requires some indexes adding and also when upgrading you will find migrations that take care of mutating your data where required.

Once your instance is configured, run required migrations using the below command.

Code Block
yarn migrate

INSTALLING THE XAPI SERVICE

CLONE AND INSTALL

Clone the xAPI Service into a new working directory on your server.

...

Code Block
yarn install --ignore-engines

BUILD

Code Block
yarn build

CONFIGURATION

Copy the .env.example into a new .env file and edit as required.

RUNNING THE SERVICES VIA PM2

If PM2 has been installed, you will be able to run the services using the preconfigured pm2 files in each codebase:

LEARNING LOCKER UI, API, WORKER

To start all 3 services, navigate to the LL working directory and run:

Code Block
pm2 start pm2/all.json

XAPI SERVICE

To start the xAPI service, navigate to the xAPI Service working directory and run:

Code Block
pm2 start pm2/xapi.json

CONFIG, STATUS AND LOGS

Note you may wish to copy and modify these pm2 config files based on your setup. Documentation can be found here.

...

Code Block
pm2 restart all

RUNNING THE SERVICES MANUALLY

If you wish to use a different process management tool (e.g. Supervisor) or simply wish to run them manually for testing, you can start the services with these commands.

RUNNING THE UI

Code Block
node ui/dist/server

RUNNING THE API

Code Block
node api/dist/server

RUNNING THE WORKER

Code Block
node worker/dist/server

RUNNING THE XAPI SERVICE

In your xAPI service directory

Code Block
node dist/server.js

SERVER CONFIGURATION

The application is accessed through 3 web interfaces, the UI, API and xAPI. Each of these is configured to run on independent ports but it is recommended you setup a server to sit infront of all traffic and route accordingly. An example nginx config can be seen here: nginx.conf.example