Giter Club home page Giter Club logo

learninglocker2's Introduction

Learning Locker version 2 in Docker

It is a dockerized version of Learning Locker (LL) version 2 based on the installation guides at http://docs.learninglocker.net/guides-custom-installation/

Architecture

For LL's architecture consult http://docs.learninglocker.net/overview-architecture/

This section is about the architecture coming out of this dockerization.

Official images of Mongo, Redis, and xAPI service are used. Additionally, build creates two Docker images: nginx and app. LL application services are to be run on containers based on the app image.

File docker-compose.yml describes the relation between services. A base configuration consists of 7 containers that are run using the above-mentioned images (LL application containers - api, ui, and worker - are run using image app).

The only persistent locations are directories in $DATA_LOCATION (see below), which are mounted as volumes to Mongo container and app-based containers.

The origin service ui expects service api to work on localhost, however in this dockerized version the both services are run in separate containers. To make connections between those services work, socat process is run within ui container to forward local tcp connections to api container.

Usage

To build the images:

./build-dev.sh

To configure adjust settings in .env:

  • DOCKER_TAG - git commit (SHA-1) to be used ("dev" for images built by build-dev.sh)
  • DATA_LOCATION - location on Docker host where volumes are created
  • DOMAIN_NAME - domain name as the instance is to be accessed from the world
  • APP_SECRET - LL's origin setting: Unique string used for hashing, Recommended length - 256 bits
  • SMTP_* - SMTP connection settings (for TLS config, see here)

To run the services:

docker-compose up

Open the site and accept non-trusted SSL/TLS certs (see below for trusted certs).

To create a new user and organisation for the site:

docker-compose exec api node cli/dist/server createSiteAdmin [email] [organisation] [password]

Production usage

Deployment

Preparing a remote machine for the first time, put .env file to the machine and adjust the settings as given above.

To deploy a new version (git commit) to the machine, set DOCKER_TAG in .env to the git commit (SHA-1), copy docker-compose.yml of the git commit to the machine (see the SSL/TLS notice below), and just call the command:

docker-compose up -d

SSL/TLS certs

Mount cert files to nginx container adding a section in docker-compose.yml:

     volumes:
        - "/path-to-certs-on-docker-host/fullchain.pem:/root/ssl/fullchain.pem:ro"
        - "/path-to-certs-on-docker-host/privkey.pem:/root/ssl/privkey.pem:ro"

Backups

Backup $DATA_LOCATION, i.e. the Docker volumes: Mongo's data and app's storage.

Upgrading

In app/Dockerfile, git tag of LL application is declared. In docker-compose.yml, image tag of xAPI service is declared. The versions (tags) in use can be easily adjusted as needed.

After upgrading these versions, you shall usually proceed as follows:

docker-compose pull
docker-compose stop xapi worker ui api nginx
docker-compose run --rm api yarn migrate
docker-compose up

learninglocker2's People

Contributors

michzimny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

learninglocker2's Issues

SSL/TLS certs inside Docker Desktop (Windows) doesn't seem to work

I'm trying to setup a LearningLocker LRS via Docker Desktop on Windows. Everything is working fine when performing a docker-compose up -d on the provided docker-compse.yml with DOCKER_TAG=74018651d4b6013a6432eb3147a02fbd4804657b inside my .env-file. This allows me to have a working LRS via http://localhost/.

However, in order to connect to the LRS by means of the TinCan.NET Nuget packages, the package code is requiring SSL.

Following the instructions in the "Production usage" -> "SSL/TLS certs" section of this repository, I however can't seem to load the provided certificates into nginx, providing the following error: [emerg] 1#1: PEM_read_bio_X509_AUX("/root/ssl/fullchain.pem") failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line:Expecting: TRUSTED CERTIFICATE)

Because of Docker inside Windows, I needed to change the volumes code for the nginx container a bit (apparently, I also needed to declare the folder to be mounted):
volumes:
- "/xAPI pitch/LearningLocker/ssl:/root/ssl"
- "/xAPI pitch/LearningLocker/ssl/fullchain.pem:/root/ssl/fullchain.pem:ro"
- "/xAPI pitch/LearningLocker/ssl/privkey.pem:/root/ssl/privkey.pem:ro"

removing first entry (the folder mounting) provides the following docker error:
ERROR: for learninglocker_nginx_1 Cannot start service nginx: b'OCI runtime create failed: container_linux.go:346: starting container process caused "process_linux.go:449: container init caused \\"rootfs_linux.go:58: mounting \\\\\\"/xAPI pitch/LearningLocker/ssl/fullchain.pem\\\\\\" to rootfs \\\\\\"/var/lib/docker/overlay2/d98b862d8d475f199dbb09937b8cf9c317766f6b0b6a5c15ea2f841cacf0429d/merged\\\\\\" at \\\\\\"/var/lib/docker/overlay2/d98b862d8d475f199dbb09937b8cf9c317766f6b0b6a5c15ea2f841cacf0429d/merged/root/ssl/fullchain.pem\\\\\\" caused \\\\\\"not a directory\\\\\\"\\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type'

Am I doing this right, or am I missing something that could easily resolve this problem?

Thanks in advance!

Met some memory limit of MongoDB

Recently I got many times the error message "Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit.", while using the Query Builder, more precisely when trying to create interactively a clause OR-ing many object ids. Said message is emitted by LL when constructing an option list with items representing automatic continuations of the user input. See also: https://stackoverflow.com/questions/54396869/mongo-exec-error-operationfailed-sort-operation-used-more-than-the-maximum-3

I don't know if someone can change the LL configuration appropriately. However, the suggestion "or specify a smaller limit" confuses me a bit.

Accessing the Aggregation HTTP interface

With the remote idea of recurring to the HTTP Aggregation API, in order to overcome some limitations of the LL Dashboard, I wanted to test the possibility of calling it from a Jupyter notebook. Then, I've tried to send a request to the url https://lrs.test.up2university.eu/api/statements/aggregate , following the simplest example in http://docs.learninglocker.net/http-aggregation/

Since I was getting a 400 HTTP response (bad request), in my request I've tried to change the port to 8080 (example value from the LL Configuration guide): I got a timeout error after that the Python kernel of Jupyter was busy for a few minutes.

Reverting to the 80 port, I repeatedly got from the Python library urllib3 an SSLError (SSL: UNKNOWN_PROTOCOL).
Now I get again a quick response (400 - bad request) only using the http protocol in place of https.

Does somebody know what it the correct endpoint to use, including protocol and port?
Should I ask Nadav?
Thanks.

LL upgrade

@gtoffoli, we're currently using v2.0.5 of LL, so it's a year old. Shall we upgrade to a more recent one and try to see if the user experience is better then?

Upgrading to 3.x

We have now Learning Locker in latest 2.x version (i.e. 2.8.2) which is also the latest version at all as of 25th February 2019.

Since 25 Feb 2019, the LL maintainers released version 3.0 and some subsequent bug-fixing releases. Within the last two weeks, they have shared around 8 releases of the 3.x branch (i.e. a release every 1-2 days), and thus, it makes the impression that 3.x is not yet fully stable. I think that we should upgrade to 3.x later when it gets more mature.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.