ADL Learning Record Store (LRS)

repository·master·Indexed 43 days ago

https://github.com/adlnet/adl_lrs

A Docker-based implementation of the official ADL LRS designed to automate the installation and deployment of an xAPI Learning Record Store. This implementation supports the IEEE 9274.1.1 Base Standard (xAPI 2.0) and includes integrated support for Postgres, Redis, RabbitMQ, and Nginx with Certbot SSL automation.

Tokens
2.2K
Snippets
13
Records
15
Agent score
56%

What's inside ADL LRS

  1. Configure SSL with Certbot

    master

    The project includes a Certbot container to generate SSL certificates for publicly available domains.

    To generate a certificate and automatically restart the nginx container with the new certificate, run: sudo ./certbot/generate.sh <your-domain-name>

    If the generation fails, you can restore a temporary SSL certificate using: sudo ./init-ssl.sh <your-domain-name>

    sudo ./certbot/generate.sh <your-domain-name>
  2. Install ADL LRS via Docker

    master

    The recommended method for installing the ADL LRS is using Docker and Docker Compose. This implementation is designed to support the IEEE 9274.1.1 Base Standard (xAPI 2.0).

    Note: The current version is considered stable but is intended as a proof of concept for a limited number of users.

    # Use Docker and Docker Compose for installation
    # Refer to the project wiki for detailed step-by-step instructions
  3. Set a custom Site Name in Django

    master

    By default, the LRS uses example.com as the site name. To change this to a custom domain and name, follow these steps:

    1. Enter the Django shell: sudo ./open-shell.sh
    2. Run the following commands within the shell to create the new site:
      from django.contrib.sites.models import Site
      site = Site.objects.create(domain='your.domain.com', name='Your Site Name')
      site.save()
    3. Update your settings.ini file to use the new SITE_ID (which will be 2 if it was the second site created):
      [site]
      SITE_ID: 2
    from django.contrib.sites.models import Site
    site = Site.objects.create(domain='your.domain.com', name='Your Site Name')
    site.save()
  4. Create an Admin Account for the LRS

    master

    The Docker implementation does not create a Django superuser by default. Once the LRS service is fully available (this may take some time after the containers are up), you can create an admin account by running the create-admin.sh script from the project root. This user only needs to be created once, as the Postgres container persists data across sessions.

    sudo create-admin.sh
  5. Access ADL LRS configuration and maintenance guides

    master

    The following resources are available via the project wiki to assist with advanced setup and maintenance:

    • Infrastructure: Setting up Nginx and uWSGI.
    • Security: OAuth implementation help.
    • Database: Procedures for clearing the database.
    • Development: Information on test coverage and code profiling with cProfile.
  6. Install the ADL LRS via Docker

    master

    To set up a local instance of the ADL LRS using Docker, follow these steps to clone the repository, configure environment files, and build the containers. Note that the LRS service may take several minutes to become fully available after the containers start due to dependencies on RabbitMQ and Postgres.

    Quickstart Steps

    1. Clone the repository: git clone https://github.com/adlnet/ADL_LRS
    2. Navigate to the docker directory: cd ADL_LRS/docker
    3. Prepare configuration files:
      • cp .env.example .env
      • cp settings.ini.example settings.ini
    4. Install prerequisites: sudo install-reqs.sh
    5. Initialize local SSL (for localhost): sudo init-ssl.sh localhost
    6. Build and start containers: sudo rebuild.sh (or use docker-compose directly).

    Monitoring the Setup

    You can monitor the startup process and check for errors using: sudo docker logs -f docker_lrs

    Once complete, the LRS should be accessible at https://localhost:8000 (unless the port was changed in the docker-compose file).

    git clone https://github.com/adlnet/ADL_LRS
    cd ADL_LRS/docker
    cp .env.example .env
    cp settings.ini.example settings.ini
    sudo install-reqs.sh
    sudo init-ssl.sh localhost
    sudo rebuild.sh
  7. Configure Database and SMTP settings

    master

    Configuration for the database and email services is managed via the /lrs/settings.ini file.

    Database Configuration

    Modify the values under the [database] header in /lrs/settings.ini to connect to a different database.

    SMTP (Email) Configuration

    Modify the values under the [email] header in /lrs/settings.ini.

    • Google: Use standard Google settings.
    • Office 365 / Other providers: Ensure you enable TLS rather than SSL.
  8. Configure RabbitMQ (AMQP) for activity metadata

    master

    The amqp service (using RabbitMQ) is required for activity metadata. You can configure the Erlang cookie, default user, password, and virtual host via environment variables.

    amqp:
      image: "rabbitmq:3-management"
      environment:
        RABBITMQ_ERLANG_COOKIE: "SWQOKODSQALRPCLNMEQG"
        RABBITMQ_DEFAULT_USER: "rabbitmq"
        RABBITMQ_DEFAULT_PASS: "rabbitmq"
        RABBITMQ_DEFAULT_VHOST: "/"
  9. Configure the Nginx proxy and SSL automation

    master

    The nginx service acts as a proxy for LRS traffic on ports 80 and 443. It requires a HOSTNAME build argument. SSL automation is handled by the certbot service, which shares volumes with Nginx for certificate management.

    nginx:
      build: 
        context: docker/nginx
        args:
          HOSTNAME: "${HOSTNAME}"
      ports:
        - "80:80"
        - "443:443"
      volumes:
        - ./docker/nginx/letsencrypt:/usr/share/nginx/html
        - ./docker/certbot/etc:/usr/share/keys
      links:
        - lrs
    
    certbot:
      image: certbot/certbot
      volumes:
        - ./docker/keys:/var/lib/letsencrypt
        - ./docker/nginx/letsencrypt:/data/letsencrypt
        - ./docker/certbot/etc:/etc/letsencrypt
        - ./docker/certbot/log:/var/log/letsencrypt
      depends_on:
        - nginx
  10. Configure the Postgres database for LRS statements

    master

    The postgres service stores LRS statements. You can configure the database name, user, and password using environment variables. Data is persisted to the local directory ./docker/data/postgres.

    postgres:
      image: library/postgres:9.5
      environment: 
        POSTGRES_DB: lrs
        POSTGRES_USER: lrs_owner
        POSTGRES_PASSWORD: lrs_password
      volumes:
        - ./docker/data/postgres:/var/lib/postgresql/data
  11. Configure the ADL LRS service

    master

    The lrs service runs the core ADL LRS logic via uWSGI. It depends on the postgres and amqp services. Logs are persisted to ./docker/data/lrs/logs.

    lrs:
      build: 
        context: .
      ports:
        - "127.0.0.1:8000:8000"
      links:
        - postgres
        - amqp
      volumes:
        - ./docker/data/lrs/logs:/opt/lrs/logs