From 8e052f703f23a89c1eb74ab5b02a486115166362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 10 Mar 2022 15:39:10 +0100 Subject: [PATCH 1/5] docs: clarify image building on arm64 Close #590. --- docs/tutorials/arm64.rst | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/docs/tutorials/arm64.rst b/docs/tutorials/arm64.rst index c8500df..b50431b 100644 --- a/docs/tutorials/arm64.rst +++ b/docs/tutorials/arm64.rst @@ -22,9 +22,9 @@ Next, configure Tutor:: Go through the configuration process, answering each question. -Then, build the Open edX image:: +Then, build the "openedx" and "permissions" images:: - tutor images build openedx + tutor images build openedx permissions If you want to use Tutor as an Open edX development environment, you should also build the development images:: @@ -45,18 +45,16 @@ Configure Tutor to use MariaDB:: Finish setup and start Tutor ---------------------------- -From this point on, use Tutor as normal. - -For example, to apply migrations and start Open edX:: +From this point on, use Tutor as normal. For example, start Open edX and run migrations with:: + tutor local start -d tutor local init - tutor local start Or for a development environment:: - tutor local init tutor local stop - tutor dev start + tutor dev start -d + tutor dev init Using with tutor-mfe -------------------- From f13c3db833a55e01afefe106918712693d48ce3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 17 Mar 2022 10:34:17 +0100 Subject: [PATCH 2/5] fix: "unexpected args" error on k8s `kubectl_apply` was missing a "root" argument. Close #611. --- CHANGELOG.md | 2 ++ tutor/commands/k8s.py | 19 +++++++------------ tutor/jobs.py | 14 ++++---------- 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8745b4a..4329664 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Note: Breaking changes between versions are indicated by "💥". ## Unreleased +- [Bugfix] Fix "Unexpected args" error during service initialization on Kubernetes (#611). + ## v13.1.6 (2022-03-15) - [Bugfix] Fix `local/k8s quickstart` commands when upgrading from an older release (#595). diff --git a/tutor/commands/k8s.py b/tutor/commands/k8s.py index 7adcad1..64c0146 100644 --- a/tutor/commands/k8s.py +++ b/tutor/commands/k8s.py @@ -113,6 +113,7 @@ class K8sJobRunner(jobs.BaseJobRunner): # We cannot use the k8s API to create the job: configMap and volume names need # to be found with the right suffixes. kubectl_apply( + self.root, "--selector", f"app.kubernetes.io/name={job_name}", ) @@ -232,27 +233,21 @@ def start(context: Context, names: List[str]) -> None: for name in names: if name == "all": # Create volumes - utils.kubectl( - "apply", - "--kustomize", - tutor_env.pathjoin(context.root), + kubectl_apply( + context.root, "--wait", "--selector", "app.kubernetes.io/component=volume", ) # Create everything else except jobs - utils.kubectl( - "apply", - "--kustomize", - tutor_env.pathjoin(context.root), + kubectl_apply( + context.root, "--selector", "app.kubernetes.io/component notin (job,volume,namespace)", ) else: - utils.kubectl( - "apply", - "--kustomize", - tutor_env.pathjoin(context.root), + kubectl_apply( + context.root, "--selector", f"app.kubernetes.io/name={name}", ) diff --git a/tutor/jobs.py b/tutor/jobs.py index c3bc3da..56624c8 100644 --- a/tutor/jobs.py +++ b/tutor/jobs.py @@ -56,24 +56,20 @@ def initialise(runner: BaseJobRunner, limit_to: Optional[str] = None) -> None: if limit_to is None or limit_to == plugin_name: for service in hook: fmt.echo_info( - "Plugin {}: running pre-init for service {}...".format( - plugin_name, service - ) + f"Plugin {plugin_name}: running pre-init for service {service}..." ) runner.run_job_from_template( service, plugin_name, "hooks", service, "pre-init" ) for service in ["lms", "cms"]: if limit_to is None or limit_to == service: - fmt.echo_info("Initialising {}...".format(service)) + fmt.echo_info(f"Initialising {service}...") runner.run_job_from_template(service, "hooks", service, "init") for plugin_name, hook in runner.iter_plugin_hooks("init"): if limit_to is None or limit_to == plugin_name: for service in hook: fmt.echo_info( - "Plugin {}: running init for service {}...".format( - plugin_name, service - ) + f"Plugin {plugin_name}: running init for service {service}..." ) runner.run_job_from_template( service, plugin_name, "hooks", service, "init" @@ -136,9 +132,7 @@ site.themes.create(theme_dir_name='{theme_name}') """.format( theme_name=theme_name, domain_name=domain_name ) - command = BASE_OPENEDX_COMMAND + './manage.py lms shell -c "{python_code}"'.format( - python_code=python_code - ) + command = BASE_OPENEDX_COMMAND + f'./manage.py lms shell -c "{python_code}"' runner.run_job("lms", command) From a24b29271ad92a5bee88bde8d96025dbf85c361b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 10 Mar 2022 15:57:19 +0100 Subject: [PATCH 3/5] fix: dockerize on arm64 The version of dockerize that shipped with the "openedx" image was not compatible with arm64. The original project is unmaintained, but there is a fork that provides a version that is compatible with arm64. This was tested on arm64 with buildx: docker buildx build --tag=openedx --platform=linux/arm64 ~/.local/share/tutor/env/build/openedx Close #591 --- CHANGELOG.md | 1 + tutor/templates/build/openedx/Dockerfile | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4329664..bd08004 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Note: Breaking changes between versions are indicated by "💥". ## Unreleased +- [Bugfix] Fix dockerize on arm64 by switching to the [powerman/dockerize](https://github.com/powerman/dockerize) fork (#591). - [Bugfix] Fix "Unexpected args" error during service initialization on Kubernetes (#611). ## v13.1.6 (2022-03-15) diff --git a/tutor/templates/build/openedx/Dockerfile b/tutor/templates/build/openedx/Dockerfile index 07360f1..2bd2bd7 100644 --- a/tutor/templates/build/openedx/Dockerfile +++ b/tutor/templates/build/openedx/Dockerfile @@ -23,10 +23,12 @@ RUN $PYENV_ROOT/versions/$PYTHON_VERSION/bin/python -m venv /openedx/venv ###### Install Dockerize to wait for mysql DB availability FROM minimal as dockerize -ARG DOCKERIZE_VERSION=v0.6.1 -RUN curl -L -o /tmp/dockerize.tar.gz https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \ - && tar -C /usr/local/bin -xzvf /tmp/dockerize.tar.gz \ - && rm /tmp/dockerize.tar.gz +# https://github.com/powerman/dockerize/releases +ARG DOCKERIZE_VERSION=v0.16.0 +RUN dockerize_url="https://github.com/powerman/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-$(uname -m | sed 's@aarch@arm@')" \ + && echo "Downloading dockerize from $dockerize_url" \ + && curl --fail --location --output /usr/local/bin/dockerize $dockerize_url \ + && chmod a+x /usr/local/bin/dockerize ###### Checkout edx-platform code FROM minimal as code @@ -126,7 +128,7 @@ ARG APP_USER_ID=1000 RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app USER ${APP_USER_ID} -COPY --chown=app:app --from=dockerize /usr/local/bin/dockerize /usr/local/bin/dockerize +COPY --from=dockerize /usr/local/bin/dockerize /usr/local/bin/dockerize COPY --chown=app:app --from=code /openedx/edx-platform /openedx/edx-platform COPY --chown=app:app --from=locales /openedx/locale /openedx/locale COPY --chown=app:app --from=python /opt/pyenv /opt/pyenv From 766f392189cba25d598c3b57fca415ca047391d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 17 Mar 2022 10:45:40 +0100 Subject: [PATCH 4/5] docs: fix sample saml plugin See: https://github.com/overhangio/tutor/pull/604 --- docs/plugins/examples.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins/examples.rst b/docs/plugins/examples.rst index 6bdab38..ad56407 100644 --- a/docs/plugins/examples.rst +++ b/docs/plugins/examples.rst @@ -53,7 +53,7 @@ Enable SAML authentication openedx-lms-common-settings: | # saml special settings - AUTHENTICATION_BACKENDS += ["third_party_auth.saml.SAMLAuthBackend", "django.contrib.auth.backends.ModelBackend"] + AUTHENTICATION_BACKENDS += ["common.djangoapps.third_party_auth.saml.SAMLAuthBackend", "django.contrib.auth.backends.ModelBackend"] openedx-auth: | "SOCIAL_AUTH_SAML_SP_PRIVATE_KEY": "yoursecretkey", From 3e2c4aebf40f9c2afd5711aa4b791cf2944df6bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Behmo?= Date: Thu, 17 Mar 2022 10:47:52 +0100 Subject: [PATCH 5/5] v13.1.7 (2022-03-17) - [Bugfix] Fix dockerize on arm64 by switching to the [powerman/dockerize](https://github.com/powerman/dockerize) fork (#591). - [Bugfix] Fix "Unexpected args" error during service initialization on Kubernetes (#611). --- CHANGELOG.md | 2 ++ tutor/__about__.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd08004..bca0588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Note: Breaking changes between versions are indicated by "💥". ## Unreleased +## v13.1.7 (2022-03-17) + - [Bugfix] Fix dockerize on arm64 by switching to the [powerman/dockerize](https://github.com/powerman/dockerize) fork (#591). - [Bugfix] Fix "Unexpected args" error during service initialization on Kubernetes (#611). diff --git a/tutor/__about__.py b/tutor/__about__.py index dd401cf..45cbe60 100644 --- a/tutor/__about__.py +++ b/tutor/__about__.py @@ -2,7 +2,7 @@ import os # Increment this version number to trigger a new release. See # docs/tutor.html#versioning for information on the versioning scheme. -__version__ = "13.1.6" +__version__ = "13.1.7" # The version suffix will be appended to the actual version, separated by a # dash. Use this suffix to differentiate between the actual released version and