How to Get edX Notes Running
This is the process for getting edX notes running, both on a shared server with the LMS and other services, and on its own server. This guide assumes that you have a running LMS. While this configuration is not recommended for production deployments, this should be enough to get you started.
Step-by-step guide
In order for the edx_notes_api application to authenticate against the LMS, an oauth client configuration will need to be created in your LMS. This can be done from the Django admin application as a superuser. The admin application is hosted at
https://<your-lms-url>/admin
, for example, https://courses.edx.org/admin. The client details need to be available to the notes application Note that in this document, the hostname lms.example.com will be used, but this value will need to be replaced with the appropriate value for your environment.
On the admin page, to go "Oath2" and click "Add" by "Clients". Fill out the following fields.Key On Sandbox For Example User <leave blank> <leave blank> Name edx-notes edx-notes Url https://<your-notesserver-url> https://<github_id>.sandbox.edx.org:18120 Redirect uri https://<your-notesserver-url>/complete/edx-oidc/ https://<github_id>.sandbox.edx.org:18120/complete/edx-oidc Client id <a big random string> <generated> Client secret <a DIFFERENT big random string> <generated> Client type Confidential (web application)
Confidential (web application) Some of these values will be needed in
/edx/app/edx_ansible/edx_ansible/playbooks/roles/edx_notes_api/defaults/main.yml
, so take note of them now.You will have to use master of the configuration repository to pull in some changes related to installing notes, so fetch the latest of https://github.com/edx/configuration and change to the master branch. Here are the command (details):
sudo /edx/bin/update configuration master
Set the following values in
/edx/app/edx_ansible/edx_ansible/playbooks/roles/edx_notes_api/defaults/main.yml
:EDX_NOTES_API_MYSQL_DB_PASS: <desired password for your notes user> EDX_NOTES_API_MYSQL_HOST: <mysql hostname> EDX_NOTES_API_ELASTICSEARCH_URL: <url of elasticsearch cluster> EDX_NOTES_API_DATASTORE_NAME: <desired name of mysql db and elasticsearch index, e.g. "notes"> EDX_NOTES_API_SECRET_KEY: <random string, min 50 characters recommended> EDX_NOTES_API_CLIENT_ID: <client id from oauth config> EDX_NOTES_API_CLIENT_SECRET: <client secret from oauth config>
You also need the following override:
EDX_NOTES_API_ALLOWED_HOSTS: - localhost - <your-lms-url>
If you have a load balancer running in front of multiple notes api servers, you might instead have to set it to the following:
EDX_NOTES_API_ALLOWED_HOSTS: - "*"
Also set this value in
/edx/app/edx_ansible/edx_ansible/playbooks/roles/edxapp/defaults/main.yml
:EDXAPP_EDXNOTES_PUBLIC_API: https://<your-notesserver-url>:18120/api/v1 EDXAPP_EDXNOTES_INTERNAL_API: https://<your-notesserver-url>:18120/api/v1 FEATURES: ENABLE_EDXNOTES: true
Now create your database users. First, you will need to activate the venv (Python virtual environment) for ansible.
source /edx/app/edx_ansible/venvs/edx_ansible/bin/activate
Assuming that you have a local checkout of the edx configuration repository, you can create the required database users by runningcd /edx/app/edx_ansible/edx_ansible/playbooks ansible-playbook -i 'localhost,' -c local ./run_role.yml -e 'role=edxlocal' -e@roles/edx_notes_api/defaults/main.yml
Install the edx-notes-api using ansible
cd /edx/app/edx_ansible/edx_ansible/playbooks/edx-east ansible-playbook -i 'localhost,' -c local ./notes.yml -e@/edx/app/edx_ansible/server-vars.yml
When the installation has completed verify that the notes api is healthy by running
sudo /edx/bin/supervisorctl status edx_notes_api edx_notes_api RUNNING pid 13630, uptime 11:42:01
Run Migrations
export EDXNOTES_CONFIG_ROOT=/edx/etc/ # Defaults to 'migrate' export DB_MIGRATION_USER=<migration_username> # Defaults to 'password' export DB_MIGRATION_PASS=<migration_password> /edx/bin/python.edx_notes_api /edx/bin/manage.edx_notes_api migrate --settings="notesserver.settings.yaml_config"
- An advanced setting in Studio must also be enabled on a per course basis. From the advanced settings tab for your course, set Enable Student Notes to true. If you don't see that advanced setting, make sure that
FEATURES.ENABLE_EDXNOTES == true
- Navigate to the courseware for any course with edX Notes enabled. From the courseware you should be able to highlight text and add notes. If there are errors, check both the LMS logs,
/edx/var/log/lms/edx.log
, and the edx_notes_api logs,/edx/var/log/supervisor/edx_notes_apitderr.log
.
Related articles