Ishan Sheth (imsheth)

The Hows - Open edX Nutmeg with Tutor 14 on Ubuntu 20

The Hows - Open edX Nutmeg with Tutor 14 on Ubuntu 20

Jun 29, 2022

The motivation for writing this post is in the hope that it helps others save lots of time, energy instead of going through various links but hitting dead ends due to lack of community support, broken features, features lacking updates and improper documentation prevailing around the topic.

This post is focused on how to setup Open edX Nutmeg with Tutor 14 on Ubuntu 20


Ubuntu 20.x.x

  1. Check the machine operating system, it should be Ubuntu 20.x.x
  2. Our test machine operating system details (Ubuntu 20.04.2 LTS (Focal Fossa))
cat /etc/os-release
openedx-nutmeg-tutor14-1-png
  1. It is recommended to use the LTS version but not necessary

  2. This completes Ubuntu check


python 3.8.10

  1. Install python 3.8.10 and required packages
sudo add-apt-repository ppa:deadsnakes/ppa && sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get install software-properties-common && sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget libyaml-dev && sudo apt install python3.8 && sudo apt-get install python3-dev && python3.8 --version
openedx-nutmeg-tutor14-2-pngopenedx-nutmeg-tutor14-3-png
  1. Verify python 3.8.10 installation path
whereis python
openedx-nutmeg-tutor14-4-png
  1. Set environment/path/alias variables for python 3.8.10 & pip 22.1.2
echo 'export PATH=$PATH:"/usr/bin/python3.8"' >> ~/.bashrc && echo 'alias python="python3.8"' >> ~/.bashrc && echo 'export PATH=$PATH:"/home/ubuntu/.local/bin"' >> ~/.bashrc && echo 'alias pip="pip3"' >> ~/.bashrc && source ~/.bashrc && echo $PATH && python --version
openedx-nutmeg-tutor14-5-png
  1. pip 22.1.2
cd /tmp && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python get-pip.py && pip install --upgrade pip --user && pip --version
openedx-nutmeg-tutor14-6-png
  1. This completes python and pip installation

Docker 20.10.17

  1. Install docker 20.10.17
cd /tmp && curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh && docker --version
openedx-nutmeg-tutor14-7-png
  1. Enable docker remote API on docker host (comments section)
sudo vim /lib/systemd/system/docker.service
# Comment the original line for backup to revert if needed
#ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecStart=/usr/bin/dockerd -H fd:// -H 0.0.0.0:2375 --containerd=/run/containerd/containerd.sock
  1. Reload - restart daemon and verify docker remote API response
sudo systemctl daemon-reload
sudo service docker restart
curl http://localhost:2375/images/json
openedx-nutmeg-tutor14-8-png
  1. Install docker compose 1.29.2
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose && docker-compose --version
openedx-nutmeg-tutor14-9-png
  1. Run docker without sudo
sudo groupadd docker && sudo usermod -aG docker ${USER}
openedx-nutmeg-tutor14-10-png
  1. This completes docker 20.10.17 and docker compose 1.29.2 installation and setup

Tutor 14.0.2

  1. Install Tutor 14.0.2
pip install "tutor[full]" && tutor --version
openedx-nutmeg-tutor14-11-png
  1. Set environment/path variables for Tutor 14.0.2
echo 'export PATH=$PATH:"/home/ubuntu/.local/bin/tutor"' >> ~/.bashrc && source ~/.bashrc
openedx-nutmeg-tutor14-12-png
  1. Setup Tutor 14.0.2 with interactive shell
tutor local quickstart
openedx-nutmeg-tutor14-13-pngopenedx-nutmeg-tutor14-14-png
  1. Assign static/elastic IP to the instance

  2. Add domain mappings to the static/elastic IP

A openedx x.x.x.x 600s
CNAME *.openedx openedx.imsheth.com 60m
  1. We have our openedx running

    openedx-nutmeg-tutor14-15-png
  2. We have our openedx studio running

    openedx-nutmeg-tutor14-16-png
  3. We have our openedx admin running

    openedx-nutmeg-tutor14-17-png
  4. View logs from all containers (as per need)

tutor local logs --tail=100 -f
  1. Local deployment reloading settings (as per need)
tutor local restart
  1. Creating a new user with staff and admin rights (works with studio and admin portals, can also be used on the learner portal) [pass1234 is the password entered on the prompt here]
tutor local createuser --staff --superuser imsheth contact@imsheth.com
openedx-nutmeg-tutor14-18-png
  1. Importing the demo course
tutor local importdemocourse
openedx-nutmeg-tutor14-19-png
  1. This completes Tutor 14.0.2 and Open edX Nutmeg installation and setup

Open edX APIs

  1. Enable API access config at admin

    openedx-nutmeg-tutor14-20-png
  2. API access config is enabled at admin

    openedx-nutmeg-tutor14-21-png
  3. Fill the API access request form at api-admin

    openedx-nutmeg-tutor14-22-png
  4. Submit the API access request form at api-admin

    openedx-nutmeg-tutor14-23-png
  5. Your API access request is available at admin

    openedx-nutmeg-tutor14-24-png
  6. Approve and save your API access request at admin

    openedx-nutmeg-tutor14-25-png
  7. Your API access request is approved at admin

    openedx-nutmeg-tutor14-26-png
  8. Fill the form to generate API access credentials at api-admin

    openedx-nutmeg-tutor14-27-png
  9. Your API access credentials are generated and available at api-admin

    openedx-nutmeg-tutor14-28-png
  10. Get CSRF token from account registration endpoint response headers

    openedx-nutmeg-tutor14-29-png
  11. Use it in headers in access token endpoint

    openedx-nutmeg-tutor14-30-png
  12. Get JWT token from access token endpoint in response using client_id and client_secret generated in step 9 above

    openedx-nutmeg-tutor14-31-png
  13. Most of the GET endpoints are open and do not need authentication like account registration form endpoint

    openedx-nutmeg-tutor14-32-png
  14. Use JWT token in "Authorization" key and CSRF token in "X-CSRFToken" key in header and hit account registration endpoint

    openedx-nutmeg-tutor14-33-png
  15. Hit account registration endpoint with proper body attributes by referring to API documentation at https://courses.edx.org/api-docs/

    openedx-nutmeg-tutor14-34-png
  16. Above approach worked fine to fix CORS issues, but the below links didn't work in the same case


Customizing Settings

  1. Turning off rate limiting
tutor config save --set RATELIMIT_ENABLE=False
  1. Turning on debugging
tutor config save --set DEBUG=True
  1. Using Google SMTP
tutor config save --set RUN_SMTP=false
tutor config save \
--set SMTP_HOST=smtp.gmail.com \
--set SMTP_PORT=587 \
--set SMTP_USE_SSL=false \
--set SMTP_USE_TLS=true \
--set SMTP_USERNAME=gmailid@gmail.com \
--set SMTP_PASSWORD=gmailidpassword
  1. Applying settings
tutor local restart

#openedx #openedxnutmeg #tutor #tutor14.0.2 #docker #docker20.10.17 #python #python3.8.10 #pip #pip21.1.2 #ubuntu #ubuntu20.04.4lts #tech #edtech #lms #learningmanagementsystem




Edit this page on GitHub