Skip to content

Instantly share code, notes, and snippets.

@mtvbrianking
Last active September 24, 2024 06:10
Show Gist options
  • Save mtvbrianking/f8f3bda11d7f97d5f7a616a087628d9c to your computer and use it in GitHub Desktop.
Save mtvbrianking/f8f3bda11d7f97d5f7a616a087628d9c to your computer and use it in GitHub Desktop.
TAO LMS

What is TAO?

TAO is an Open Source e-Testing platform that empowers you to build, deliver, and share innovative and engaging assessments online – in any language or subject matter.

TAO ("Computer-Based Testing" or Testing Assisté par Ordinateur in French), was created by the University of Luxembourg and is now maintained primarily by Open Assessment Technologies (OAT).

Resources

For a detailed documentation of the installation process please visit our Administrator Guide:

Other TAO Resources

Installation

User guide

Download stable release

cd /var/www

git clone --depth 1 --branch 3.6.0 https://github.com/oat-sa/package-tao.git academy

sudo usermod -aG www-data $USER

sudo chown -R $USER:www-data academy

sudo chmod -R g+rwX academy

sudo -su www-data

Enforce PHP v7.4

  {
      "require": {
+         "ext-curl": "*",
+         "ext-mbstring": "*",
+         "ext-zip": "*"
      }
      ...
      "config": {
+         "platform": {
+             "php": "7.4"
+         }
      }
  }

Install

composer install npm install

MathJax & PDFJS

sudo wget https://raw.githubusercontent.com/oat-sa/taohub-articles/refs/heads/master/articles/resources/third-party/MathJax_Install_TAO_3x.sh
sudo chmod u+x MathJax_Install_TAO_3x.sh
sudo ./MathJax_Install_TAO_3x.sh

sudo wget https://raw.githubusercontent.com/oat-sa/taohub-articles/refs/heads/master/articles/resources/third-party/PDFJS_Install_TAO_3x.sh
sudo chmod u+x PDFJS_Install_TAO_3x.sh
sudo ./PDFJS_Install_TAO_3x.sh

Database

Application

sudo mysql

mysql> SELECT DISTINCT user, host, authentication_string, password_expired FROM mysql.user;

mysql> CREATE USER 'jdoe'@'localhost' IDENTIFIED BY 'DkJFMf2@65MU';

mysql> CREATE DATABASE academy;

mysql> GRANT ALL PRIVILEGES ON academy.* TO 'jdoe'@'localhost';

mysql> FLUSH PRIVILEGES;

mysql> \q

mysql -h localhost -P 3306 -u jdoe -D academy -p'DkJFMf2@65MU'

CLI setup

Optional/Reuired Parameter Description
--db_driver Target available sgbd : pdo_pgsql, pdo_mysql, pdo_sqlsrv, pdo_oci.
--db_host Database location.
--db_name The Database name corresponds to the Module name.
Optional --db_pass Password to access to the database.
Required --db_user Login to access to the database.
--file_path|-f Path to where files should be stored.
--timezone|-t Timezone of the install.
--install_sent
--module_lang|-l The default language will be used when the language parameters are not specified for the graphical interface and the data.
--module_mode The deployment mode allow and deny access to resources regarding the needs of the platform.The test & development mode will enables the debugs tools, the unit tests, and the access to all the resources. The production mode is focused on the security and allow only the required resources to run TAO.
--module_namespace The module's namespace will be used to identify the data stored by your module. Each data collected by tao is identified uniquely by an URI composed by the module namespace followed by the resource identifier (NAMESPACE#resource).
Required --module_url|-url The URL to access the module from a web browser.
Required --user_login|-u The login of the administrator to be created.
Required --user_pass|-p The password of the administrator.
--import_local|-i States if the local.rdf files must be imported or not.
--instance_name|-n The name of the instance to install.
--extensions|-e Comma-separated list of extensions to install.
--verbose|-v Verbose mode.
sudo -u www-data php tao/scripts/taoInstall.php \
--db_driver pdo_mysql \
--db_host localhost \
--db_name academy \
--db_user jdoe \
--db_pass "DkJFMf2@65MU" \
--module_namespace https://academy.local/first.rdf \
--module_url https://academy.local \
--user_login jdoe \
--user_pass "1xsCIet0p4Rb0Zjc" \
-e taoCe

Web Server

SSL

sudo mkcert -cert-file /etc/nginx/ssl/academy.local.crt -key-file /etc/nginx/ssl/academy.local.key academy.local

Register host (only on localhost)

sudo vi /etc/hosts

  127.0.0.1    localhost
  127.0.1.1    jdoe-pc
+ 127.0.0.1    www.academy.local    academy.local

Nginx config

sudo vi /etc/nginx/sites-available/academy.local

server {
    listen 80;
    listen [::]:80;
    server_name academy.local www.academy.local;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    listen [::]:443;
    server_name academy.local www.academy.local;
    ssl_certificate     /etc/nginx/ssl/academy.local.crt;
    ssl_certificate_key /etc/nginx/ssl/academy.local.key;
    ssl_protocols       TLSv1.2 TLSv1.3;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    root /var/www/academy;

    access_log /var/log/nginx/academy_access.log;
    error_log /var/log/nginx/academy_error.log;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

    index index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        # fastcgi_param PHP_VALUE "max_execution_time=300";
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}
sudo ln -s /etc/nginx/sites-available/academy.local /etc/nginx/sites-enabled/

sudo nginx -t

sudo service nginx restart

https://academy.local/tao/install

Issues

  1. Disable PROD env mode

config/generis/generis.conf.php

  #mode
- define('DEBUG_MODE', false);
+ define('DEBUG_MODE', true);
  1. Enable logs

config/generis/log.conf.php

// return new oat\oatbox\log\LoggerService();

return new oat\oatbox\log\LoggerService(array(
    'logger' => array(
        'class' => \oat\oatbox\log\logger\TaoMonolog::class,
        'options' => array(
            'name' => 'tao',
            'handlers' => array(
                array(
                    'class' => \Monolog\Handler\StreamHandler::class,
                    // 'options' => array('/var/www/tao/package-tao/test-log.log', \Monolog\Logger::DEBUG),
                    'options' => array('/var/www/tao/tao.log', \Monolog\Logger::ERROR),
                ),
            ),
        )
    )
));

tail -f tao.log

  1. Increase max execution time to seed sample data
# Nginx
Syntax:	fastcgi_read_timeout time;
Default: fastcgi_read_timeout 60s;
Context: http, server, location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment