From 36bbec4a9e2b0534345937f46cff76722c9cea10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 10 Nov 2022 15:51:07 +0100 Subject: [PATCH] feat: upgrade to olive --- .gitlab-ci.yml | 2 +- README.rst | 22 ++++++++++-- setup.py | 5 +-- tutordiscovery/__about__.py | 3 +- tutordiscovery/plugin.py | 36 +++++++++---------- .../discovery/build/discovery/Dockerfile | 6 ++-- 6 files changed, 46 insertions(+), 28 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 39523a2..36126c1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: TUTOR_PLUGIN: discovery TUTOR_IMAGES: discovery TUTOR_PYPI_PACKAGE: tutor-discovery - OPENEDX_RELEASE: nutmeg + OPENEDX_RELEASE: olive GITHUB_REPO: overhangio/tutor-discovery include: diff --git a/README.rst b/README.rst index 078b77b..a09d0c4 100644 --- a/README.rst +++ b/README.rst @@ -32,7 +32,7 @@ Creating a user The discovery user interface will be available at http://discovery.local.overhang.io for a local test instance, and at ``DISCOVERY_HOST`` (by default: http(s)://discovery.) in production. In order to run commands from the UI, a user must be created:: - tutor local run discovery ./manage.py createsuperuser + tutor local run discovery ./manage.py createsuperuser Then, you must login with this user at http://discovery.local.overhang.io/admin. @@ -55,8 +55,8 @@ Re-indexing courses :: - tutor local run discovery ./manage.py refresh_course_metadata --partner_code=openedx - tutor local run discovery ./manage.py update_index --disable-change-limit + tutor local run discovery ./manage.py refresh_course_metadata --partner_code=openedx + tutor local run discovery ./manage.py update_index --disable-change-limit Caching programs ~~~~~~~~~~~~~~~~ @@ -92,6 +92,22 @@ Troubleshooting This Tutor plugin is maintained by Régis Behmo from `Overhang.IO `__. Community support is available from the official `Open edX forum `__. Do you need help with this plugin? See the `troubleshooting `__ section from the Tutor documentation. + +`Max retries exceeded with url` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +When running in production with HTTPS enabled, you may face this error during the `init` phase of `tutor local launch`: + +``` +requests.exceptions.ConnectionError: HTTPSConnectionPool(host='', port=443): Max retries exceeded with url: /api/courses/v1/courses/?page=1&page_size=10&username=discovery +``` + +This error may be due to an incorrect DNS resolution of the LMS DNS record. With some cloud providers (for instance: [DigitalOcean](https://digitalocean.com/)) the `/etc/hosts` file on the host automatically contains the following entry:: + + 127.0.1.1 + +This entry may be present if you named your server with the LMS hostname. + License ------- diff --git a/setup.py b/setup.py index 01a791f..183f853 100644 --- a/setup.py +++ b/setup.py @@ -31,10 +31,11 @@ setup( maintainer_email="regis@overhang.io", description="A Tutor plugin for course discovery, the Open edX service for providing access to consolidated course and program metadata", long_description=readme, + long_description_content_type="text/x-rst", packages=find_packages(exclude=["tests*"]), include_package_data=True, - install_requires=["tutor>=14.0.0,<15.0.0"], - python_requires=">=3.5", + install_requires=["tutor>=15.0.0,<16.0.0"], + python_requires=">=3.7", entry_points={"tutor.plugin.v1": ["discovery = tutordiscovery.plugin"]}, classifiers=[ "Development Status :: 5 - Production/Stable", diff --git a/tutordiscovery/__about__.py b/tutordiscovery/__about__.py index 897518d..1aa815c 100644 --- a/tutordiscovery/__about__.py +++ b/tutordiscovery/__about__.py @@ -1 +1,2 @@ -__version__ = "14.0.2" +__version__ = "15.0.0" + diff --git a/tutordiscovery/plugin.py b/tutordiscovery/plugin.py index fbb6b10..56fab18 100644 --- a/tutordiscovery/plugin.py +++ b/tutordiscovery/plugin.py @@ -32,24 +32,24 @@ config = { } # Initialization tasks -tutor_hooks.Filters.COMMANDS_INIT.add_item( - ( - "mysql", - ("discovery", "tasks", "mysql", "init"), - ) -) -tutor_hooks.Filters.COMMANDS_INIT.add_item( - ( - "lms", - ("discovery", "tasks", "lms", "init"), - ) -) -tutor_hooks.Filters.COMMANDS_INIT.add_item( - ( - "discovery", - ("discovery", "tasks", "discovery", "init"), - ) -) +init_tasks = ("mysql", "lms", "discovery") +for service in init_tasks: + with open( + os.path.join( + pkg_resources.resource_filename("tutordiscovery", "templates"), + "discovery", + "tasks", + service, + "init", + ), + encoding="utf8", + ) as fi: + tutor_hooks.Filters.CLI_DO_INIT_TASKS.add_item( + ( + service, + fi.read(), + ) + ) # Image management tutor_hooks.Filters.IMAGES_BUILD.add_item( diff --git a/tutordiscovery/templates/discovery/build/discovery/Dockerfile b/tutordiscovery/templates/discovery/build/discovery/Dockerfile index dc74092..7e0f30d 100644 --- a/tutordiscovery/templates/discovery/build/discovery/Dockerfile +++ b/tutordiscovery/templates/discovery/build/discovery/Dockerfile @@ -3,7 +3,7 @@ FROM docker.io/ubuntu:20.04 ENV DEBIAN_FRONTEND=noninteractive RUN apt update && \ apt install -y curl git-core language-pack-en python3 python3-pip python3-venv \ - build-essential libffi-dev libmysqlclient-dev libxml2-dev libxslt-dev libjpeg-dev libssl-dev + build-essential libcairo2 libffi-dev libmysqlclient-dev libxml2-dev libxslt-dev libjpeg-dev libssl-dev ENV LC_ALL en_US.UTF-8 ARG APP_USER_ID=1000 @@ -26,7 +26,7 @@ ENV PATH "/openedx/venv/bin:$PATH" # https://pypi.org/project/setuptools/ # https://pypi.org/project/pip/ # https://pypi.org/project/wheel/ -RUN pip install setuptools==62.1.0 pip==22.0.4 wheel==0.37.1 +RUN pip install setuptools==65.5.1 pip==22.3.1 wheel==0.38.4 # Install a recent version of nodejs RUN pip install nodeenv @@ -48,7 +48,7 @@ RUN pip install django-redis==5.2.0 # Install uwsgi # https://pypi.org/project/uWSGI/ -RUN pip install uwsgi==2.0.20 +RUN pip install uwsgi==2.0.21 # Collect static assets COPY --chown=app:app assets.py ./course_discovery/settings/assets.py