diff --git a/CHANGELOG.md b/CHANGELOG.md index f54370d..15f4fdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ Note: Breaking changes between versions are indicated by "💥". ## Latest -- [Improvement] Move minio plugin outside of the tutor repo +- [Improvement] Move all plugins outside of the tutor repo - [Bugfix/Improvement] Add all plugins (with data) into binary bundle (#242) ## 3.6.2 (2019-08-07) diff --git a/Makefile b/Makefile index e3893da..10fde4c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .DEFAULT_GOAL := help -SRC_DIRS = ./tutor ./tests ./plugins ./bin +SRC_DIRS = ./tutor ./tests ./bin BLACK_OPTS = --exclude templates ${SRC_DIRS} ###### Development @@ -12,10 +12,6 @@ compile-requirements: ## Compile requirements files package: ## Build a package ready to upload to pypi python3 setup.py sdist -package-plugins: ## Build packages for each plugin - cd plugins/notes && python3 setup.py sdist --dist-dir=../../dist/ - cd plugins/xqueue && python3 setup.py sdist --dist-dir=../../dist/ - test: test-lint test-unit test-format test-packages ## Run all tests by decreasing order or priority test-format: ## Run code formatting tests @@ -24,15 +20,10 @@ test-format: ## Run code formatting tests test-lint: ## Run code linting tests pylint --errors-only --ignore=templates ${SRC_DIRS} -test-unit: test-unit-core test-unit-plugins ## Run unit tests - -test-unit-core: ## Run unit tests on core +test-unit: ## Run unit tests python3 -m unittest discover tests -test-unit-plugins: ## Run unit tests on plugins - python3 -m unittest discover plugins/xqueue/tests - -test-packages: package package-plugins ## Test that packages can be uploaded to pypi +test-packages: package ## Test that package can be uploaded to pypi twine check dist/tutor-*.tar.gz format: ## Format code automatically @@ -87,9 +78,7 @@ ci-bundle: ## Create bundle and run basic tests ./dist/tutor config printroot yes "" | ./dist/tutor config save --interactive ./dist/tutor config save - ./dist/tutor plugins enable notes - ./dist/tutor plugins enable xqueue - + ./dist/tutor plugins enable discovery ecommerce minio notes xqueue ./releases/github-release: ## Download github-release binary cd releases/ \ @@ -117,8 +106,6 @@ ci-github: ./releases/github-release ## Upload assets to github ci-bootstrap-images: pip install -r requirements/plugins.txt - tutor plugins enable notes - tutor plugins enable xqueue tutor config save ci-build-images: ci-bootstrap-images ## Build docker images diff --git a/plugins/notes/MANIFEST.in b/plugins/notes/MANIFEST.in deleted file mode 100644 index 04d5eb7..0000000 --- a/plugins/notes/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include tutornotes/patches * -recursive-include tutornotes/templates * diff --git a/plugins/notes/README.rst b/plugins/notes/README.rst deleted file mode 100644 index 1d371d2..0000000 --- a/plugins/notes/README.rst +++ /dev/null @@ -1,37 +0,0 @@ -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 `_). - -.. image:: https://edx.readthedocs.io/projects/open-edx-building-and-running-a-course/en/open-release-ironwood.master/_images/SFD_SN_bodyexample.png - :alt: Notes in action - -Installation ------------- - -The plugin is currently bundled with the `binary releases of Tutor `_. If you have installed Tutor from source, you will have to install this plugin from source, too:: - - pip install tutor-notes - -Then, to enable this plugin, run:: - - tutor plugins enable notes - - -You should beware that the ``notes.`` 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. - - -Configuration -------------- - -- ``NOTES_MYSQL_PASSWORD`` (default: ``"{{ 8|random_string }}"``) -- ``NOTES_SECRET_KEY`` (default: ``"{{ 24|random_string }}"``) -- ``NOTES_OAUTH2_SECRET`` (default: ``"{{ 24|random_string }}"``) -- ``NOTES_DOCKER_IMAGE`` (default: ``"overhangio/openedx-notes:{{ TUTOR_VERSION }}"``) -- ``NOTES_HOST`` (default: ``"notes.{{ LMS_HOST }}"``) -- ``NOTES_MYSQL_DATABASE`` (default: ``"notes"``) -- ``NOTES_MYSQL_USERNAME`` (default: ``"notes"``) - -These values can be modified with ``tutor config save --set PARAM_NAME=VALUE`` commands. diff --git a/plugins/notes/setup.py b/plugins/notes/setup.py deleted file mode 100644 index 81cdf77..0000000 --- a/plugins/notes/setup.py +++ /dev/null @@ -1,40 +0,0 @@ -import io -import os -from setuptools import setup, find_packages - -here = os.path.abspath(os.path.dirname(__file__)) - -with io.open(os.path.join(here, "README.rst"), "rt", encoding="utf8") as f: - readme = f.read() - - -setup( - name="tutor-notes", - version="0.1.1", - url="https://docs.tutor.overhang.io/", - project_urls={ - "Documentation": "https://docs.tutor.overhang.io/", - "Code": "https://github.com/overhangio/tutor/tree/master/plugins/notes", - "Issue tracker": "https://github.com/overhangio/tutor/issues", - "Community": "https://discuss.overhang.io", - }, - license="AGPLv3", - author="Overhang.io", - author_email="contact@overhang.io", - description="A Tutor plugin for student notes", - long_description=readme, - packages=find_packages(exclude=["tests*"]), - include_package_data=True, - python_requires=">=3.5", - entry_points={"tutor.plugin.v0": ["notes = tutornotes.plugin"]}, - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "License :: OSI Approved :: GNU Affero General Public License v3", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - ], -) diff --git a/plugins/notes/tutornotes/__init__.py b/plugins/notes/tutornotes/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/plugins/notes/tutornotes/patches/common-env-features b/plugins/notes/tutornotes/patches/common-env-features deleted file mode 100644 index 789821f..0000000 --- a/plugins/notes/tutornotes/patches/common-env-features +++ /dev/null @@ -1 +0,0 @@ -"ENABLE_EDXNOTES": true \ No newline at end of file diff --git a/plugins/notes/tutornotes/patches/https-create b/plugins/notes/tutornotes/patches/https-create deleted file mode 100644 index d6d4930..0000000 --- a/plugins/notes/tutornotes/patches/https-create +++ /dev/null @@ -1 +0,0 @@ -certbot certonly --standalone -n --agree-tos -m admin@{{ LMS_HOST }} -d {{ NOTES_HOST }} \ No newline at end of file diff --git a/plugins/notes/tutornotes/patches/k8s-deployments b/plugins/notes/tutornotes/patches/k8s-deployments deleted file mode 100644 index 6ae25f8..0000000 --- a/plugins/notes/tutornotes/patches/k8s-deployments +++ /dev/null @@ -1,32 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: notes - labels: - app.kubernetes.io/name: notes -spec: - selector: - matchLabels: - app.kubernetes.io/name: notes - template: - metadata: - labels: - app.kubernetes.io/name: notes - spec: - containers: - - name: notes - image: {{ DOCKER_REGISTRY }}{{ NOTES_DOCKER_IMAGE }} - ports: - - containerPort: 8000 - env: - - name: DJANGO_SETTINGS_MODULE - value: notesserver.settings.tutor - volumeMounts: - - mountPath: /openedx/edx-notes-api/notesserver/settings/tutor.py - name: settings - subPath: tutor.py - volumes: - - name: settings - configMap: - name: notes-settings diff --git a/plugins/notes/tutornotes/patches/k8s-ingress-certificates b/plugins/notes/tutornotes/patches/k8s-ingress-certificates deleted file mode 100644 index 4279f19..0000000 --- a/plugins/notes/tutornotes/patches/k8s-ingress-certificates +++ /dev/null @@ -1,18 +0,0 @@ ---- -apiVersion: certmanager.k8s.io/v1alpha1 -kind: Certificate -metadata: - name: {{ NOTES_HOST|replace(".", "-") }} -spec: - secretName: {{ NOTES_HOST }}-tls - issuerRef: - name: letsencrypt - commonName: {{ NOTES_HOST }} - dnsNames: - - {{ NOTES_HOST }} - acme: - config: - - http01: - ingress: web - domains: - - {{ NOTES_HOST }} \ No newline at end of file diff --git a/plugins/notes/tutornotes/patches/k8s-ingress-rules b/plugins/notes/tutornotes/patches/k8s-ingress-rules deleted file mode 100644 index 4d3c6a4..0000000 --- a/plugins/notes/tutornotes/patches/k8s-ingress-rules +++ /dev/null @@ -1,6 +0,0 @@ -- host: {{ NOTES_HOST }} - http: - paths: - - backend: - serviceName: nginx - servicePort: {% if ACTIVATE_HTTPS %}443{% else %}80{% endif %} \ No newline at end of file diff --git a/plugins/notes/tutornotes/patches/k8s-ingress-tls-hosts b/plugins/notes/tutornotes/patches/k8s-ingress-tls-hosts deleted file mode 100644 index 33100be..0000000 --- a/plugins/notes/tutornotes/patches/k8s-ingress-tls-hosts +++ /dev/null @@ -1 +0,0 @@ -- {{ NOTES_HOST }} \ No newline at end of file diff --git a/plugins/notes/tutornotes/patches/k8s-services b/plugins/notes/tutornotes/patches/k8s-services deleted file mode 100644 index 2f9e6c6..0000000 --- a/plugins/notes/tutornotes/patches/k8s-services +++ /dev/null @@ -1,12 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: notes -spec: - type: NodePort - ports: - - port: 8000 - protocol: TCP - selector: - app.kubernetes.io/name: notes diff --git a/plugins/notes/tutornotes/patches/kustomization-configmapgenerator b/plugins/notes/tutornotes/patches/kustomization-configmapgenerator deleted file mode 100644 index f8cc39f..0000000 --- a/plugins/notes/tutornotes/patches/kustomization-configmapgenerator +++ /dev/null @@ -1,3 +0,0 @@ -- name: notes-settings - files: - - plugins/notes/apps/settings/tutor.py \ No newline at end of file diff --git a/plugins/notes/tutornotes/patches/lms-env b/plugins/notes/tutornotes/patches/lms-env deleted file mode 100644 index 227ad0a..0000000 --- a/plugins/notes/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/plugins/notes/tutornotes/patches/local-docker-compose-services b/plugins/notes/tutornotes/patches/local-docker-compose-services deleted file mode 100644 index 6ed39ae..0000000 --- a/plugins/notes/tutornotes/patches/local-docker-compose-services +++ /dev/null @@ -1,11 +0,0 @@ -############# Notes: backend store for edX Student Notes -notes: - image: {{ DOCKER_REGISTRY }}{{ NOTES_DOCKER_IMAGE }} - environment: - DJANGO_SETTINGS_MODULE: notesserver.settings.tutor - volumes: - - ../plugins/notes/apps/settings/tutor.py:/openedx/edx-notes-api/notesserver/settings/tutor.py - - ../../data/notes:/openedx/data - restart: unless-stopped - {% if ACTIVATE_MYSQL %}depends_on: - - mysql{% endif %} \ No newline at end of file diff --git a/plugins/notes/tutornotes/patches/nginx-extra b/plugins/notes/tutornotes/patches/nginx-extra deleted file mode 100644 index 3499ba5..0000000 --- a/plugins/notes/tutornotes/patches/nginx-extra +++ /dev/null @@ -1,37 +0,0 @@ -### Student notes service -upstream notes-backend { - server notes:8000 fail_timeout=0; -} - -{% if ACTIVATE_HTTPS %} -server { - server_name {{ NOTES_HOST }}; - listen 80; - return 301 https://$server_name$request_uri; -} -{% endif %} - -server { - {% if ACTIVATE_HTTPS %}listen 443 {{ "" if WEB_PROXY else "ssl" }};{% else %}listen 80;{% endif %} - server_name notes.localhost {{ NOTES_HOST }}; - - {% if ACTIVATE_HTTPS and not WEB_PROXY %} - ssl_certificate /etc/letsencrypt/live/{{ NOTES_HOST }}/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/{{ NOTES_HOST }}/privkey.pem; - {% endif %} - - # Disables server version feedback on pages and in headers - server_tokens off; - - location / { - {% if not WEB_PROXY %} - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Port $server_port; - proxy_set_header X-Forwarded-For $remote_addr; - {% endif %} - proxy_set_header Host $http_host; - proxy_redirect off; - - proxy_pass http://notes-backend; - } -} \ No newline at end of file diff --git a/plugins/notes/tutornotes/patches/proxy-apache b/plugins/notes/tutornotes/patches/proxy-apache deleted file mode 100644 index 083ea89..0000000 --- a/plugins/notes/tutornotes/patches/proxy-apache +++ /dev/null @@ -1,27 +0,0 @@ -{% if ACTIVATE_HTTPS %} - - ServerName {{ NOTES_HOST }} - Redirect / https://notes.{{ LMS_HOST }}/ - - - - ServerName {{ NOTES_HOST }} - SSLEngine on - SSLCertificateFile /etc/letsencrypt/live/{{ NOTES_HOST }}/fullchain.pem - SSLCertificateKeyFile /etc/letsencrypt/live/{{ NOTES_HOST }}/privkey.pem - - ProxyPreserveHost On - ProxyRequests On - ProxyPass / http://localhost:{{ NGINX_HTTP_PORT }}/ - ProxyPassReverse / http://localhost:{{ NGINX_HTTP_PORT }}/ - -{% else %} - - ServerName {{ NOTES_HOST }} - - ProxyPreserveHost On - ProxyRequests On - ProxyPass / http://localhost:{{ NGINX_HTTP_PORT }}/ - ProxyPassReverse / http://localhost:{{ NGINX_HTTP_PORT }}/ - -{% endif %} diff --git a/plugins/notes/tutornotes/patches/proxy-nginx b/plugins/notes/tutornotes/patches/proxy-nginx deleted file mode 100644 index bd1ed11..0000000 --- a/plugins/notes/tutornotes/patches/proxy-nginx +++ /dev/null @@ -1,33 +0,0 @@ -server { - listen 80; - server_name {{ NOTES_HOST }}; - - server_tokens off; - location / { - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Port $server_port; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $http_host; - proxy_redirect off; - proxy_pass http://localhost:{{ NGINX_HTTP_PORT }}; - } -} -{% if ACTIVATE_HTTPS %} -server { - listen 443 ssl; - server_name {{ NOTES_HOST }}; - - ssl_certificate /etc/letsencrypt/live/{{ NOTES_HOST }}/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/{{ NOTES_HOST }}/privkey.pem; - - server_tokens off; - location / { - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-Port $server_port; - proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $http_host; - proxy_redirect off; - proxy_pass http://localhost:{{ NGINX_HTTPS_PORT }}; - } -} -{% endif %} \ No newline at end of file diff --git a/plugins/notes/tutornotes/plugin.py b/plugins/notes/tutornotes/plugin.py deleted file mode 100644 index 6857d2b..0000000 --- a/plugins/notes/tutornotes/plugin.py +++ /dev/null @@ -1,35 +0,0 @@ -from glob import glob -import os - -HERE = os.path.abspath(os.path.dirname(__file__)) - -config = { - "add": { - "MYSQL_PASSWORD": "{{ 8|random_string }}", - "SECRET_KEY": "{{ 24|random_string }}", - "OAUTH2_SECRET": "{{ 24|random_string }}", - }, - "defaults": { - "DOCKER_IMAGE": "overhangio/openedx-notes:{{ TUTOR_VERSION }}", - "HOST": "notes.{{ LMS_HOST }}", - "MYSQL_DATABASE": "notes", - "MYSQL_USERNAME": "notes", - }, -} - -templates = os.path.join(HERE, "templates") -hooks = { - "init": ["mysql-client", "lms", "notes"], - "build-image": {"notes": "{{ NOTES_DOCKER_IMAGE }}"}, - "remote-image": {"notes": "{{ NOTES_DOCKER_IMAGE }}"}, -} - - -def patches(): - all_patches = {} - for path in glob(os.path.join(HERE, "patches", "*")): - with open(path) as patch_file: - name = os.path.basename(path) - content = patch_file.read() - all_patches[name] = content - return all_patches diff --git a/plugins/notes/tutornotes/templates/notes/apps/settings/tutor.py b/plugins/notes/tutornotes/templates/notes/apps/settings/tutor.py deleted file mode 100644 index dbb7be6..0000000 --- a/plugins/notes/tutornotes/templates/notes/apps/settings/tutor.py +++ /dev/null @@ -1,33 +0,0 @@ -from .common import * - -SECRET_KEY = "{{ NOTES_SECRET_KEY }}" -ALLOWED_HOSTS = [ - "localhost", - "notes", - "notes.localhost", - "{{ NOTES_HOST }}", -] - -DATABASES = { - "default": { - "ENGINE": "django.db.backends.mysql", - "HOST": "{{ MYSQL_HOST }}", - "PORT": {{MYSQL_PORT}}, - "NAME": "{{ NOTES_MYSQL_DATABASE }}", - "USER": "{{ NOTES_MYSQL_USERNAME }}", - "PASSWORD": "{{ NOTES_MYSQL_PASSWORD }}", - } -} - -CLIENT_ID = "notes" -CLIENT_SECRET = "{{ NOTES_OAUTH2_SECRET }}" - -HAYSTACK_CONNECTIONS = { - "default": { - "ENGINE": "notesserver.highlight.ElasticsearchSearchEngine", - "URL": "http://{{ ELASTICSEARCH_HOST }}:{{ ELASTICSEARCH_PORT }}/", - "INDEX_NAME": "notes", - } -} - -LOGGING["handlers"]["local"] = LOGGING["handlers"]["console"].copy() diff --git a/plugins/notes/tutornotes/templates/notes/build/notes/Dockerfile b/plugins/notes/tutornotes/templates/notes/build/notes/Dockerfile deleted file mode 100644 index 534c812..0000000 --- a/plugins/notes/tutornotes/templates/notes/build/notes/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM ubuntu:18.04 -MAINTAINER Overhang.io - -RUN apt update && \ - apt upgrade -y && \ - apt install -y language-pack-en git python-pip libmysqlclient-dev - -RUN mkdir /openedx -RUN git clone https://github.com/edx/edx-notes-api --branch open-release/ironwood.2 --depth 1 /openedx/edx-notes-api -WORKDIR /openedx/edx-notes-api - -RUN pip 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/plugins/notes/tutornotes/templates/notes/hooks/lms/init b/plugins/notes/tutornotes/templates/notes/hooks/lms/init deleted file mode 100644 index 90fb261..0000000 --- a/plugins/notes/tutornotes/templates/notes/hooks/lms/init +++ /dev/null @@ -1,18 +0,0 @@ -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 diff --git a/plugins/notes/tutornotes/templates/notes/hooks/mysql-client/init b/plugins/notes/tutornotes/templates/notes/hooks/mysql-client/init deleted file mode 100644 index 55fb49e..0000000 --- a/plugins/notes/tutornotes/templates/notes/hooks/mysql-client/init +++ /dev/null @@ -1,2 +0,0 @@ -mysql -u root --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e 'CREATE DATABASE IF NOT EXISTS {{ NOTES_MYSQL_DATABASE }};' -mysql -u root --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e 'GRANT ALL ON {{ NOTES_MYSQL_DATABASE }}.* TO "{{ NOTES_MYSQL_USERNAME }}"@"%" IDENTIFIED BY "{{ NOTES_MYSQL_PASSWORD }}";' \ No newline at end of file diff --git a/plugins/notes/tutornotes/templates/notes/hooks/notes/init b/plugins/notes/tutornotes/templates/notes/hooks/notes/init deleted file mode 100644 index 6647646..0000000 --- a/plugins/notes/tutornotes/templates/notes/hooks/notes/init +++ /dev/null @@ -1 +0,0 @@ -./manage.py migrate --settings=notesserver.settings.tutor diff --git a/plugins/xqueue/MANIFEST.in b/plugins/xqueue/MANIFEST.in deleted file mode 100644 index 16646ee..0000000 --- a/plugins/xqueue/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -recursive-include tutorxqueue/patches * -recursive-include tutorxqueue/templates * diff --git a/plugins/xqueue/README.rst b/plugins/xqueue/README.rst deleted file mode 100644 index b9888d2..0000000 --- a/plugins/xqueue/README.rst +++ /dev/null @@ -1,28 +0,0 @@ -Xqueue external grading system plugin for `Tutor `_ -=================================================================================== - -This is a plugin for `Tutor `_ that provides the Xqueue external grading system for Open edX platforms. If you don't know what it is, you probably don't need it. - -Installation ------------- - -The plugin is currently bundled with the `binary releases of Tutor `_. If you have installed Tutor from source, you will have to install this plugin from source, too:: - - pip install tutor-xqueue - -Then, to enable this plugin, run:: - - tutor plugins enable xqueue - -Configuration -------------- - -- ``XQUEUE_AUTH_PASSWORD`` (default: ``"{{ 8|random_string }}"``) -- ``XQUEUE_MYSQL_PASSWORD`` (default: ``"{{ 8|random_string }}"``) -- ``XQUEUE_SECRET_KEY`` (default: ``"{{ 24|random_string }}"``) -- ``XQUEUE_DOCKER_IMAGE`` (default: ``"overhangio/openedx-xqueue:{{ TUTOR_VERSION }}"``) -- ``XQUEUE_AUTH_USERNAME`` (default: ``"lms"``) -- ``XQUEUE_MYSQL_DATABASE`` (default: ``"xqueue"`` -- ``XQUEUE_MYSQL_USERNAME`` (default: ``"xqueue"``) - -These values can be modified with ``tutor config save --set PARAM_NAME=VALUE`` commands. diff --git a/plugins/xqueue/setup.py b/plugins/xqueue/setup.py deleted file mode 100644 index 9baea28..0000000 --- a/plugins/xqueue/setup.py +++ /dev/null @@ -1,40 +0,0 @@ -import io -import os -from setuptools import setup, find_packages - -here = os.path.abspath(os.path.dirname(__file__)) - -with io.open(os.path.join(here, "README.rst"), "rt", encoding="utf8") as f: - readme = f.read() - - -setup( - name="tutor-xqueue", - version="0.1.1", - url="https://docs.tutor.overhang.io/", - project_urls={ - "Documentation": "https://docs.tutor.overhang.io/", - "Code": "https://github.com/overhangio/tutor/tree/master/plugins/xqueue", - "Issue tracker": "https://github.com/overhangio/tutor/issues", - "Community": "https://discuss.overhang.io", - }, - license="AGPLv3", - author="Overhang.io", - author_email="contact@overhang.io", - description="A Tutor plugin for Xqueue (external grading system)", - long_description=readme, - packages=find_packages(exclude=["tests*"]), - include_package_data=True, - python_requires=">=3.5", - entry_points={"tutor.plugin.v0": ["xqueue = tutorxqueue.plugin"]}, - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "License :: OSI Approved :: GNU Affero General Public License v3", - "Operating System :: OS Independent", - "Programming Language :: Python", - "Programming Language :: Python :: 3.5", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", - ], -) diff --git a/plugins/xqueue/tests/__init__.py b/plugins/xqueue/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/plugins/xqueue/tutorxqueue/__init__.py b/plugins/xqueue/tutorxqueue/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/plugins/xqueue/tutorxqueue/patches/k8s-deployments b/plugins/xqueue/tutorxqueue/patches/k8s-deployments deleted file mode 100644 index 7cc0f14..0000000 --- a/plugins/xqueue/tutorxqueue/patches/k8s-deployments +++ /dev/null @@ -1,43 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: xqueue - labels: - app.kubernetes.io/name: xqueue -spec: - selector: - matchLabels: - app.kubernetes.io/name: xqueue - template: - metadata: - labels: - app.kubernetes.io/name: xqueue - spec: - containers: - - name: xqueue - image: {{ DOCKER_REGISTRY }}{{ XQUEUE_DOCKER_IMAGE }} - ports: - - containerPort: 8040 - env: - - name: DJANGO_SETTINGS_MODULE - value: xqueue.tutor - volumeMounts: - - mountPath: /openedx/xqueue/xqueue/tutor.py - name: settings - subPath: tutor.py - - name: xqueue-consumer - image: {{ DOCKER_REGISTRY }}{{ XQUEUE_DOCKER_IMAGE }} - command: ["sh", "-e", "-c"] - args: ["while true; do echo 'running consumers'; ./manage.py run_consumer; sleep 10; done"] - env: - - name: DJANGO_SETTINGS_MODULE - value: xqueue.tutor - volumeMounts: - - mountPath: /openedx/xqueue/xqueue/tutor.py - name: settings - subPath: tutor.py - volumes: - - name: settings - configMap: - name: xqueue-settings \ No newline at end of file diff --git a/plugins/xqueue/tutorxqueue/patches/k8s-services b/plugins/xqueue/tutorxqueue/patches/k8s-services deleted file mode 100644 index d4a227e..0000000 --- a/plugins/xqueue/tutorxqueue/patches/k8s-services +++ /dev/null @@ -1,12 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: xqueue -spec: - type: NodePort - ports: - - port: 8040 - protocol: TCP - selector: - app.kubernetes.io/name: xqueue \ No newline at end of file diff --git a/plugins/xqueue/tutorxqueue/patches/kustomization-configmapgenerator b/plugins/xqueue/tutorxqueue/patches/kustomization-configmapgenerator deleted file mode 100644 index baba3f8..0000000 --- a/plugins/xqueue/tutorxqueue/patches/kustomization-configmapgenerator +++ /dev/null @@ -1,3 +0,0 @@ -- name: xqueue-settings - files: - - plugins/xqueue/apps/xqueue/settings/tutor.py \ No newline at end of file diff --git a/plugins/xqueue/tutorxqueue/patches/local-docker-compose-services b/plugins/xqueue/tutorxqueue/patches/local-docker-compose-services deleted file mode 100644 index 5424688..0000000 --- a/plugins/xqueue/tutorxqueue/patches/local-docker-compose-services +++ /dev/null @@ -1,24 +0,0 @@ -############# Xqueue: external grading of Open edX problems -xqueue: - image: {{ DOCKER_REGISTRY }}{{ XQUEUE_DOCKER_IMAGE }} - volumes: - - ../plugins/xqueue/apps/settings/tutor.py:/openedx/xqueue/xqueue/tutor.py - - ../../data/xqueue:/openedx/data - environment: - DJANGO_SETTINGS_MODULE: xqueue.tutor - restart: unless-stopped - {% if ACTIVATE_MYSQL %}depends_on: - - mysql{% endif %} - -xqueue_consumer: - image: {{ DOCKER_REGISTRY }}{{ XQUEUE_DOCKER_IMAGE }} - volumes: - - ../plugins/xqueue/apps/settings/tutor.py:/openedx/xqueue/xqueue/tutor.py - - ../../data/xqueue:/openedx/data - environment: - DJANGO_SETTINGS_MODULE: xqueue.tutor - restart: unless-stopped - entrypoint: ["sh", "-e", "-c"] - command: ["while true; do echo 'running consumers'; ./manage.py run_consumer; sleep 10; done"] - {% if ACTIVATE_MYSQL %}depends_on: - - mysql{% endif %} \ No newline at end of file diff --git a/plugins/xqueue/tutorxqueue/patches/openedx-common-settings b/plugins/xqueue/tutorxqueue/patches/openedx-common-settings deleted file mode 100644 index cdb3f10..0000000 --- a/plugins/xqueue/tutorxqueue/patches/openedx-common-settings +++ /dev/null @@ -1,7 +0,0 @@ -XQUEUE_INTERFACE = { - "django_auth": { - "username": "{{ XQUEUE_AUTH_USERNAME }}", - "password": "{{ XQUEUE_AUTH_PASSWORD }}" - }, - "url": "http://xqueue:8040" -} \ No newline at end of file diff --git a/plugins/xqueue/tutorxqueue/plugin.py b/plugins/xqueue/tutorxqueue/plugin.py deleted file mode 100644 index fc77962..0000000 --- a/plugins/xqueue/tutorxqueue/plugin.py +++ /dev/null @@ -1,35 +0,0 @@ -from glob import glob -import os - -HERE = os.path.abspath(os.path.dirname(__file__)) - -config = { - "add": { - "AUTH_PASSWORD": "{{ 8|random_string }}", - "MYSQL_PASSWORD": "{{ 8|random_string }}", - "SECRET_KEY": "{{ 24|random_string }}", - }, - "defaults": { - "DOCKER_IMAGE": "overhangio/openedx-xqueue:{{ TUTOR_VERSION }}", - "AUTH_USERNAME": "lms", - "MYSQL_DATABASE": "xqueue", - "MYSQL_USERNAME": "xqueue", - }, -} - -templates = os.path.join(HERE, "templates") -hooks = { - "init": ["mysql-client", "xqueue"], - "build-image": {"xqueue": "{{ XQUEUE_DOCKER_IMAGE }}"}, - "remote-image": {"xqueue": "{{ XQUEUE_DOCKER_IMAGE }}"}, -} - - -def patches(): - all_patches = {} - for path in glob(os.path.join(HERE, "patches", "*")): - with open(path) as patch_file: - name = os.path.basename(path) - content = patch_file.read() - all_patches[name] = content - return all_patches diff --git a/plugins/xqueue/tutorxqueue/templates/xqueue/apps/settings/tutor.py b/plugins/xqueue/tutorxqueue/templates/xqueue/apps/settings/tutor.py deleted file mode 100644 index d6e80c0..0000000 --- a/plugins/xqueue/tutorxqueue/templates/xqueue/apps/settings/tutor.py +++ /dev/null @@ -1,18 +0,0 @@ -from .settings import * - -DATABASES = { - "default": { - "ENGINE": "django.db.backends.mysql", - "HOST": "{{ MYSQL_HOST }}", - "PORT": {{MYSQL_PORT}}, - "NAME": "{{ XQUEUE_MYSQL_DATABASE }}", - "USER": "{{ XQUEUE_MYSQL_USERNAME }}", - "PASSWORD": "{{ XQUEUE_MYSQL_PASSWORD }}", - } -} - -LOGGING = get_logger_config(log_dir="/openedx/data/", logging_env="tutor", dev_env=True) - -SECRET_KEY = "{{ XQUEUE_SECRET_KEY }}" - -XQUEUE_USERS = {"{{ XQUEUE_AUTH_USERNAME }}": "{{ XQUEUE_AUTH_PASSWORD}}"} diff --git a/plugins/xqueue/tutorxqueue/templates/xqueue/build/xqueue/Dockerfile b/plugins/xqueue/tutorxqueue/templates/xqueue/build/xqueue/Dockerfile deleted file mode 100644 index 8538162..0000000 --- a/plugins/xqueue/tutorxqueue/templates/xqueue/build/xqueue/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM ubuntu:18.04 -MAINTAINER Overhang.io - -RUN apt update && \ - apt upgrade -y && \ - apt install -y language-pack-en git python-pip libmysqlclient-dev - -RUN mkdir /openedx /openedx/data -RUN git clone https://github.com/edx/xqueue --branch open-release/ironwood.2 --depth 1 /openedx/xqueue -WORKDIR /openedx/xqueue - -RUN pip install -r requirements.txt - -EXPOSE 8040 -CMD gunicorn --workers=2 --name xqueue --bind=0.0.0.0:8040 --max-requests=1000 xqueue.wsgi:application diff --git a/plugins/xqueue/tutorxqueue/templates/xqueue/hooks/mysql-client/init b/plugins/xqueue/tutorxqueue/templates/xqueue/hooks/mysql-client/init deleted file mode 100644 index 9731e4b..0000000 --- a/plugins/xqueue/tutorxqueue/templates/xqueue/hooks/mysql-client/init +++ /dev/null @@ -1,2 +0,0 @@ -mysql -u root --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e 'CREATE DATABASE IF NOT EXISTS {{ XQUEUE_MYSQL_DATABASE }};' -mysql -u root --password="{{ MYSQL_ROOT_PASSWORD }}" --host "{{ MYSQL_HOST }}" --port {{ MYSQL_PORT }} -e 'GRANT ALL ON {{ XQUEUE_MYSQL_DATABASE }}.* TO "{{ XQUEUE_MYSQL_USERNAME }}"@"%" IDENTIFIED BY "{{ XQUEUE_MYSQL_PASSWORD }}";' diff --git a/plugins/xqueue/tutorxqueue/templates/xqueue/hooks/xqueue/init b/plugins/xqueue/tutorxqueue/templates/xqueue/hooks/xqueue/init deleted file mode 100644 index f0c3d44..0000000 --- a/plugins/xqueue/tutorxqueue/templates/xqueue/hooks/xqueue/init +++ /dev/null @@ -1 +0,0 @@ -./manage.py migrate diff --git a/requirements/plugins.txt b/requirements/plugins.txt index ef35a4c..7237b94 100644 --- a/requirements/plugins.txt +++ b/requirements/plugins.txt @@ -1,6 +1,6 @@ --e ./plugins/notes --e ./plugins/xqueue tutor-discovery tutor-ecommerce tutor-figures -tutor-minio \ No newline at end of file +tutor-minio +tutor-notes +tutor-xqueue \ No newline at end of file