A platform offering teachers and educational designers the capacity to use data to personalise the experience for the learners.
Clone or download
Pull request Compare This branch is 682 commits ahead, 1220 commits behind abelardopardo:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
backend
dev
frontend
.gitignore
CODEOWNERS
README.md
docker-compose.yaml
startup.sh
terminate.sh

README.md

OnTask v2.5

Running the application

For development

  1. Perform the configuration steps outlined here
  2. Install Docker and docker-compose
  3. From your terminal, run docker-compose build followed by docker-compose up in the root OnTask directory
  4. If this is the first time running, you must attach to the backend container and perform the following:
    • Initialise the relational database structure by running python manage.py migrate
    • Create a user by running python manage.py createsuperuser
      • Note that only local authentication is supported in development mode, which is why the above user is created

For production

  1. Install the system packages required to compile the backend dependencies
    • sudo yum install python36 python36-setuptools python36-devel (or equivalent for your OS)
  2. Install MongoDB in which to store application data
  3. Install an RDS such as PostgreSQL or MySQL in which to store user data
  4. Install RabbitMQ for task scheduling
  5. Install the Python3 virtual environment module via python3 -m pip install virtualenv
  6. Clone the OnTask repository to your machine
    • Note: all of the below commands should take place within the ontask/ directory
  7. Create a virtual environment in the backend directory by running virtualenv backend/virtualenv
    • Note that the virtual environment must be called 'virtualenv' and be located in the backend/ directory, as denoted above
  8. Ensure that the following are running as a service:
    • RabbitMQ
    • MongoDB
    • The chosen RDS (e.g. PostgreSQL)
  9. Perform the configuration steps outlined here and here
  10. Compile the frontend files by running npm install followed by npm run build in the frontend/ directory
  11. Install nginx and configure the /etc/nginx/nginx.conf as follows:
http {
    sendfile on;

    gzip                    on;
    gzip_http_version       1.0;
    gzip_proxied            any;
    gzip_min_length         500;
    gzip_disable            "MSIE [1-6]\.";
    gzip_types              text/plain text/xml text/css
                            text/comma-separated-values
                            text/javascript
                            application/x-javascript
                            application/atom+xml;

    set $domain YOUR_DOMAIN_NAME;

    server {
        server_name         $domain;
        listen 80;
        return 301 https://$server_name$request_uri;
    }

    server {
        server_name         $domain;
        listen 443;

        ssl on;
        ssl_certificate     YOUR_SSL_CERT_PATH;
                    
        proxy_redirect      off;
        proxy_set_header    Host $host;
        proxy_set_header    X-Real-IP $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Host $server_name;

        root                /var/www/html/ontask/;
        include             /etc/nginx/mime.types;

        location / {
            add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
            try_files $uri /index.html;
        }

        location ^~ /api/ {
            proxy_pass      http://127.0.0.1:8000/api/;
        }
    }
}
  1. Reload nginx after updating the configuration file
  2. Launch OnTask by running . ./startup.sh whilst in the ontask directory
    • This script will fail if ran from any other directory
    • The default port used by the backend is 8000
    • This port can be changed by running export ONTASK_PORT=YOUR_DESIRED_PORT prior to running the startup script
      • The proxy_pass in the nginx configuration file will also need to be changed to reflect a different port
    • Log files are located in the ontask/logs/ directory
  3. The application should now be accessible via the domain that was specified in the nginx configuration file
  4. OnTask can be stopped by running . ./terminate.sh whilst in the ontask directory

Configuration

General configuration

  1. Create environment files dev.py (for development) and/or prod.py (for production) in the backend/config/ directory
  2. Run pip install cryptography
  3. In a Python shell run the following:
from cryptography.fernet import Fernet
# The following generated secret key will be used for encrypting sensitive data
# Loss or change of the secret key will result in the loss of all datasource passwords
# This is a breaking issue for dynamic data sources, as update attempts will fail
Fernet.generate_key().decode("utf-8")
  1. Configure the environment file(s) created in step 1 as follows:
SECRET_KEY = 'YOUR_SECRET_KEY' # Generated above

# AWS credentials to allow users to import datasources from S3 buckets
AWS_ACCESS_KEY_ID = 'YOUR_AWS_ACCESS_KEY_ID'
AWS_SECRET_ACCESS_KEY = 'YOUR_AWS_SECRET_ACCESS_KEY'
AWS_REGION = 'ap-southeast-2'

# SMTP credentials to enable email sending from OnTask
SMTP = {
    'HOST': 'YOUR_SMTP_HOST',
    'PORT': 587,
    'USER': 'YOUR_SMTP_USER',
    'PASSWORD': 'YOUR_SMTP_PASSWORD',
    'USE_TLS': True
}
  1. Create environment files .env.development (for development) and/or .env.production (for production) in the frontend/ directory
  2. Configure the environment file(s) created in step 5 as follows:
REACT_APP_API_DOMAIN = 'YOUR_BACKEND_DOMAIN_NAME' // Including the protocol E.g. "http://localhost:8000/api" for development
REACT_APP_AWS_ID = 'YOUR_AWS_ACCESS_KEY_ID'

Additional configuration for production

  • In addition to the previous section, the following parameters must also be added to the configuration files:
    • Add to prod.py in the backend/config/ directory:
    FRONTEND_DOMAIN = 'https://YOUR_FRONTEND_DOMAIN_NAME' # For whitelisting CORS and authentication, including the protocol (http:// or https://)
    ALLOWED_HOSTS = ['YOUR_FRONTEND_DOMAIN_NAME'] # Note that the URL should be in an array and without the protocol
    
    # For task scheduling
    CELERY_BROKER_URL = 'amqp://YOUR_RABBITMQ_HOST'
    
    # For storing user data
    SQL_DATABASE = { 
        # PostgreSQL is only provided as an example
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'YOUR_SQL_DATABASE',
        'USER': 'YOUR_SQL_USER',
        'PASSWORD': 'YOUR_SQL_PASSWORD',
        'HOST': 'YOUR_SQL_HOST',
        'PORT': 'YOUR_SQL_PORT'
    }
    
    # For storing application data
    NOSQL_DATABASE = {
        'HOST': 'mongodb://YOUR_NOSQL_HOST/',
        'DB': 'YOUR_NOSQL_DATABASE'
    }
    
    CIPHER_SUITE_KEY = 'YOUR_CIPHER_KEY' # 30 byte secret key for authenticating users from third party IDPs
    
    # Configuration for AAF Rapid Connect
    AAF_CONFIG = {
    'secret_key': 'YOUR_SECRET_KEY',
    'aaf.edu.au': {
        'iss': 'https://rapid.aaf.edu.au',
        'aud': 'https://YOUR_DOMAIN_NAME',
        'idp': 'https://rapid.aaf.edu.au/jwt/authnrequest/research/YOUR_REQUEST_ID'
        },
    'role_mappings': {
            'staff': ['staff@sydney.edu.au', 'faculty@unisa.edu.au', 'staff@unsw.edu.au'],
            'student': ['student@unsw.edu.au']
        },
    'AAF_DEFAULT_PASSWORD': 'YOUR_DEFAULT_PASSWORD'
    }
    
    # Configuration for LTI
    LTI_CONFIG = {
    'role_mappings': {
            'staff': ['Instructor'],
            'student': ['Student']
        }
    }
    • Add to .env.production in the frontend/ directory:
    REACT_APP_AAF_URL = 'YOUR_AAF_LOGIN_URL'

Packages Used

Frontend Dependencies

Package Name License
React.js MIT
create-react-app MIT
react-router MIT
react-redux MIT
redux-thunk MIT
Ant Design MIT
BizCharts MIT
data-set MIT
Slate MIT
is-hotkey MIT
react-dnd BSD
react-draggable MIT
lodash MIT
moment MIT
query-string MIT

Backend Dependencies

Package Name License
Django BSD
djangorestframework BSD
mongoengine MIT
django-rest-framework-mongoengine MIT
django-cors-headers License
uWSGI GPL
requests Apache
SQLAlchemy MIT
pymongo Apache
pyjwt MIT
boto3 Apache
celery BSD
django-celery-beat BSD
circus Apache
cryptography Apache/BSD
python-dateutil Apache
xlrd License
numexpr MIT