Giter Club home page Giter Club logo

learninglocker2-docker'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 -d

BUT, for the first time, as Mongo requires some significant time to start up, you should rather:

docker-compose up -d mongo  # launch Mongo first
docker-compose logs -f mongo  # wait until Mongo gets ready
docker-compose up -d   # launch all the other services

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

Keep also in mind the note given above that for the first launch, it might be good to start Mongo only in the first step.

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-docker's People

Contributors

michzimny avatar

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.