diff --git a/README.rst b/README.rst index b81b0e4..b6707d3 100644 --- a/README.rst +++ b/README.rst @@ -1,9 +1,9 @@ Students notes plugin for `Tutor `_ =================================================================== -This is a plugin for `Tutor `_ to easily add the `Open edX note-taking app `_ to an Open edX platform. This app allows students to annotate portions of the courseware (see `the official documentation `_). +This is a plugin for `Tutor `_ to easily add the `Open edX note-taking app `_ to an Open edX platform. This app allows students to annotate portions of the courseware (see `the official documentation `_). -.. image:: https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/open-release-ironwood.master/_images/SFD_SN_bodyexample.png +.. image:: https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/open-release-juniper.master/_images/SFD_SN_bodyexample.png :alt: Notes in action Installation @@ -16,12 +16,12 @@ The plugin is currently bundled with the `binary releases of Tutor `` domain name should exist and point to your server. For instance, if your LMS is hosted at http://myopenedx.com, the notes service should be found at http://notes.myopenedx.com. -If you would like to host the notes service at a different domain name, you can set the ``NOTES_HOST`` configuration variable (see below). In particular, in development you should set this configuration variable to ``notes.localhost`` in order to be able to access the notes service from the LMS. Otherwise you will get a "Sorry, we could not search the store for annotations" error. +If you would like to host the notes service at a different domain name, you can set the ``NOTES_HOST`` configuration variable (see below). When testing Tutor on a local computer, this will be automatically set to notes.local.overhang.io. +To enable student notes for a specific course, you should go to the course advanced settings in the studio, and set "Enable Student Notes" to "true". Then, hit "save changes". Configuration ------------- diff --git a/setup.py b/setup.py index 1298052..a9ff62a 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ setup( packages=find_packages(exclude=["tests*"]), include_package_data=True, python_requires=">=3.5", - install_requires=["tutor-openedx"], + install_requires=["tutor-openedx>=10.0.0,<11.0.0"], entry_points={"tutor.plugin.v0": ["notes = tutornotes.plugin"]}, classifiers=[ "Development Status :: 5 - Production/Stable", diff --git a/tutornotes/__about__.py b/tutornotes/__about__.py index 9cb17e7..9158871 100644 --- a/tutornotes/__about__.py +++ b/tutornotes/__about__.py @@ -1 +1 @@ -__version__ = "0.1.8" +__version__ = "10.0.0" diff --git a/tutornotes/patches/lms-env b/tutornotes/patches/lms-env deleted file mode 100644 index 227ad0a..0000000 --- a/tutornotes/patches/lms-env +++ /dev/null @@ -1,2 +0,0 @@ -"EDXNOTES_PUBLIC_API": "{{ "https" if ACTIVATE_HTTPS else "http" }}://{{ NOTES_HOST }}/api/v1", -"EDXNOTES_INTERNAL_API": "http://notes:8000/api/v1" \ No newline at end of file diff --git a/tutornotes/patches/lms-env-features b/tutornotes/patches/lms-env-features new file mode 100644 index 0000000..c49b14f --- /dev/null +++ b/tutornotes/patches/lms-env-features @@ -0,0 +1 @@ +ENABLE_EDXNOTES: true \ No newline at end of file diff --git a/tutornotes/patches/local-docker-compose-dev-services b/tutornotes/patches/local-docker-compose-dev-services new file mode 100644 index 0000000..1f34a5e --- /dev/null +++ b/tutornotes/patches/local-docker-compose-dev-services @@ -0,0 +1,4 @@ +notes: + command: ./manage.py runserver 0.0.0.0:8120 + ports: + - "8120:8120" \ No newline at end of file diff --git a/tutornotes/patches/openedx-lms-common-settings b/tutornotes/patches/openedx-lms-common-settings new file mode 100644 index 0000000..1cc3098 --- /dev/null +++ b/tutornotes/patches/openedx-lms-common-settings @@ -0,0 +1,3 @@ +# Notes +EDXNOTES_CLIENT_NAME = "notes" +EDXNOTES_INTERNAL_API = "http://notes:8000/api/v1" \ No newline at end of file diff --git a/tutornotes/patches/openedx-lms-development-settings b/tutornotes/patches/openedx-lms-development-settings new file mode 100644 index 0000000..c551785 --- /dev/null +++ b/tutornotes/patches/openedx-lms-development-settings @@ -0,0 +1 @@ +EDXNOTES_PUBLIC_API = "http://{{ NOTES_HOST }}:8120/api/v1" \ No newline at end of file diff --git a/tutornotes/patches/openedx-lms-production-settings b/tutornotes/patches/openedx-lms-production-settings new file mode 100644 index 0000000..fdb0352 --- /dev/null +++ b/tutornotes/patches/openedx-lms-production-settings @@ -0,0 +1 @@ +EDXNOTES_PUBLIC_API = "{{ "https" if ACTIVATE_HTTPS else "http" }}://{{ NOTES_HOST }}/api/v1" \ No newline at end of file diff --git a/tutornotes/templates/notes/apps/settings/tutor.py b/tutornotes/templates/notes/apps/settings/tutor.py index 314df83..a3e3873 100644 --- a/tutornotes/templates/notes/apps/settings/tutor.py +++ b/tutornotes/templates/notes/apps/settings/tutor.py @@ -2,9 +2,7 @@ from .common import * SECRET_KEY = "{{ NOTES_SECRET_KEY }}" ALLOWED_HOSTS = [ - "localhost", "notes", - "notes.localhost", "{{ NOTES_HOST }}", ] @@ -33,4 +31,19 @@ HAYSTACK_CONNECTIONS = { } } -LOGGING["handlers"]["local"] = LOGGING["handlers"]["console"].copy() +LOGGING = { + "version": 1, + "disable_existing_loggers": False, + "handlers": { + "console": { + "level": "INFO", + "class": "logging.StreamHandler", + }, + }, + "loggers": { + "": { + "handlers": ["console"], + "level": "INFO", + }, + }, +} diff --git a/tutornotes/templates/notes/build/notes/Dockerfile b/tutornotes/templates/notes/build/notes/Dockerfile index 027b13c..1630e9c 100644 --- a/tutornotes/templates/notes/build/notes/Dockerfile +++ b/tutornotes/templates/notes/build/notes/Dockerfile @@ -1,15 +1,19 @@ -FROM docker.io/ubuntu:18.04 +FROM docker.io/ubuntu:20.04 MAINTAINER Overhang.io RUN apt update && \ apt upgrade -y && \ - apt install -y language-pack-en git python-pip libmysqlclient-dev + # python 3.8 + apt install -y language-pack-en git python3 python3-pip libmysqlclient-dev +RUN ln -s /usr/bin/python3 /usr/bin/python \ + && ln -s /usr/bin/pip3 /usr/bin/pip + RUN mkdir /openedx -RUN git clone https://github.com/edx/edx-notes-api --branch open-release/ironwood.2 --depth 1 /openedx/edx-notes-api +RUN git clone https://github.com/edx/edx-notes-api --branch open-release/juniper.1 --depth 1 /openedx/edx-notes-api WORKDIR /openedx/edx-notes-api -RUN pip install -r requirements/base.txt +RUN pip3 install -r requirements/base.txt EXPOSE 8000 CMD gunicorn --workers=2 --name notes --bind=0.0.0.0:8000 --max-requests=1000 notesserver.wsgi:application diff --git a/tutornotes/templates/notes/hooks/lms/init b/tutornotes/templates/notes/hooks/lms/init index 90fb261..7961aa2 100644 --- a/tutornotes/templates/notes/hooks/lms/init +++ b/tutornotes/templates/notes/hooks/lms/init @@ -1,18 +1,14 @@ -export DJANGO_SETTINGS_MODULE=lms.envs.tutor.production - # Modify users created an incorrect email and that might clash with the newly created users ./manage.py lms shell -c \ "from django.contrib.auth import get_user_model;\ get_user_model().objects.filter(username='notes').exclude(email='notes@openedx').update(email='notes@openedx')" ./manage.py lms manage_user notes notes@openedx --staff --superuser -./manage.py lms create_oauth2_client \ - "http://notes:8000" \ - "http://notes:8000/complete/edx-oidc/" \ - confidential \ - --client_name edx-notes \ - --client_id notes \ - --client_secret {{ NOTES_OAUTH2_SECRET }} \ - --trusted \ - --logout_uri "http://notes:8000/logout/" \ - --username notes \ No newline at end of file +./manage.py lms create_dot_application \ + notes \ + notes \ + --redirect-uris "http://notes:8000" \ + --skip-authorization \ + --client-id notes \ + --client-secret "{{ NOTES_OAUTH2_SECRET }}" \ + --update \ No newline at end of file