Commit Graph

1136 Commits

Author SHA1 Message Date
Régis Behmo 3ab0dcb9e6 depr: templated hooks
Templated hooks we almost completely useless, so we get rid of them.
This allows us to get rid entirely of hook names and hook indexes, which
makes the whole implementation much simpler. Hook removal (with
`clear_all`) is achieved thanks to weak references.
2023-06-14 21:08:49 +02:00
Régis Behmo cbe32cbc15 docs: improve all available values from `ENV_TEMPLATE_VARIABLES` 2023-06-14 21:08:49 +02:00
Régis Behmo 18ce1f2fe4 feat: persistent bind-mounts
This is an important change, where we get remove the previous `--mount`
option, and instead opt for persistent bind-mounts.

Persistent bind mounts have several advantages:
- They make it easier to remember which folders need to be bind-mounted.
- Code is *much* less clunky, as we no longer need to generate temporary
  docker-compose files.
- They allow us to bind-mount host directories *at build time* using the
  buildx `--build-context` option.
- The transition from development to production becomes much easier, as
  images will automatically be built using the host repo.

The only drawback is that persistent bind-mounts are slightly less
portable: when a config.yml file is moved to a different folder, many
things will break if the repo is not checked out in the same path.

For instance, this is how to start working on a local fork of
edx-platform:

    tutor config save --append MOUNTS=/path/to/edx-platform

And that's all there is to it. No, this fork will be used whenever we
run:

    tutor images build openedx
    tutor local start
    tutor dev start

This change is made possible by huge improvements in the build time
performance. These improvements make it convenient to re-build Docker
images often.

Related issues:
https://github.com/openedx/wg-developer-experience/issues/71
https://github.com/openedx/wg-developer-experience/issues/66
https://github.com/openedx/wg-developer-experience/issues/166
2023-06-14 21:08:49 +02:00
Régis Behmo 7972a75915 feat: leverage `RUN --mount` for faster image building
We make use of the Docker build cache to install python and nodejs
requirements faster in the case of repeated builds.

This feature is only possible for users of BuildKit, so we detect
whether `docker buildx` is available at runtime.

We do not make use of `COPY --link` because the `--link` option is
incompatible with `--chown=app:app`:
https://github.com/docker/buildx/issues/1408

For reference, see:

https://www.docker.com/blog/dockerfiles-now-support-multiple-build-contexts/
https://docs.docker.com/engine/reference/commandline/buildx_build/#build-context
2023-06-14 21:08:49 +02:00
Régis Behmo 220b8296a9 feat: `config save --append/--remove KEY=VAL` options
This paves the way for persisting bind-mounts across runs, since this
setting will be a list.
2023-06-14 19:40:58 +02:00
Régis Behmo c2265c3f11 feat: simplify docker-compose permissions
It was useless to create a *-permissions job for every application.
Instead, we create a single "permissions" service. It can be extended
via the "docker-compose-permissions-command" patch.
2023-06-14 19:40:58 +02:00
Régis Behmo ee8de62770 depr: RUN_LMS, RUN_CMS settings
These tutor settings are mostly useless and make templates much more
difficult to work with.
2023-06-14 19:40:58 +02:00
Régis Behmo b2a22a6993 fix: remove useless "privileged: false" statements
These values are by default anyway.
2023-06-14 19:40:58 +02:00
Régis Behmo 39a8b46854 depr: drop support for `docker-compose`
Instead, the compose plugin must be installed.
We deprecate docker-compose because v1 is not supported starting from
the end of June 2023.

See "evolution of compose": https://docs.docker.com/compose/compose-v2/
2023-06-14 19:40:58 +02:00
Régis Behmo 11b2091e32 depr: halt compatibility with python 3.7 2023-06-14 19:40:58 +02:00
Régis Behmo 2d6b9c1767 feat: hide TOS link during registration
Registering a user was causing a 400 error because the LMS expected the
TOS checkbox to be checked, but it's not displayed in the frontend. So
we just disable it.

Close https://github.com/openedx/wg-build-test-release/issues/262
2023-06-14 19:40:58 +02:00
Régis Behmo 6dbb5baf81 feat: `importdemocourse --repo-dir=...` option
This allows us to run:

    tutor local do importdemocourse --repo=https://github.com/openedx/openedx-test-course --version=open-release/palm.master --repo-dir=test-course/course
2023-06-14 19:40:58 +02:00
Régis Behmo b3c3c4a2cc feat: upgrade to Palm
Among other changes: ORA2 file uploads were stored in a folder named
"SET-ME-PLEASE (ex.  bucket-name)" (sigh). With this change, the folder
should be automatically renamed to "openedxuploads". This issue has been
occuring since June 2019... (sigh²)

Close #707
2023-06-14 19:40:58 +02:00
Régis Behmo 253b69ffe3 feat: faster builds with registry cache
Automatically pull Docker build cache from remote registry. This
considerably improves build performances, as discovered here:
https://github.com/overhangio/test-docker-build/
2023-06-14 19:40:58 +02:00
Overhang.IO bcc4f6bf1a Merge remote-tracking branch 'origin/master' into nightly 2023-06-13 08:41:13 +00:00
Régis Behmo 9d2c1f134c v15.3.7 2023-06-13 10:21:55 +02:00
Florian Haas 30d3ba3ba8 chore: Bump MongoDB default to version 4.2.24
Bump the default image reference for MongoDB from 4.2.17 to 4.2.24, to
address a critical issue present in versions 4.2.0 through 4.2.23.

References:
https://www.mongodb.com/docs/manual/release-notes/4.2/#patch-releases
https://jira.mongodb.org/browse/WT-10461

Fixes #854.
2023-06-13 10:10:53 +02:00
Emad Rad 86f846aba3 feat: Add support for loading in-cluster config when running inside a pod
in some cases, tutor might run inside a pod, which that pod has access to a cluster via role binding and a service account. this way, there's no ./kube/config file, but kubectl commands run with no issue.

Close #843
2023-06-06 15:14:52 +02:00
Overhang.IO e73e13a6e9 Merge remote-tracking branch 'origin/master' into nightly 2023-06-01 14:10:29 +00:00
Emad Rad 1d3a215c00 feat: Add support for loading in-cluster config when running inside a pod
in some cases, tutor might run inside a pod, which that pod has access to a cluster via role binding and a service account. this way, there's no ./kube/config file, but kubectl commands run with no issue.

Close #843
2023-06-01 15:44:27 +02:00
Overhang.IO af997dbc51 Merge remote-tracking branch 'origin/master' into nightly 2023-05-29 14:19:19 +00:00
Johan Castiblanco 4bb8671f26 fix!: use correct case for authsource mongo
Update `authSource`  keyword argument to  `authsource`

Authsource was configurated in camelcase.
https://github.com/overhangio/tutor/blob/master/tutor/templates/apps/openedx/settings/partials/common_all.py#L16
Something I think is ok because pymongo uses it in camelcase.
https://pymongo.readthedocs.io/en/3.10.1/api/pymongo/mongo_client.html

However, the error was presented because edx-platform use another variable when credentials are provided **(LOWERCASE)**.
https://github.com/openedx/edx-platform/blob/master/xmodule/mongo_utils.py#L72

Looking more ,  the `auth_source `is configured with another key name:  `authsource` **(LOWERCASE)** from the kwargs.
https://github.com/openedx/edx-platform/blob/master/xmodule/mongo_utils.py#L34

This won't change the **kwargs behavior of the camelCase in pymongo `MongoClient` because pymongo has a caseInsentive method.
https://github.com/mongodb/mongo-python-driver/blob/3.12.3/pymongo/mongo_client.py#L651
 ``it's  OK to pass `authsource` instead of authSource as a keyword argument.``
2023-05-29 15:53:36 +02:00
Régis Behmo 35743eb905 Merge branch 'master' into nightly 2023-05-23 08:16:43 +02:00
Régis Behmo 185a13a2e1 v15.3.6 2023-05-22 18:17:34 +02:00
Régis Behmo 2233c3422a feat: upgrade to open-release/olive.4 2023-05-22 18:16:39 +02:00
Overhang.IO ca69eb31d3 Merge remote-tracking branch 'origin/master' into nightly 2023-05-03 16:46:39 +00:00
Kyle McCormick 2e276cbb09 docs: explain why docker-compose.jobs.yml exists
Based on:
https://github.com/overhangio/tutor/issues/642#issuecomment-1483970113
2023-05-03 17:51:13 +02:00
Overhang.IO a6ac7fe354 Merge remote-tracking branch 'origin/master' into nightly 2023-04-28 07:13:23 +00:00
Régis Behmo a302acc228 v15.3.5 2023-04-28 08:20:44 +02:00
Overhang.IO a1b1945908 Merge remote-tracking branch 'origin/master' into nightly 2023-04-26 09:39:05 +00:00
Régis Behmo 19016b8ab1 feat: add `do sqlshell` command
An optional `--db=openedx` argument can be passed to the job command.

This should close
https://github.com/openedx/wg-developer-experience/issues/51
2023-04-26 10:36:13 +02:00
Régis Behmo 6257c1c7ac feat: improve edx-platform logging by silencing a few warnings
These warnings were occurring when launching a django shell ("shell"
command) or a development server ("runserver").
2023-04-26 10:36:13 +02:00
Régis Behmo 586045143f feat: add a `do print-edx-platform-setting` command
The command is pretty straightforward, but quite convenient.
2023-04-26 10:36:13 +02:00
Régis Behmo b3c5c9685b feat: custom importable courses
This makes it possible to import courses not just from the demo repo.

Close #730
2023-04-26 10:36:13 +02:00
Overhang.IO 5326882908 Merge remote-tracking branch 'origin/master' into nightly 2023-04-13 14:04:13 +00:00
Régis Behmo a392a93bdd v15.3.4 2023-04-13 15:15:47 +02:00
Régis Behmo 0887691cc4
feat: upgrade to open-release/olive.3 2023-04-12 21:46:04 +02:00
Overhang.IO c3da9c5bef Merge remote-tracking branch 'origin/master' into nightly 2023-03-22 15:03:35 +00:00
Régis Behmo 679fe5f86b v15.3.3 2023-03-22 10:10:08 -04:00
Overhang.IO c9cdf293ef Merge remote-tracking branch 'origin/master' into nightly 2023-03-20 15:28:35 +00:00
Régis Behmo 3377ffc38a fix: v0 plugin patch ordering
v0 plugin patches were directly added to ENV_PATCH, while v1 patches
were added to ENV_PATCHES. ENV_PATCHES items are forwarded to ENV_PATCH
later at runtime, which means that yaml plugin patches were always
loaded before v1 patches.

This was causing weird ordering issues, as discussed here:
https://discuss.openedx.org/t/using-mfe-config-to-set-logo-trademark-url-for-the-footer-component-in-olive/9578
2023-03-20 16:15:12 +01:00
Overhang.IO 465d8075b5 Merge remote-tracking branch 'origin/master' into nightly 2023-03-20 14:13:55 +00:00
Régis Behmo fa9e86e188 improvement: COPY dockerize for faster build
Dockerize now ships with multi-arch Docker images, so we can just
COPY the binary from these images. This allows us to skip an image
layer.
2023-03-20 14:20:30 +01:00
Régis Behmo 28dce8c51a improvement: customisable `docker build` command
This paves the way for `docker buildx build` and better caching.

For instance, with this change you can try out the following plugin,
which should make image building much faster in CI:
https://gist.github.com/regisb/4049622ec4b48cbd48c89ec708dc5252
(not ready for production just yet, we still need to build and push the
images)
2023-03-20 14:20:30 +01:00
Régis Behmo ff5357cdc0 improvement: faster build with `npm ci` 2023-03-20 14:20:30 +01:00
Régis Behmo f42abe18ad feat: highlight enabled plugins with
In the output of `plugins list` it's difficult to see which plugins are
enabled at a glance. This change adds a more visible checkmark to the
output.

Ex:

	$ tutor plugins list
	NAME            STATUS          VERSION
	cairn            enabled      15.0.3
	discovery       installed       15.0.0
	ecommerce       installed       15.0.1
	forum           installed       14.0.0
	mfe              enabled      15.0.5
	minio           installed       15.1.0
2023-03-20 14:19:44 +01:00
Overhang.IO ea1ed85694 Merge remote-tracking branch 'origin/master' into nightly 2023-03-15 12:47:31 +00:00
Kyle McCormick f984361d9c
feat: full edx-platform setup with `tutor dev launch -m ...`
Before this commit, setting up an edx-platform development environment
took multiple steps:

   tutor dev launch
   tutor dev run --mount=/path/to/edx-platform lms bash
   >> pip install -e .
   >> npm clean-install
   >> openedx-assets build --env=dev

This commit moves the steps under ``run`` into an init task, which
is automatically run by ``launch``. Thus, setup is now one command:

   tutor dev launch --mount=edx-platform

These extra init steps are only applicable when bind-mounting
edx-platform (because bind-mounting the repository overrides
some important artifacts that exist on the image, which must be
re-generated). Thus, the new init tasks exists early if it detects
that it is *not* operating on a bind-mounted repository.

Finally, we try to simplify the Open edX development docs so that
it is clearer how bind-mounting fits into the development process.

These bind-mounts:

* ../build/openedx/themes:/openedx/themes
* ../build/openedx/requirements:/openedx/requirements

existed in the dev lms and cms containers, but they did
not exist in the lms-job and cms-job containers.

This means that themes and requirements that were *built into the
image* would exist in the job containers, but live updates to the
themes and requirements would not apply.

To resolve this, we set ``volumes:`` on the lms-job and cms-job
services so that they match the volumes for the normal lms and
cms services.

Part of: https://github.com/openedx/wg-developer-experience/issues/146
Closes: https://github.com/openedx/wg-developer-experience/issues/152

This works around (but does not close) these related issues:
* https://github.com/openedx/wg-developer-experience/issues/150
* https://github.com/openedx/wg-developer-experience/issues/151
2023-03-15 13:31:49 +01:00
Overhang.IO ddd6987852 Merge remote-tracking branch 'origin/master' into nightly 2023-03-15 11:09:18 +00:00
Moisés González aac0355183 feat: configure uwsgi through an ini file 2023-03-15 11:19:22 +01:00
Overhang.IO 540e53eb5f Merge remote-tracking branch 'origin/master' into nightly 2023-03-14 09:04:01 +00:00
Kyle McCormick 732e0c43be fix: use dev image for `tutor dev do`, not prod image
The lms-job and cms-job services were configured to use
{{ DOCKER_IMAGE_OPENEDX }} rather than {{ DOCKER_IMAGE_OPENEDX_DEV }}.

This means that when running jobs in dev mode, a la:

    tutor dev do init

a production image would be used, to the user's surprise.
2023-03-14 09:56:35 +01:00
Overhang.IO a96666329f Merge remote-tracking branch 'origin/master' into nightly 2023-03-13 18:29:05 +00:00
Régis Behmo 80b4820263 v15.3.2 2023-03-13 18:41:39 +01:00
Overhang.IO b4c58ed929 Merge remote-tracking branch 'origin/master' into nightly 2023-03-10 11:18:41 +00:00
Moisés González bfabdfc6c7 fix: add the missing `UWSGI_WORKERS` env variable to the k8s deployments 2023-03-10 11:19:50 +01:00
Overhang.IO 3ffecf5703 Merge remote-tracking branch 'origin/master' into nightly 2023-03-09 13:17:06 +00:00
Maria Fernanda Magallanes Zubillaga f13627a32a feat: add cli for listing available patches 2023-03-09 13:26:33 +01:00
Maria Grimaldi a373e24b2c fix: use supported YouTube API for transcripts imports cherry-pick 2023-03-07 18:38:24 +01:00
Overhang.IO 7076b7ca95 Merge remote-tracking branch 'origin/master' into nightly 2023-02-28 09:45:27 +00:00
Régis Behmo 9cd3d90e1c v15.3.1 2023-02-28 09:46:33 +01:00
Maria Fernanda Magallanes Zubillaga 40e5c8da6b refactor: move format_table function to utils 2023-02-28 09:45:11 +01:00
Overhang.IO c669565edf Merge remote-tracking branch 'origin/master' into nightly 2023-02-27 08:32:05 +00:00
Keith Grootboom bc7a23ddde
fix: patchStrategicMerge now works for kind:Job
When a job is invoked, we now replace the job in k8s/jobs.yml
instead of rewriting jobs.yml to only contain the relevant
job. This allows patchStrategicMerge to work for jobs.
2023-02-27 08:37:52 +01:00
Régis Behmo 5f7188a647 Merge branch 'master' into nightly 2023-02-10 13:45:59 +01:00
Régis Behmo c788bd499f v15.3.0 2023-02-10 11:33:17 +01:00
Régis Behmo 91385ba8d7 feat: upgrade to open-release/olive.2 2023-02-10 11:07:22 +01:00
Overhang.IO cbf4caf336 Merge remote-tracking branch 'origin/master' into nightly 2023-02-10 10:01:19 +00:00
Régis Behmo fa318a64ce feat: plugin indexes
We implement this TEP: https://discuss.openedx.org/t/tutor-enhancement-proposal-tep-plugin-indices/8182

With plugin indexes, tutor users can install and upgrade plugins directly from indexes:

    tutor plugins install ecommerce
    tutor plugins index add contrib
    tutor plugins install codejail
    tutor plugins upgrade all

This change has been long in the coming \o/
2023-02-10 10:06:38 +01:00
Overhang.IO d247c288b1 Merge remote-tracking branch 'origin/master' into nightly 2023-02-09 19:38:53 +00:00
Régis Behmo 2381be6921 fix: https is ignored with proxy is enabled
When ENABLE_WEB_PROXY=false, Caddy was overriding the X-Forwarded-*
headers. This is a change that was introduced in 2.5.0. We upgrade to
2.6.3 to use the new global "trusted_proxies" directive.

https://github.com/caddyserver/caddy/releases/tag/v2.6.3
https://github.com/caddyserver/caddy/releases/tag/v2.5.0
2023-02-09 20:30:31 +01:00
Régis Behmo d385c44404 Merge branch 'master' into nightly 2023-02-09 13:07:49 +01:00
Régis Behmo 7b718f6e78 chore: upgrade requirements
Cryptography in particular needs to be upgraded to 39.0.1:
https://github.com/overhangio/tutor/security/dependabot/7
https://github.com/overhangio/tutor/security/dependabot/8

Black upgrade caused minor spacing changes.
2023-02-09 12:07:09 +01:00
Régis Behmo 9df3b18c31 sec: fix LTI consumer xblock grading
See advisory:
https://github.com/openedx/xblock-lti-consumer/security/advisories/GHSA-7j9p-67mm-5g87
Discussion:
https://discuss.openedx.org/t/upcoming-security-release-xblock-lti-consumer/9165
Pull requests:
https://github.com/openedx/xblock-lti-consumer/pull/331
https://github.com/openedx/edx-platform/pull/31724
2023-02-09 11:55:18 +01:00
Régis Behmo 561460ec7f chore: upgrade to mypy 1.0.0
Now that mypy 1.0.0 is out, we can get add some elegant type aliases for
filter and action callback functions.
2023-02-09 11:55:06 +01:00
Overhang.IO 928859ca76 Merge remote-tracking branch 'origin/master' into nightly 2023-02-07 10:12:25 +00:00
Régis Behmo 4b14d20c5e feat: overridable lms/cms max upload size
Users want to be able to override the request `max_size` to upload
larger files. But they will not be able to if the patch is placed after
the `request` directive. So we move the patch statement before the
directive. Also, we wrap the `request_body` directives within `handle`
statements. If not, then different sizes are not managed properly.

To override the max upload size in the cms, add the following to the
"caddyfile-cms" patch:

    handle_path /import/* {
        request_body {
            max_size 500MB
        }
    }

See discussion:
https://discuss.openedx.org/t/how-to-update-caddyfile-using-tutor-plugin/8944
2023-02-07 10:19:54 +01:00
Overhang.IO 45addca89d Merge remote-tracking branch 'origin/master' into nightly 2023-01-31 14:53:30 +00:00
Régis Behmo 50734c20cc docs: fix incorrect catalog references 2023-01-31 15:46:15 +01:00
Overhang.IO 13d6fc2bf3 Merge remote-tracking branch 'origin/master' into nightly 2023-01-31 10:26:03 +00:00
Régis Behmo 6f06182877 fix: ModuleNotFoundError: No module named 'tutor.core'
Module was not importable after `pip install .`, notably in CI.
2023-01-31 10:33:48 +01:00
Régis Behmo 71ed7a8618 feat: refactor hooks API for simplification
The hooks API had several issues which are summarized in this comment:
https://github.com/openedx/wg-developer-experience/issues/125#issuecomment-1313553526

1. "consts" was a bad name
2. "hooks.filters" and "hooks.Filters" could easily be confused
3. docs made it difficult to understand that plugin developers should use the catalog

To address these issues, we:

1. move "consts.py" to "catalog.py"
2. Remove "hooks.actions", "hooks.filters", "hooks.contexts" from the API.
3. re-organize the docs and give better usage examples in the catalog.

This change is a partial fix for https://github.com/openedx/wg-developer-experience/issues/125
2023-01-31 10:17:58 +01:00
Overhang.IO cad1e03908 Merge remote-tracking branch 'origin/master' into nightly 2023-01-19 20:24:50 +00:00
Régis Behmo 4fe5fcf6db v15.2.0 2023-01-19 20:35:54 +01:00
Régis Behmo 0f67506985 Merge branch 'master' into nightly 2023-01-18 08:45:22 +01:00
Carlos Muniz ac1a875f42 refactor: annotation with __future__.annotations
Adds `from __future__ import annotations` to the top of every module,
right below the module's docstring. Replaces any usages of t.List,
t.Dict, t.Set, t.Tuple, and t.Type with their built-in equivalents:
list, dict, set, tuple, and type. Ensures that make test still passes
under Python 3.7, 3.8 and 3.9.
2023-01-18 08:36:14 +01:00
Régis Behmo d629ca932c fix: get rid of lms/cms `CORS_ORIGIN_WHITELIST` warnings
The LMS and CMS were producing lots of logs similar to:

	cms_1                        | 2023-01-17 15:30:11,359 INFO 7 [openedx.core.djangoapps.cors_csrf.helpers] [user 7] [ip 31.223.46.44] helpers.py:64 - Origin 'https://studio.demo.openedx.overhang.io' was not in `CORS_ORIGIN_WHITELIST`; full referer was 'https://studio.demo.openedx.overhang.io/learning/course/course-v1:edX+DemoX+Demo_Course/home' and requested host was 'studio.demo.openedx.overhang.io'; CORS_ORIGIN_ALLOW_ALL=False

These warnings are produced by openedx.core.djangoapps.cors_csrf.helpers. I
don't think they indicate any problem, but they pollute the logs. They are
resolved by adding the "http(s)://<lms/cms host>" to CORS_ORIGIN_WHITELIST in
production, so we did just that.
2023-01-18 07:55:13 +01:00
Régis Behmo ca04b245f3 fix: backport fix for html component editing in studio
See: https://discuss.openedx.org/t/text-component-does-not-remove-text-with-link-or-insert-a-link-to-text/9029
2023-01-18 07:51:24 +01:00
Régis Behmo 56a7614fd7 fix: 'example.com' links in registration emails
When a user registers, they receive a confirmation email. This email contained
two links to "https://example.com/..." urls. This was caused by the fact that
the default site, indicated by SITE_ID=1, was example.com. We resolve this
issue by setting instead SITE_ID=2, which should point to the site with the LMS
domain name.

This is a potentially breaking change for platforms that have manually set to 1
the id of the LMS site in the database. These platforms should now set
SITE_ID=1 via a plugin.

Alternatives we have considered include modifying the id field of the LMS site
in the database. Unfortunately such a change would have important consequences,
as the site ID is used as a foreign key for other models.

Note that non-https sites still include https links in the registration emails.
This is because the "https" scheme is hardcoded by the "ensure_url_is_absolute"
utility function. So there is nothing we can do about this without making
changes upstream.

Close #572.
2023-01-18 07:51:11 +01:00
Carlos Muniz 4da32ab84e refactor: annotation with __future__.annotations
Adds `from __future__ import annotations` to the top of every module,
right below the module's docstring. Replaces any usages of t.List,
t.Dict, t.Set, t.Tuple, and t.Type with their built-in equivalents:
list, dict, set, tuple, and type. Ensures that make test still passes
under Python 3.7, 3.8 and 3.9.
2023-01-18 07:37:55 +01:00
Overhang.IO e987db46c7 Merge remote-tracking branch 'origin/master' into nightly 2023-01-09 12:45:05 +00:00
Emad Rad b903c69fac
fix: respect RUN_MYSQL on k8s maple upgrade
During the maple -> nutmeg upgrade on k8s, only wait for mysql when RUN_MYSQL is true.
2023-01-09 13:01:48 +01:00
Overhang.IO d5f17dda9c Merge remote-tracking branch 'origin/master' into nightly 2023-01-03 16:56:51 +00:00
Régis Behmo 8b4719a13e fix: de-duplicate filter names
Some filter declaration were duplicated. We resolve this issue by properly
sorting all filter declarations by alphabetical order.
2023-01-03 17:12:55 +01:00
Abderraouf Mehdi Bouhali 5a3b762857 fix(patches): remove openedx backport from nightly
This removes an openedx/edx-platform commit backported as a patch to tutor to olive.1 release
Since the commit is already merged into edx-platform:master branch used
by tutor nightly,  there is no further need for it.
2022-12-28 12:10:43 +01:00
Abderraouf Mehdi Bouhali c0d7e262b0 fix(config): use master branch instead of olive.1 2022-12-28 12:10:43 +01:00
Régis Behmo be1e16984c fix: tutor nightly version suffix 2022-12-15 10:23:55 +01:00
Régis Behmo 380786219e v15.1.0
- [Improvement] Upgrade ipdb and ipython packages in the openedx development image. (by @regisb)
- [Improvement] Skip unnecessary image building in development. This should make `tutor dev launch` slightly faster. (by @regisb)
- [Bugfix] Fix Authn MFE login in development by disabling enterprise integration. (by @regisb)
- [Bugfix] Fix "Invalid value for ‘--from’" when running `tutor local upgrade --from=nutmeg`. If you are facing this error, just run `tutor local launch` and your platform should be automatically upgraded.
- [Bugfix] Fix "TypeError: Parameters to Generic[...] must all be type variables" error. This error may occur when upgrading from a very old installation of Tutor. It is due to an old version of the typing-extensions package.
- 💥[Deprecation] Get rid of the `quickstart` command. v15.0.0 introduced a deprecation warning, but we actually want users to stop using this command. Instead, use `launch` (by @regisb).
- [Improvement] Backfill persistent grades during upgrade from Nutmeg. If you observe missing grades after the upgrade from Nutmeg, run `tutor local upgrade --from=nutmeg`. (by @regisb)
2022-12-13 18:42:41 +01:00
Régis Behmo 23a9914721 fix: authn login in dev by disabling enterprise integration
In development, login via the authn mfe was broken because of explicit
enterprise integration:

    requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=18000): Max retries exceeded with url: /enterprise/api/v1/enterprise-learner/?username=regis (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd4c02b8a90>: Failed to establish a new connection: [Errno 111] Connection refused'))

See: https://discuss.overhang.io/t/tutor-login-fail-in-new-version/3083
2022-12-13 17:25:58 +01:00
Régis Behmo 146ec62a0a feat: skip explicit openedx-dev image building in `tutor dev launch`
I have no idea why we decided to kickstart a separate build. The image will be
built anyway at the next step because we run `docker compose up --build` in
`tutor dev start`.

The build step was introduced in this PR: https://github.com/overhangio/tutor/pull/627
2022-12-13 17:25:58 +01:00
Régis Behmo c70a6a5e80 feat: upgrade ipdb/ipython in openedx-dev image 2022-12-13 17:25:58 +01:00
Régis Behmo 9d9e9281d5 depr: get rid of `quickstart` command
We meant to get rid of `quickstart` in Olive, but somehow we forgot to delete
the command.
2022-12-13 17:25:43 +01:00
Régis Behmo 7a61f07dfd feat: backfill persistent grades during upgrade
In Olive, persistent grades are now mandatory. This was already the case in
Nutmeg, but it didn't mean that existing, non-persistent grades were migrated
to be persistent. This introduces a job that is run whenever a user upgrades
from Nutmeg. Alternatively, it can be run manually with:

    tutor local upgrade --from=nutmeg

See relevant documentation: https://openedx.atlassian.net/wiki/spaces/AC/pages/755171487/Migrating+to+Persistent+Grading#The-Persistent-Grades-Backfill
See discussion: https://app.slack.com/client/T02SNA1T6/C049JQZFR5E/thread/C02SNA1U4-1670937183.881709
2022-12-13 17:22:15 +01:00
Régis Behmo 609b39b802 fix: `tutor local upgrade --from=nutmeg`
There is nothing to do in the upgrade from nutmeg to olive, but it's not a
reason to crash this command.

Close #756.
2022-12-12 23:49:45 +01:00
Régis Behmo c26999ec65 feat: upgrade to olive 2022-12-12 16:55:07 +01:00
Régis Behmo 5ef246479b Merge branch 'nightly' into olive 2022-12-06 15:17:41 +01:00
Régis Behmo 3772bda438 v14.2.3 (2022-12-06)
- [Security] Fix rotation of JWT tokens for disabled users. (by @regisb)
2022-12-06 14:03:34 +01:00
Régis Behmo 143b656e83 sec: fix rotation of JWT tokens for disabled users 2022-12-01 12:16:37 +01:00
Overhang.IO bb849b86de Merge remote-tracking branch 'origin/master' into nightly 2022-11-29 11:24:41 +00:00
Régis Behmo c0d79463ff v14.2.2 (2022-11-29)
- [Bugfix] Fix `jinja2.exceptions.TemplateSyntaxError: expected token 'end of statement block', got '|'` error by bumping the minimum required version of the Jinja2 package.
- [Feature] Add support for MongoDB SSL, authentication source, mechanism and replica set via the `MONGODB_USE_SSL`, `MONGODB_AUTH_MECHANISM`, `MONGODB_AUTH_SOURCE`, `MONGODB_REPLICA_SET` settings. (by @zakum1 and @regisb)
- [Bugfix] Fix tag of "openedx" development Docker image. Previously, this Docker tag did not include the Tutor version. As a consequence, a different cached image could be used in some cases. For instance: when running `tutor dev run` commands. Now, the image tag is "openedx-dev:TUTOR_VERSION".
- [Bugfix] Fix name of Swahili locale: it is "sw-ke" and not "sw" (by @regisb).
- [Security] Apply drag-n-drop v2 xblock [security patch](https://discuss.openedx.org/t/upcoming-security-release-xblock-drag-and-drop-v2/8768/7). (by @regisb)
2022-11-29 11:27:35 +01:00
Régis Behmo e4e9cd8197 Merge branch 'master' into nightly 2022-11-29 10:28:11 +01:00
Régis Behmo 0e8f55798c sec: fix XSS vulnerability in drag-n-drop v2 xblock
Vulnerability is fixed by upgrading the xblock from v2.3.5 to v3.0.0.
See announcement:
https://discuss.openedx.org/t/upcoming-security-release-xblock-drag-and-drop-v2/8768
2022-11-29 09:05:38 +01:00
Régis Behmo ff0e8f7140 fix: pin openedx dev Docker image tag with tutor version
When running:

    tutor dev run -m /path/to/edx-platform lms
    pip install -r requirements/edx/development.txt

I realised that I was re-installing packages that should already have been
present in the image. The reason for that was that I was running an outdated
version of the dev version of the openedx Docker image. This happens because
`tutor dev run` does not trigger an image re-build.

We solve this issue by pinning the openedx dev Docker image tag to the current
tutor version.
2022-11-29 09:02:50 +01:00
Overhang.IO a0480f8d11 Merge remote-tracking branch 'origin/master' into nightly 2022-11-28 12:15:04 +00:00
james 7b72a5a910 feat: support for mongodb SSL+auth source/mech+replica set
This change builds upon a previously proposed PR:
https://github.com/overhangio/tutor/pull/437

There was another long conversation about this topic here:
https://github.com/overhangio/tutor-forum/pull/10#issuecomment-1314799915

We could have supported the MongoDB auth/replica set/ssl parameters as part of
the MongoDB host URI, but then this URI is not supported in the forum plugin,
which uses an old version of the mongoid client. We were hoping that the client
would have been upgraded by now, but it's not been upgraded for a long time.

The changes introduced here are 100% backward-compatible. The forum plugin will
have to be updated to take into account the new parameters.
2022-11-28 13:09:13 +01:00
Overhang.IO 74758fb1d8 Merge remote-tracking branch 'origin/master' into nightly 2022-11-28 11:29:23 +00:00
Régis Behmo b8ca06a42c fix: Swahili locale name
Note that this locale ships with edx-platform by default.
2022-11-28 12:23:02 +01:00
Régis Behmo 85d868423a fix: do not prepend DJANGO settings info to all jobs
The DJANGO_SETTINGS_MODULE is far from being relevant in all containers.
2022-11-24 18:40:16 +01:00
Régis Behmo 478d44c299 fix: type DO_* filters and actions 2022-11-24 18:40:16 +01:00
Régis Behmo c06ac5b020 Merge branch 'master' into nightly 2022-11-24 17:27:47 +01:00
Régis Behmo c9ac12fdd7 v14.2.1 (2022-11-24)
- [Improvement] Auto-completion of `plugins` and `config` arguments: `plugins enable/disable NAME`, `plugins install PATH`, `config save --set KEY=VAL`, `config save --unset KEY`, `config printvalue KEY`. (by @regisb)
- [Bugfix] Fix minimum click version (>= 8.0.0) when installing tutor from pip.
- [Improvement] Enable CORS by default for both LMS and CMS by moving those settings to the `common_all` partial. (by @arbrandes)
2022-11-24 16:25:34 +01:00
Régis Behmo 29eb3398a2 feat: auto-complete `config save/printroot` arguments 2022-11-24 16:21:57 +01:00
Régis Behmo ee09612326 feat: auto-complete `plugins` arguments
Support auto-completion of plugin name and path arguments in the `tutor
plugins` commands.
2022-11-24 16:21:57 +01:00
Overhang.IO 627b93b95b Merge remote-tracking branch 'origin/master' into nightly 2022-11-21 13:28:28 +00:00
Adolfo R. Brandes 3e32f88c15 feat: common CORS settings for LMS and CMS
The ENABLE_CORS_HEADERS feature flag is already true for the LMS.
Instead of duplicating it for Studio via yaml settings, make this a
common Django setting to both LMS and CMS and all their environments.
2022-11-21 13:51:56 +01:00
Overhang.IO 17028c5c63 Merge remote-tracking branch 'origin/master' into nightly 2022-11-21 10:18:43 +00:00
Régis Behmo 5006f6edc9 v14.2.0 (2022-11-21)
- [Improvement] Auto-complete implicit `local/dev --mount /path/to/...` options. (by @regisb)
- 💥[Feature] Strong typing of action and filter hooks: this allows us to detect incorrect calls to `actions.add` or `filters.add` early. Strong typing forces us to break the `do` and `apply` API by removing the `context` named argument. Developers should replace `do(context=...)` by `do_from_context(..., )` (and similar for `apply`).
2022-11-21 10:10:44 +01:00
Régis Behmo b4a8069cfd fix: init template paths
Plugin template paths of init jobs could not be found because they were
searched for in the Tutor template root only.
2022-11-21 10:03:25 +01:00
Overhang.IO 1890557d40 Merge remote-tracking branch 'origin/master' into nightly 2022-11-17 14:44:20 +00:00
Régis Behmo f8b5cbc657 feat: auto-complete `--mount` args
When typing `tutor local run --mount /path/to/edx-pl<TAB>`, the mount option
should be auto-completed to the full edx-platform repo path. That is, if shell
completion is enabled:
https://docs.tutor.overhang.io/install.html#shell-autocompletion

Here, we make sure that the implicit form of the `--mount` argument is properly
auto-completed. We are unable to get completion to work in the explicit form,
because args that include colons do not even reach the `shell_completion`
method.
2022-11-17 14:50:52 +01:00
Régis Behmo d7c667835a Merge branch 'master' into nightly 2022-11-15 16:59:19 +01:00
Régis Behmo 33e4f33afe feat: strongly typed hooks
Now that the mypy bugs have been resolved, we are able to define more precisely
and cleanly the types of Actions and Filters.

Moreover, can now strongly type named actions and hooks (in consts.py). With
such a strong typing, we get early alerts of hooks called with incorrect
arguments, which is nothing short of awesome :)

This change breaks the hooks API by removing the `context=...` argument. The
reason for that is that we cannot insert arbitrary arguments between `P.args,
P.kwargs`: https://peps.python.org/pep-0612/#the-components-of-a-paramspec

> A function declared as def inner(a: A, b: B, *args: P.args, **kwargs:
> P.kwargs) -> R has type Callable[Concatenate[A, B, P], R]. Placing
> keyword-only parameters between the *args and **kwargs is forbidden.

Getting the documentation to build in nitpicky mode is quite difficult... We
need to add `nitpick_ignore` to the docs conf.py, otherwise sphinx complains
about many missing class references. This, despite upgrading almost all doc
requirements (except docutils).
2022-11-15 14:58:36 +01:00
Régis Behmo 0453b0c002 feat: add `-h` help option to all commands 2022-11-15 09:46:08 +01:00
Régis Behmo 16e6131f96 feat: pluggable `local/dev/k8s do <job>` commands
We introduce a new filter to implement custom commands in arbitrary containers.
It becomes easy to write convenient ad-hoc commands that users will
then be able to run either on Kubernetes or locally using a documented CLI.

Pluggable jobs are declared as Click commands and are responsible for
parsing their own arguments. See the new CLI_DO_COMMANDS filter.

Close https://github.com/overhangio/2u-tutor-adoption/issues/75
2022-11-15 09:46:08 +01:00
Régis Behmo b6dc65cc64 refactor: deduplicate jobs code
createuser, importdemocourse and settheme were 100% duplicated code between
k8s.py and compose.py.
2022-11-15 09:46:08 +01:00
Régis Behmo e734f52f07 feat: filter priorities
Nothing revolutionary here, we just implement the same priority queue that
existed in actions. It will be necessary to trigger init tasks in the right
order.
2022-11-15 09:46:08 +01:00
Overhang.IO 7879506910 Merge remote-tracking branch 'origin/master' into nightly 2022-11-14 12:19:34 +00:00
Régis Behmo 8aeeb7e09c chore: replaced unnamed hook filters by named equivalents 2022-11-14 12:25:28 +01:00
Régis Behmo 19f3f329f2 Merge branch 'master' into nightly 2022-11-03 09:52:43 +01:00
Régis Behmo fd2d3dea10 v14.1.2 (2022-11-02)
- [Security] Fix edx-platform XSS vulnerability on "next" parameter. (by
  @regisb)
2022-11-02 10:42:55 +01:00
Régis Behmo b46a7b0fa8 sec: fix edx-platform xss vulnerability on "next" parameter 2022-11-02 10:42:10 +01:00
Régis Behmo f95c394e38 fix: print proper command on check_output
Note that the `check_output` command is mostly unused.
2022-10-26 16:46:04 +02:00
Régis Behmo 5419be7d31 Merge branch 'master' into nightly 2022-10-26 13:29:30 +02:00
Régis Behmo 7541433729 v14.1.1 (2022-10-25)
- [Security] Fix xblock ajax handler vulnerability. (by @regisb)
- [Improvement] Use web proxy gzip encoding to improve bandwidth. We
  observe a 75% size reduction on the LMS dashboard. (by @ghassanmas)
2022-10-26 12:28:16 +02:00
Régis Behmo 1161f925a4 feat: add py.typed for typing extensions
Extensions which use the tutor API need to know that the tutor package
is typed. For that we add the py.typed file.

Also, we fix the signature of get_typed.

See:
https://mypy.readthedocs.io/en/stable/installed_packages.html#installed-packages
2022-10-26 12:28:16 +02:00
Régis Behmo 3ba5365537 sec: fix xblock ajax handler vulnerability 2022-10-25 18:56:40 +02:00
Régis Behmo e56918bf47 depr: get rid of the `local/dev bindmount` commands
This command has always been clunky. It is now removed in favour of the
`-m/--mount` option.

Close https://github.com/overhangio/2u-tutor-adoption/issues/88
Close https://github.com/overhangio/2u-tutor-adoption/issues/89
2022-10-19 17:51:06 +02:00
Overhang.IO 34fd1dcb70 Merge remote-tracking branch 'origin/master' into nightly 2022-10-19 09:42:52 +00:00
Ghassan Maslamani 7d32179038 feat: use encode gzip for caddy
Compressing assests would lead to readuce transfer size.
  As testing with frontend-app-learning/Olive, the network traffic
  before was about ~4MB, after this it became ~1MB.

  This change was suggested by Google Lighthouse[1], there are of
  course more suggestion but this was one the easiest and one of most
  impactful.

  Also check orignal PR overhangio/tutor-mfe/pull/64 for more
  info.
  [1]: https://web.dev/uses-text-compression
2022-10-19 10:46:01 +02:00
Overhang.IO 9c492056d9 Merge remote-tracking branch 'origin/master' into nightly 2022-10-10 09:16:50 +00:00