Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
edx notes api setup
  1. Goto https://<your-lms-url>/admin. On the admin page, go to "Oath2" and click "Add" by "Clients". Fill out the following fields.
Item Value
User <leave blank>
Name edx-notes
Url https://<your-notesserver-url>
Redirect uri https://<your-notesserver-url>/complete/edx-oidc/
Client id <generated>
Client secret <generated>
Client type Confidential (web application)
  1. Create a file with any name to any location you like. E.g. ~/custom.yml
EDX_NOTES_API_MYSQL_DB_PASS: <db pass>
EDX_NOTES_API_MYSQL_HOST: <db host>
EDX_NOTES_API_ELASTICSEARCH_URL: <e.g. localhost:9200>
EDX_NOTES_API_DATASTORE_NAME: edx_notes_api
EDX_NOTES_API_SECRET_KEY: <key>
EDX_NOTES_API_CLIENT_ID: <id>
EDX_NOTES_API_CLIENT_SECRET: <secret>
EDX_NOTES_API_ALLOWED_HOSTS:
  - localhost
  - <hostname part of your LMS URL>
  
EDXAPP_EDXNOTES_PUBLIC_API: https://<public-noteserver-url>/api/v1
EDXAPP_EDXNOTES_INTERNAL_API: http://localhost:8120/api/v1

FEATURES:
    ENABLE_EDXNOTES: true
  1. Enter virtual env

source /edx/app/edx_ansible/venvs/edx_ansible/bin/activate

  1. Create DB users
cd /edx/app/edx_ansible/edx_ansible/playbooks

For database hosted on the same machine:

ansible-playbook -i 'localhost,' -c local ./run_role.yml -e 'role=edxlocal' -e@roles/edx_notes_api/defaults/main.yml -e@<your custom yml like ~/custom.yml>

For remote database it's different. E.g., in FFI we use:

ansible-playbook -i 'database,' ./run_role.yml -e 'role=edxlocal_dbserver' -e@roles/edx_notes_api/defaults/main.yml -e@~/custom.yml
  1. 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@<your custom yml like ~/custom.yml>

When the installation has completed verify that the notes api is healthy by running

sudo /edx/bin/supervisorctl status edx_notes_api

  1. Double-check settings

In some cases you need to manually edit settings. Change or add if not found.

In both /edx/app/edxapp/lms.env.json and /edx/app/edxapp/cms.env.json. Check following values:

    "FEATURES": {
        ...
        "ENABLE_EDXNOTES": true,

And only in lms.env.json check:

    "EDXNOTES_INTERNAL_API": "http://localhost:8120/api/v1",
    "EDXNOTES_PUBLIC_API": "https://<public-noteserver-url>/api/v1",
  1. Run Migrations
export EDXNOTES_CONFIG_ROOT=/edx/etc/
export DB_MIGRATION_USER=<migration_username>
export DB_MIGRATION_PASS=<migration_password>
/edx/bin/python.edx_notes_api /edx/bin/manage.edx_notes_api migrate --settings="notesserver.settings.yaml_config"
  1. On a production server, you may want to change the hostnames related setting for Nginx. If you do, also remember to add allowed host in /edx/etc/edx_notes_api.yml
@myleshk

This comment has been minimized.

@cequn

This comment has been minimized.

Copy link

cequn commented Aug 31, 2018

thanks for your work!

@adrianrocamora

This comment has been minimized.

Copy link

adrianrocamora commented Mar 25, 2019

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.