OnTask v2.5
Running the application
For development
- Perform the configuration steps outlined here
- Install Docker and docker-compose
- From your terminal, run
docker-compose build
followed by docker-compose up
in the root OnTask directory
- If this is the first time running, the following must be performed:
- Attach to the backend container by running
docker-compose exec backend sh
- Initialise the database by running
python3 manage.py makemigrations accounts
, python3 manage.py makemigrations
and lastly python3 manage.py migrate
- Load data into user groups by running
python3 manage.py loaddata user_groups
- Create the first admin user by running
python manage.py createsuperuser
- Create a
term
Table in the ontask Database (you can use a Database client like MongoDB Compass) and import Term Codes.csv
(or create your own Terms). This is to ensure that you have Terms to search and create containers via the UI.
term
table should have fields: code (number), name (string), start (date), end (date)
- In order to work with LTI via localhost, the application runs in SSL mode with self-signed certs
For production
- Complete steps 1-4 from above, however, instead run
docker-compose -f docker-compose.prod.yaml up
(in step 3)
- Compile the frontend by running
npm run build
in the frontend directory
- Serve the files in the
frontend/build/
directory as a static website (e.g. through S3 behind a CloudFront distribution)
- Add a proxy pass in your webserver configuration from your backend domain (e.g. api.ontask.org) to http://localhost:8000 (not https)
Configuration
General configuration
- Create an environment file
env.py
in the backend/ontask/
directory
- Run
pip install cryptography
- From a Python shell, run the following command:
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")
- Configure the environment file as follows:
SECRET_KEY = "<SECRET_KEY_GENERATED_ABOVE>"
# List of admins that will recieve user signup notifications via email
ADMINS = ["<ADMIN_EMAIL_1>"]
FRONTEND_DOMAIN = "https://<YOUR_FRONTEND_DOMAIN>"
BACKEND_DOMAIN = "https://<YOUR_BACKEND_DOMAIN>"
ALLOWED_HOSTS = ["<YOUR_FRONTEND_DOMAIN>"] # Without the protocol specified
# If uncommented, use the given named profile from your AWS credentials
# file (usually ~/.aws/credentials). Otherwise, boto3 will assume the AWS role
# of the server itself
# AWS_PROFILE = "<YOUR_AWS_NAMED_PROFILE>"
AWS_REGION = "<YOUR_AWS_REGION>"
ENABLE_CLOUDWATCH_LOGGING = False
DEMO_BUCKET = "<YOUR_S3_BUCKET>"
# SMTP credentials to enable email sending from OnTask
EMAIL_HOST = "<YOUR_SMTP_HOST>"
EMAIL_PORT = 587
EMAIL_NAME = "OnTask" # Default name to appear in emails sent
EMAIL_ALIAS = "<YOUR_EMAIL_ALIAS>" # Default alias email to use in emails sent
EMAIL_HOST_USER = "<YOUR_SMTP_USER>" # SMTP login user
EMAIL_HOST_PASSWORD = "<YOUR_SMTP_PASSWORD>" # SMTP login password
EMAIL_USE_TLS = True
EMAIL_BATCH_SIZE = 50 # Maximum number of emails to send at a time (i.e. a batch)
EMAIL_BATCH_PAUSE = 300 # Minutes to wait between batches of emails
# Configuration for AAF Rapid Connect
AAF_CONFIG = {
"secret_key": "<YOUR_AAF_SECRET>",
"aaf.edu.au": {
"iss": "https://rapid.aaf.edu.au", # https://rapid.test.aaf.edu.au for dev
"aud": "https://<YOUR_DOMAIN>", # https://localhost:8000 for dev
"idp": "<YOUR_AAF_IDP>",
}
}
LTI_CONFIG = {
"staff_role": "Instructor", # Role that will be added to the instructor group when coming from LTI
"consumers": {
"ontask": { # App name registered in LTI
"secret": "<YOUR_LTI_SECRET>"
}
},
"url": "<YOUR_LTI_URL>",
"username_field": "<YOUR_LTI_USERNAME_FIELD>", # Specify which field in the LTI payload maps to your institution's user ID
"auto_create_share_containers": True # Allows for the auto creation and sharing of containers in lti context.
}
- Create environment files
.env.development
(for development) and/or .env.production
(for production) in the frontend/
directory
- Configure the environment file(s) created above:
REACT_APP_API_DOMAIN = "https://<YOUR_BACKEND_DOMAIN>";
REACT_APP_AWS_ID = "YOUR_AWS_ID";
REACT_APP_AAF_URL = "<YOUR_AAF_IDP>";
// If uncommented, show the Register Account interface
// REACT_APP_DEMO = True
Packages Used
Frontend Dependencies
Package Name |
License |
React.js |
MIT |
create-react-app |
MIT |
react-router |
MIT |
Ant Design |
MIT |
Slate |
MIT |
is-hotkey |
MIT |
react-dnd |
BSD |
react-draggable |
MIT |
lodash |
MIT |
moment |
MIT |
query-string |
MIT |
sanitize-html |
MIT |
memoize-one |
MIT |
highcharts |
CC |
d3 |
BSD |
Backend Dependencies