feat: upgrade to Palm
This commit is contained in:
parent
6cf8776b29
commit
8448e2ba2f
@ -2,7 +2,7 @@ variables:
|
||||
TUTOR_PLUGIN: xqueue
|
||||
TUTOR_IMAGES: xqueue
|
||||
TUTOR_PYPI_PACKAGE: tutor-xqueue
|
||||
OPENEDX_RELEASE: olive
|
||||
OPENEDX_RELEASE: palm
|
||||
GITHUB_REPO: overhangio/tutor-xqueue
|
||||
|
||||
include:
|
||||
|
||||
@ -14,7 +14,7 @@ Then, to enable this plugin, run::
|
||||
|
||||
tutor plugins enable xqueue
|
||||
|
||||
You should then run the initialisation scripts. The easiest way to do this is to run ``tutor local quickstart``.
|
||||
You should then run the initialisation scripts. The easiest way to do this is to run ``tutor local launch``.
|
||||
|
||||
Usage
|
||||
-----
|
||||
@ -108,9 +108,11 @@ Configuration
|
||||
- ``XQUEUE_DOCKER_IMAGE`` (default: ``"{{ DOCKER_REGISTRY }}overhangio/openedx-xqueue:{{ TUTOR_VERSION }}"``)
|
||||
- ``XQUEUE_HOST`` (default: ``"xqueue.{{ LMS_HOST }}"``)
|
||||
- ``XQUEUE_MYSQL_PASSWORD`` (default: ``"{{ 8|random_string }}"``)
|
||||
- ``XQUEUE_MYSQL_DATABASE`` (default: ``"xqueue"``
|
||||
- ``XQUEUE_MYSQL_DATABASE`` (default: ``"xqueue"``)
|
||||
- ``XQUEUE_MYSQL_USERNAME`` (default: ``"xqueue"``)
|
||||
- ``XQUEUE_SECRET_KEY`` (default: ``"{{ 24|random_string }}"``)
|
||||
- ``XQUEUE_REPOSITORY`` (default: ``"https://github.com/openedx/xqueue"``)
|
||||
- ``XQUEUE_REPOSITORY_VERSION`` (default: ``"{{ OPENEDX_COMMON_VERSION }}"``)
|
||||
|
||||
These values can be modified with ``tutor config save --set PARAM_NAME=VALUE`` commands.
|
||||
|
||||
|
||||
6
setup.py
6
setup.py
@ -32,8 +32,8 @@ setup(
|
||||
long_description_content_type="text/x-rst",
|
||||
packages=find_packages(exclude=["tests*"]),
|
||||
include_package_data=True,
|
||||
python_requires=">=3.7",
|
||||
install_requires=["tutor>=15.0.0,<16.0.0", "requests"],
|
||||
python_requires=">=3.8",
|
||||
install_requires=["tutor>=16.0.0,<17.0.0", "requests"],
|
||||
entry_points={"tutor.plugin.v1": ["xqueue = tutorxqueue.plugin"]},
|
||||
classifiers=[
|
||||
"Development Status :: 3 - Alpha",
|
||||
@ -41,9 +41,9 @@ setup(
|
||||
"License :: OSI Approved :: GNU Affero General Public License v3",
|
||||
"Operating System :: OS Independent",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 3.7",
|
||||
"Programming Language :: Python :: 3.8",
|
||||
"Programming Language :: Python :: 3.9",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
],
|
||||
)
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
__version__ = "15.0.1"
|
||||
__version__ = "16.0.0"
|
||||
|
||||
# Handle version suffix for nightly, just like tutor core.
|
||||
__version_suffix__ = ""
|
||||
|
||||
@ -1,18 +1,20 @@
|
||||
from glob import glob
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import typing as t
|
||||
from glob import glob
|
||||
|
||||
import click
|
||||
import pkg_resources
|
||||
import requests
|
||||
|
||||
from tutor import config as tutor_config
|
||||
from tutor import exceptions
|
||||
from tutor import hooks as tutor_hooks
|
||||
from tutor.exceptions import TutorError
|
||||
|
||||
from .__about__ import __version__
|
||||
|
||||
|
||||
config = {
|
||||
"unique": {
|
||||
"AUTH_PASSWORD": "{{ 8|random_string }}",
|
||||
@ -26,21 +28,34 @@ config = {
|
||||
"HOST": "xqueue.{{ LMS_HOST }}",
|
||||
"MYSQL_DATABASE": "xqueue",
|
||||
"MYSQL_USERNAME": "xqueue",
|
||||
"REPOSITORY": "https://github.com/openedx/xqueue",
|
||||
"REPOSITORY_VERSION": "{{ OPENEDX_COMMON_VERSION }}",
|
||||
},
|
||||
}
|
||||
|
||||
# Inizialization hooks
|
||||
tutor_hooks.Filters.COMMANDS_INIT.add_item((
|
||||
"mysql",
|
||||
("xqueue", "tasks", "mysql", "init"),
|
||||
))
|
||||
# Initialization hooks
|
||||
|
||||
tutor_hooks.Filters.COMMANDS_INIT.add_item((
|
||||
"xqueue",
|
||||
("xqueue", "tasks", "xqueue", "init"),
|
||||
))
|
||||
# To add a custom initialization task, create a bash script template under:
|
||||
# tutorcodejail/templates/codejail/tasks/
|
||||
# and then add it to the MY_INIT_TASKS list. Each task is in the format:
|
||||
# ("<service>", ("<path>", "<to>", "<script>", "<template>"))
|
||||
MY_INIT_TASKS: list[tuple[str, tuple[str, ...]]] = [
|
||||
("mysql", ("xqueue", "tasks", "mysql", "init")),
|
||||
("xqueue", ("xqueue", "tasks", "xqueue", "init")),
|
||||
]
|
||||
|
||||
# Image managment
|
||||
# For each task added to MY_INIT_TASKS, we load the task template
|
||||
# and add it to the CLI_DO_INIT_TASKS filter, which tells Tutor to
|
||||
# run it as part of the `init` job.
|
||||
for service, template_path in MY_INIT_TASKS:
|
||||
full_path: str = pkg_resources.resource_filename(
|
||||
"tutorxqueue", os.path.join("templates", *template_path)
|
||||
)
|
||||
with open(full_path, encoding="utf-8") as init_task_file:
|
||||
init_task: str = init_task_file.read()
|
||||
tutor_hooks.Filters.CLI_DO_INIT_TASKS.add_item((service, init_task))
|
||||
|
||||
# Image management
|
||||
tutor_hooks.Filters.IMAGES_BUILD.add_item((
|
||||
"xqueue",
|
||||
("plugins", "xqueue", "build", "xqueue"),
|
||||
@ -57,6 +72,7 @@ tutor_hooks.Filters.IMAGES_PUSH.add_item((
|
||||
"{{ XQUEUE_DOCKER_IMAGE }}",
|
||||
))
|
||||
|
||||
|
||||
@tutor_hooks.Filters.COMPOSE_MOUNTS.add()
|
||||
def _mount_xqueue(volumes, name):
|
||||
"""
|
||||
@ -71,6 +87,7 @@ def _mount_xqueue(volumes, name):
|
||||
]
|
||||
return volumes
|
||||
|
||||
|
||||
@click.group(help="Interact with the Xqueue server", name="xqueue")
|
||||
def command():
|
||||
pass
|
||||
@ -165,7 +182,7 @@ class Client:
|
||||
)
|
||||
message = response.get("content")
|
||||
if message != "Logged in":
|
||||
raise TutorError(
|
||||
raise exceptions.TutorError(
|
||||
"Could not login to xqueue server at {}. Response: '{}'".format(
|
||||
self.base_url, message
|
||||
)
|
||||
@ -243,22 +260,35 @@ for path in glob(
|
||||
)
|
||||
):
|
||||
with open(path, encoding="utf-8") as patch_file:
|
||||
tutor_hooks.Filters.ENV_PATCHES.add_item((os.path.basename(path), patch_file.read()))
|
||||
tutor_hooks.Filters.ENV_PATCHES.add_item(
|
||||
(os.path.basename(path), patch_file.read())
|
||||
)
|
||||
|
||||
# Add cli commands filter
|
||||
tutor_hooks.Filters.CLI_COMMANDS.add_item(command)
|
||||
|
||||
# Add configuration entries
|
||||
tutor_hooks.Filters.CONFIG_DEFAULTS.add_items(
|
||||
[
|
||||
(f"XQUEUE_{key}", value)
|
||||
for key, value in config.get("defaults", {}).items()
|
||||
]
|
||||
[(f"XQUEUE_{key}", value) for key, value in config.get("defaults", {}).items()]
|
||||
)
|
||||
tutor_hooks.Filters.CONFIG_UNIQUE.add_items(
|
||||
[
|
||||
(f"XQUEUE_{key}", value)
|
||||
for key, value in config.get("unique", {}).items()
|
||||
]
|
||||
[(f"XQUEUE_{key}", value) for key, value in config.get("unique", {}).items()]
|
||||
)
|
||||
tutor_hooks.Filters.CONFIG_OVERRIDES.add_items(list(config.get("overrides", {}).items()))
|
||||
tutor_hooks.Filters.CONFIG_OVERRIDES.add_items(
|
||||
list(config.get("overrides", {}).items())
|
||||
)
|
||||
|
||||
|
||||
########################################
|
||||
# Xqueue Public Host
|
||||
########################################
|
||||
|
||||
@tutor_hooks.Filters.APP_PUBLIC_HOSTS.add()
|
||||
def _xqueue_public_hosts(
|
||||
hosts: list[str], context_name: t.Literal["local", "dev"]
|
||||
) -> list[str]:
|
||||
if context_name == "dev":
|
||||
hosts += ["{{ XQUEUE_HOST }}:8000"]
|
||||
else:
|
||||
hosts += ["{{ XQUEUE_HOST }}"]
|
||||
return hosts
|
||||
|
||||
@ -1,22 +1,29 @@
|
||||
FROM docker.io/ubuntu:20.04
|
||||
{% if is_buildkit_enabled() %}# syntax=docker/dockerfile:1.4{% endif %}
|
||||
###### Minimal image with base system requirements for most stages ######
|
||||
FROM docker.io/ubuntu:20.04 as minimal
|
||||
|
||||
RUN apt update && \
|
||||
apt upgrade -y && \
|
||||
apt install -y language-pack-en git python3 python3-pip python3-venv libmysqlclient-dev
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/var/cache/apt,sharing=locked \
|
||||
--mount=type=cache,target=/var/lib/apt,sharing=locked{% endif %} \
|
||||
apt update && \
|
||||
apt upgrade -y && \
|
||||
apt install -y language-pack-en git python3 python3-pip python3-venv libmysqlclient-dev
|
||||
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||
|
||||
###### Git-clone xqueue repo ######
|
||||
ARG APP_USER_ID=1000
|
||||
RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app
|
||||
USER ${APP_USER_ID}
|
||||
|
||||
RUN git clone https://github.com/edx/xqueue --branch {{ OPENEDX_COMMON_VERSION }} --depth 1 /openedx/xqueue
|
||||
RUN git clone {{ XQUEUE_REPOSITORY }} --branch {{ XQUEUE_REPOSITORY_VERSION }} --depth 1 /openedx/xqueue
|
||||
WORKDIR /openedx/xqueue
|
||||
|
||||
###### Install python venv ######
|
||||
RUN python -m venv /openedx/venv
|
||||
ENV PATH /openedx/venv/bin:${PATH}
|
||||
RUN pip install --upgrade pip setuptools
|
||||
RUN pip install -r requirements.txt
|
||||
RUN pip install uwsgi==2.0.21
|
||||
|
||||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install --upgrade pip setuptools
|
||||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install -r requirements.txt
|
||||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install uwsgi==2.0.21
|
||||
|
||||
RUN mkdir /openedx/data /openedx/data/media
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user