feat: upgrade to nutmeg
This commit is contained in:
parent
d2f4ea6f35
commit
778b698084
10
README.rst
10
README.rst
@ -84,18 +84,10 @@ Debugging
|
||||
|
||||
To debug the course discovery service, you are encouraged to mount the course-discovery repo from the host in the development container:
|
||||
|
||||
tutor dev runserver -v ~/projets/openedx/repos/course-discovery/:/openedx/discovery discovery
|
||||
tutor dev start --mount /path/to/course-discovery/ discovery
|
||||
|
||||
You can then access the development server at http://discovery.local.overhang.io:8381. Feel free to add breakpoints (``import pdb; pdb.set_trace()``) anywhere in your source code to debug your application.
|
||||
|
||||
Alternatively, you may bind-mount a local course-discovery repository by adding the following to ``$(tutor config printroot)/env/dev/docker-compose.override.yml``::
|
||||
|
||||
version: "3.7"
|
||||
services:
|
||||
discovery:
|
||||
volumes:
|
||||
- /path/to/course-discovery/:/openedx/discovery
|
||||
|
||||
Once a local repository is mounted in the image, you will have to install nodejs dependencies and collect static assets::
|
||||
|
||||
tutor dev run discovery npm install --development
|
||||
|
||||
10
setup.py
10
setup.py
@ -8,7 +8,9 @@ with io.open(os.path.join(here, "README.rst"), "rt", encoding="utf8") as f:
|
||||
readme = f.read()
|
||||
|
||||
about = {}
|
||||
with io.open(os.path.join(here, "tutordiscovery", "__about__.py"), "rt", encoding="utf-8") as f:
|
||||
with io.open(
|
||||
os.path.join(here, "tutordiscovery", "__about__.py"), "rt", encoding="utf-8"
|
||||
) as f:
|
||||
exec(f.read(), about)
|
||||
|
||||
|
||||
@ -29,17 +31,15 @@ setup(
|
||||
long_description=readme,
|
||||
packages=find_packages(exclude=["tests*"]),
|
||||
include_package_data=True,
|
||||
install_requires=["tutor>=13.0.0,<14.0.0"],
|
||||
install_requires=["tutor>=14.0.0,<15.0.0"],
|
||||
python_requires=">=3.5",
|
||||
entry_points={"tutor.plugin.v0": ["discovery = tutordiscovery.plugin"]},
|
||||
entry_points={"tutor.plugin.v1": ["discovery = tutordiscovery.plugin"]},
|
||||
classifiers=[
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"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",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
|
||||
@ -1 +1 @@
|
||||
__version__ = "13.0.1"
|
||||
__version__ = "14.0.0"
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
from glob import glob
|
||||
import os
|
||||
import pkg_resources
|
||||
|
||||
from tutor import hooks as tutor_hooks
|
||||
|
||||
from .__about__ import __version__
|
||||
|
||||
HERE = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
templates = os.path.join(HERE, "templates")
|
||||
|
||||
config = {
|
||||
"add": {
|
||||
"unique": {
|
||||
"MYSQL_PASSWORD": "{{ 8|random_string }}",
|
||||
"SECRET_KEY": "{{ 20|random_string }}",
|
||||
"OAUTH2_SECRET": "{{ 8|random_string }}",
|
||||
@ -29,18 +31,86 @@ config = {
|
||||
},
|
||||
}
|
||||
|
||||
hooks = {
|
||||
"build-image": {"discovery": "{{ DISCOVERY_DOCKER_IMAGE }}"},
|
||||
"remote-image": {"discovery": "{{ DISCOVERY_DOCKER_IMAGE }}"},
|
||||
"init": ["mysql", "lms", "discovery"],
|
||||
}
|
||||
# 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"),
|
||||
)
|
||||
)
|
||||
|
||||
# Image management
|
||||
tutor_hooks.Filters.IMAGES_BUILD.add_item(
|
||||
(
|
||||
"discovery",
|
||||
("plugins", "discovery", "build", "discovery"),
|
||||
"{{ DISCOVERY_DOCKER_IMAGE }}",
|
||||
(),
|
||||
)
|
||||
)
|
||||
tutor_hooks.Filters.IMAGES_PULL.add_item(
|
||||
(
|
||||
"discovery",
|
||||
"{{ DISCOVERY_DOCKER_IMAGE }}",
|
||||
)
|
||||
)
|
||||
tutor_hooks.Filters.IMAGES_PUSH.add_item(
|
||||
(
|
||||
"discovery",
|
||||
"{{ DISCOVERY_DOCKER_IMAGE }}",
|
||||
)
|
||||
)
|
||||
|
||||
# Automount /openedx/discovery folder from the container
|
||||
@tutor_hooks.Filters.COMPOSE_MOUNTS.add()
|
||||
def _mount_course_discovery(mounts, name):
|
||||
if name == "course-discovery":
|
||||
mounts.append(("discovery", "/openedx/discovery"))
|
||||
return mounts
|
||||
|
||||
|
||||
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
|
||||
####### Boilerplate code
|
||||
# Add the "templates" folder as a template root
|
||||
tutor_hooks.Filters.ENV_TEMPLATE_ROOTS.add_item(
|
||||
pkg_resources.resource_filename("tutordiscovery", "templates")
|
||||
)
|
||||
# Render the "build" and "apps" folders
|
||||
tutor_hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
|
||||
[
|
||||
("discovery/build", "plugins"),
|
||||
("discovery/apps", "plugins"),
|
||||
],
|
||||
)
|
||||
# Load patches from files
|
||||
for path in glob(
|
||||
os.path.join(
|
||||
pkg_resources.resource_filename("tutordiscovery", "patches"),
|
||||
"*",
|
||||
)
|
||||
):
|
||||
with open(path, encoding="utf-8") as patch_file:
|
||||
tutor_hooks.Filters.ENV_PATCHES.add_item(
|
||||
(os.path.basename(path), patch_file.read())
|
||||
)
|
||||
# Add configuration entries
|
||||
tutor_hooks.Filters.CONFIG_DEFAULTS.add_items(
|
||||
[(f"DISCOVERY_{key}", value) for key, value in config.get("defaults", {}).items()]
|
||||
)
|
||||
tutor_hooks.Filters.CONFIG_UNIQUE.add_items(
|
||||
[(f"DISCOVERY_{key}", value) for key, value in config.get("unique", {}).items()]
|
||||
)
|
||||
tutor_hooks.Filters.CONFIG_OVERRIDES.add_items(
|
||||
list(config.get("overrides", {}).items())
|
||||
)
|
||||
|
||||
@ -23,11 +23,15 @@ ENV DISCOVERY_CFG /openedx/config.yml
|
||||
# Install python venv
|
||||
RUN python3 -m venv ../venv/
|
||||
ENV PATH "/openedx/venv/bin:$PATH"
|
||||
RUN pip install setuptools==44.1.0 pip==20.3.4 wheel==0.37.0
|
||||
# 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
|
||||
|
||||
# Install a recent version of nodejs
|
||||
RUN pip install nodeenv
|
||||
RUN nodeenv /openedx/nodeenv --node=12.13.0 --prebuilt
|
||||
# nodejs version picked from https://github.com/openedx/course-discovery/blob/master/Dockerfile
|
||||
RUN nodeenv /openedx/nodeenv --node=16.14.2 --prebuilt
|
||||
ENV PATH /openedx/nodeenv/bin:${PATH}
|
||||
|
||||
# Install python and nodejs requirements
|
||||
@ -39,9 +43,11 @@ RUN npm install --verbose --registry=$NPM_REGISTRY --production
|
||||
RUN ./node_modules/.bin/bower install --allow-root --production
|
||||
|
||||
# Install django-redis for using redis as a django cache
|
||||
RUN pip install django-redis==5.0.0
|
||||
# https://pypi.org/project/django-redis/
|
||||
RUN pip install django-redis==5.2.0
|
||||
|
||||
# Install uwsgi
|
||||
# https://pypi.org/project/uWSGI/
|
||||
RUN pip install uwsgi==2.0.20
|
||||
|
||||
# Collect static assets
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user