Compare commits

...

103 Commits

Author SHA1 Message Date
Florian du Garage Num
fa053ac7ae remove hard-coded uid 1000
Some checks failed
Run tests / tests (3.9) (push) Has been cancelled
Sync with private repo / sync (push) Has been cancelled
Run tests / tests (3.12) (push) Has been cancelled
2025-09-30 21:46:06 +02:00
Muhammad Labeeb
18d1825de7
feat: migrate from pylint/black to ruff (#104)
* feat: migrate from pylint/black to ruff

* test: verify python package distribution build when running make test
2025-08-28 18:59:56 +05:00
Ahmed Khalid
c6a0d16a76
Merge pull request #102 from overhangio/teak 2025-06-27 15:57:02 +05:00
Muhammad Labeeb
944b432ca4 v20.0.0 2025-06-05 18:10:15 +05:00
Danyal Faheem
7a31ce81fd
chore: replace site-configuration script with management command (#101)
* chore: replace site-configuration script with management command
The site-configuration script was used to set the value of the COURSE_CATALOG_API_URL
However, this script is being removed in tutor core as it is no longer required
For this reason, we migrate to the provided create_or_update_site_configuration management command in edx-platform
2025-04-22 15:23:18 +05:00
Syed Muhammad Dawoud Sheraz Ali
b189574e03
build: Add hatch_build in sdist to fix installation issues (#100) 2025-03-12 16:14:02 +05:00
Muhammad Faraz Maqsood
5c4daa9318
feat: migrate from setup.py/setuptools to pyproject.toml/hatch (#99)
* feat: migrate to pyproject.toml and hatch

* migrate from setup.py/setuptools to pyproject.toml/hatch.

* add optional dependencies

* fix license and author

* update maintainer name

---------

Co-authored-by: Muhammad Faraz  Maqsood <faraz.maqsood@192.168.10.35>
Co-authored-by: Muhammad Labeeb <mlabeeb03@gmail.com>
2025-03-02 14:14:48 +05:00
Muhammad Labeeb
4386c85adf docs: readme update
- Explicitly state that in order to use SSO with existing LMS admin users, the newly created superuser in discovery must have the same username and email as the LMS user.
2025-01-22 14:44:52 +05:00
Muhammad Faraz Maqsood
d34cc5dc75 docs: add changelog entry 2025-01-22 13:05:26 +05:00
Muhammad Faraz Maqsood
796c0497ec feat: add env variable to enable/disable programs
This commit includes:
- This aligns with the frontend, which now also utilizes this environment variable. To view the frontend related changes, click here: https://github.com/openedx/frontend-app-learner-dashboard/pull/506/files.
- Additionally, it automates the enabling of programs in the "programapiconfig" model on the LMS admin panel through init tasks.
- Update the documentation accordingly.
2025-01-22 13:05:26 +05:00
Syed Muhammad Dawoud Sheraz Ali
6ca50caa5a
build: re-add auto-add for PRs with a different target (#96) 2025-01-21 16:45:48 +05:00
Muhammad Faraz Maqsood
89b63c1d47 doc: add link to instructions to use event-bus 2025-01-09 13:09:40 +05:00
Muhammad Faraz Maqsood
20e381ed25 doc: add changelog entry 2025-01-09 13:09:40 +05:00
Muhammad Faraz Maqsood
604e7f3485 feat: add support to run event-bus in discovery
- add support to consume events from event bus in discovery. Explanation can be viewed here: https://github.com/openedx/event-bus-redis/blob/main/docs/tutor_installation.rst
- close #94
2025-01-09 13:09:40 +05:00
Régis Behmo
d343d1fbd3
feat: upgrade to sumac 2024-12-16 20:38:52 +01:00
Syed Muhammad Dawoud Sheraz Ali
214ae64628 chore: update changelog 2024-12-09 19:09:11 +05:00
Muhammad Faraz Maqsood
b05698b9a3 chore: add is_docker_rootless() in tutor-discovery
- move is_docker_rootless method from tutor to tutor-discovery
- move is_docker_rootless related tests from tutor to tutor-discovery and modify makefile according to it.
2024-11-29 22:31:39 +05:00
Muhammad Faraz Maqsood
403a5e297d feat: add Elasticsearch support in tutor-discovery (#89)
- As Tutor and Open edX have shifted to Meilisearch, and course-discovery still depends on Elasticsearch, running the Elasticsearch container with tutor-discovery will facilitate smoother operation for the course-discovery service.
- It's related PR from tutor: overhangio/tutor#1141.

Co-authored-by: Muhammad Faraz  Maqsood <faraz.maqsood@192.168.10.123>
2024-11-29 22:31:39 +05:00
Muhammad Faraz Maqsood
b89af42406 v19.0.0
upgrade to sumac
2024-11-29 22:31:39 +05:00
Régis Behmo
468662c75c Merge branch 'release' 2024-11-27 18:35:01 +01:00
Syed Muhammad Dawoud Sheraz Ali
1d57879cc8 feat!: Rename branches master->release, nightly->main 2024-11-27 22:33:41 +05:00
Overhang.IO
1807cd8abd Merge remote-tracking branch 'origin/master' into nightly 2024-11-14 16:21:13 +00:00
Muhammad Faraz Maqsood
9090614180
chore: remove Python 3.8 references (#91)
- drop support for python 3.8 and set Python 3.9 as the minimum supported python version.

Co-authored-by: Muhammad Faraz  Maqsood <faraz.maqsood@192.168.10.36>
2024-11-14 21:09:52 +05:00
Hina Khadim
1cc9c3f40c
feat: ubuntu upgrade in dockerfile (#84)
* feat: ubuntu upgrade  in  dockerfile

* fix: set app id to 1000

* fix: remove uwsgi

* fix: remove empty lines

* fix: update  changelog
2024-10-23 16:43:16 +05:00
Régis Behmo
7618ec9f03 docs: *.local.edly.io -> *.local.openedx.io
The default URL to run a local platform switched from local.edly.io to
local.openedx.io. This changes makes it clearer for everyone that Tutor
is to run Open edX.

See: https://github.com/overhangio/tutor/issues/1120
2024-10-17 08:36:40 +02:00
Régis Behmo
deaed2ff07 ci: upgrade vendor actions 2024-10-03 11:16:24 +02:00
Régis Behmo
eae4dd4332 docs: fix author domain name 2024-10-01 09:08:48 +02:00
Emad Rad
07cd392515 reformat: RST syntax
This will clean up the README file to follow the RST format, fixed some typos and improved readability.
2024-07-25 17:51:15 +05:00
Eugene Dyudyunov
06d63b7938 docs: update changelog 2024-07-23 14:34:44 +05:00
Eugene Dyudyunov
d56924e455 fix: pathway API permissions
Grant staff permissions to the catalog_service_user to
fix 403 error during the pathways fetching.

Note: this issue is also described in the readme.

Related discussions:
- https://discuss.openedx.org/t/tutor-discovery-service-api-v1-pathways-403/7995
- https://discuss.openedx.org/t/tutor-discovery-program-issue/10283
2024-07-23 14:34:44 +05:00
Muhammad Faraz Maqsood
85b876cdc7 doc: add an instruction for cache programs for tutor dev mode 2024-07-04 12:55:01 +05:00
Muhammad Faraz Maqsood
a40d767426 refactor: address comments 2024-07-01 19:41:37 +05:00
Muhammad Faraz Maqsood
e7cee6769b doc: add changelog entry 2024-07-01 19:41:37 +05:00
Muhammad Faraz Maqsood
c5e56dfa2c fix: permission denied error for media directory
"""
discovery-1  | PermissionError: [Errno 13] Permission denied: '/openedx/discovery/course_discovery/media/media'
discovery-1  | 2024-06-25 13:35:29,038 ERROR 7 [django.request] /openedx/venv/lib/python3.8/site-packages/django/utils/log.py:241 - Internal Server Error: /admin/course_metadata/program/9/change/
discovery-1  | Traceback (most recent call last):
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 55, in inner
discovery-1  |     response = get_response(request)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 197, in _get_response
discovery-1  |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 688, in wrapper
discovery-1  |     return self.admin_site.admin_view(view)(*args, **kwargs)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
discovery-1  |     response = view_func(request, *args, **kwargs)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/views/decorators/cache.py", line 62, in _wrapper_view_func
discovery-1  |     response = view_func(request, *args, **kwargs)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 242, in inner
discovery-1  |     return view(request, *args, **kwargs)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django_object_actions/utils.py", line 57, in change_view
discovery-1  |     return super(BaseDjangoObjectActions, self).change_view(
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1889, in change_view
discovery-1  |     return self.changeform_view(request, object_id, form_url, extra_context)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 46, in _wrapper
discovery-1  |     return bound_method(*args, **kwargs)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 134, in _wrapper_view
discovery-1  |     response = view_func(request, *args, **kwargs)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1747, in changeform_view
discovery-1  |     return self._changeform_view(request, object_id, form_url, extra_context)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1798, in _changeform_view
discovery-1  |     self.save_model(request, new_object, form, not add)
discovery-1  |   File "/openedx/discovery/./course_discovery/apps/course_metadata/admin.py", line 462, in save_model
discovery-1  |     super().save_model(request, obj, form, change)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/simple_history/admin.py", line 228, in save_model
discovery-1  |     super().save_model(request, obj, form, change)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1227, in save_model
discovery-1  |     obj.save()
discovery-1  |   File "/openedx/discovery/./course_discovery/apps/course_metadata/models.py", line 3613, in save
discovery-1  |     super().save(*args, **kwargs)
discovery-1  |   File "/openedx/discovery/./course_discovery/apps/course_metadata/models.py", line 102, in save
discovery-1  |     super().save(*args, **kwargs)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django_extensions/db/models.py", line 22, in save
discovery-1  |     super().save(**kwargs)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/base.py", line 814, in save
discovery-1  |     self.save_base(
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/model_utils/tracker.py", line 375, in inner
discovery-1  |     return original(instance, *args, **kwargs)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/base.py", line 877, in save_base
discovery-1  |     updated = self._save_table(
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/base.py", line 981, in _save_table
discovery-1  |     values = [
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/base.py", line 985, in <listcomp>
discovery-1  |     (getattr(self, f.attname) if raw else f.pre_save(self, False)),
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/fields/files.py", line 317, in pre_save
discovery-1  |     file.save(file.name, file.file, save=False)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/stdimage/models.py", line 32, in save
discovery-1  |     super().save(name, content, save)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/db/models/fields/files.py", line 93, in save
discovery-1  |     self.name = self.storage.save(name, content, max_length=self.field.max_length)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/core/files/storage/base.py", line 38, in save
discovery-1  |     name = self._save(name, content)
discovery-1  |   File "/openedx/venv/lib/python3.8/site-packages/django/core/files/storage/filesystem.py", line 87, in _save
discovery-1  |     os.makedirs(directory, exist_ok=True)
discovery-1  |   File "/usr/lib/python3.8/os.py", line 213, in makedirs
discovery-1  |     makedirs(head, exist_ok=exist_ok)
discovery-1  |   File "/usr/lib/python3.8/os.py", line 213, in makedirs
discovery-1  |     makedirs(head, exist_ok=exist_ok)
discovery-1  |   File "/usr/lib/python3.8/os.py", line 223, in makedirs
discovery-1  |     mkdir(name, mode)
discovery-1  | PermissionError: [Errno 13] Permission denied: '/openedx/discovery/course_discovery/media/media'
"""
2024-07-01 19:41:37 +05:00
Muhammad Faraz Maqsood
d8b0e6a327 fix: images does not persist
On stopping discovery container and deleting it
And starting it again, images gives 404
2024-07-01 19:41:37 +05:00
Régis Behmo
14684ef2ca fix: docker build deprecation warnings
With the latest Docker upgrade, we got the following warnings during
build:

	FromAsCasing: 'as' and 'FROM' keywords' casing do not match
	LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format
2024-06-21 17:12:57 +02:00
Régis Behmo
790513e486
Merge pull request #74 from overhangio/redwood
Upgrade to Redwood
2024-06-20 01:52:43 +02:00
Muhammad Faraz Maqsood
48c13d7105 v18.0.0 2024-06-20 01:51:37 +02:00
Muhammad Faraz Maqsood
e63be4fcc3 fix: wrong mime type by adding mime-support
The admin's stylesheets e.g.https://{{DISCOVERY_HOST}}/static/admin/css/base.css, were not loaded because its MIME type appears to be "text/plain", It should be "text/css".
2024-06-07 22:19:39 +05:00
Muhammad Faraz Maqsood
f4ccdf0f95 feat: upgrade to redwood 2024-06-07 22:19:39 +05:00
Overhang.IO
c692e75d17 Merge remote-tracking branch 'origin/master' into nightly 2024-06-04 07:37:10 +00:00
Muhammad Faraz Maqsood
c939b8a654 fix: readme correction 2024-06-04 12:30:44 +05:00
Muhammad Faraz Maqsood
34691b58e2 docs: add a comment explaining the need of root user
=> [minimal  7/19] RUN echo "{}" > /openedx/config.yml                                                                          0.2s
 => ERROR [minimal  8/19] RUN git clone https://github.com/pyenv/pyenv /opt/pyenv --branch v2.3.36 --depth 1                     0.4s
------
 > importing cache manifest from docker.io/overhangio/openedx-discovery:17.0.0-nightly-cache:
------
------
 > [minimal  8/19] RUN git clone https://github.com/pyenv/pyenv /opt/pyenv --branch v2.3.36 --depth 1:
0.341 fatal: could not create work tree dir '/opt/pyenv': Permission denied
------
Dockerfile:36
--------------------
  34 |     ENV PYENV_ROOT /opt/pyenv
  35 |     # USER root
  36 | >>> RUN git clone https://github.com/pyenv/pyenv $PYENV_ROOT --branch v2.3.36 --depth 1
  37 |     # Install Python
  38 |     RUN $PYENV_ROOT/bin/pyenv install $PYTHON_VERSION
--------------------
ERROR: failed to solve: process "/bin/sh -c git clone https://github.com/pyenv/pyenv $PYENV_ROOT --branch v2.3.36 --depth 1" did not complete successfully: exit code: 128
2024-05-02 15:34:21 +05:00
Muhammad Faraz Maqsood
d27b7523e1 fix: fix compile messages error
ModuleNotFoundError: No module named '_sqlite3'
fixed above error on line
>>> RUN python manage.py compilemessages
2024-05-02 15:34:21 +05:00
Muhammad Faraz Maqsood
2f9effded9 add changelog entry 2024-05-02 15:34:21 +05:00
Muhammad Faraz Maqsood
213e4dbc0d enhancement: upgrade python version to 3
.12.2
2024-05-02 15:34:21 +05:00
Muhammad Faraz Maqsood
96d6ba9ca2 v17.0.1 2024-04-25 11:58:24 +05:00
Andrés González
ecff88eb40 fix: Create media directory in Dockerfile.
If the media directory does not exist at the time that
uwsgi is launched, the mapping to /media to serve
media files will not be created.
2024-04-25 11:47:02 +05:00
Danyal-Faheem
4b1ccd4ea5 docs: fix site-configuration url 2024-04-25 11:43:03 +05:00
Muhammad Faraz Maqsood
1b1d90239d remove extra changelog entry 2024-03-21 15:48:19 +05:00
Danyal-Faheem
b309e364fb fix: add changelog entry 2024-03-19 17:56:21 +05:00
Danyal-Faheem
471bae22e8 ci: add python 3.12 checks
resolved merge conflicts
rebased this branch to overhangio master branch from edly-io master branch
2024-03-19 17:56:21 +05:00
Muhammad Faraz Maqsood
0034aaddb3 fix: fix volumes empty list error during tutor dev launch 2024-03-13 13:06:11 +05:00
Muhammad Faraz Maqsood
90abd11ca6 Revert "fix: fix empty volumes list"
This reverts commit 69c8ba5e9c49a7f085b6542612b4f2fc27432208.
2024-03-13 13:00:34 +05:00
Muhammad Faraz Maqsood
69c8ba5e9c fix: fix empty volumes list
this error occurs during dev launch
2024-03-13 12:59:18 +05:00
Régis Behmo
a4fa65cf29 ci: fix auto-add-to-project typo 2024-03-12 11:42:36 +05:00
Max Sokolski
3ebf44e3d6 docs: add changelog entry 2024-03-11 16:50:39 +05:00
Max Sokolski
b3bc099364 feat: add mounts for docker-compose-dev-services 2024-03-11 16:50:39 +05:00
Régis Behmo
9b1fdd9773 ci: don't even try to auto-add PRs to github project
Auto-adding PRs to the Github project is not working because the
github-token is not available there.
2024-03-05 12:03:03 +05:00
Régis Behmo
98e226c501 ci: remove now useless OPENEDX_RELEASE variable 2024-02-20 15:15:40 +01:00
Régis Behmo
b8f6ad8c9c fix: remove pkg_resources for compatibility with python 3.12
pkg_resources is a package that is unavailable in python 3.12, unless
setuptools is explicitely installed. Turns out, there are replacement
functions coming from importlib_resources, which can be obtained from
the importlib-resources pypi package. This package will be installed
with tutor starting from 17.0.2.
2024-02-12 11:57:51 +01:00
Régis Behmo
d451ab6425 ci: auto-add issues and items to github project 2024-01-12 12:33:35 +01:00
Muhammad Faraz Maqsood
74273e027f doc: add instructions related to programs
close overhangio#42 as this is not an issue, updating readme in case of confusion.
2024-01-09 10:56:59 +05:00
Zia Fazal
52af6adb57 feat: upgrade to quince 2023-12-11 18:12:10 +01:00
Overhang.IO
073fe08a04 Merge remote-tracking branch 'origin/master' into nightly 2023-12-09 18:15:12 +00:00
Régis Behmo
7dc8b266b6 local.overhang.io -> local.edly.io
This is related to https://github.com/overhangio/tutor/issues/945
2023-12-09 15:54:28 +01:00
Overhang.IO
7e65b8b51a Merge remote-tracking branch 'origin/master' into nightly 2023-12-08 18:46:42 +00:00
Omar Al-Ithawi
e766c92c86 chore: use course-discovery openedx-atlas requirement
course-discovery now maintains its own base.in requirement for atlas
the tutor-discovery no longer needs to install it.
2023-12-08 11:00:30 +01:00
Overhang.IO
236b8c77e9 Merge remote-tracking branch 'origin/master' into nightly 2023-12-05 11:17:42 +00:00
Overhang.IO
829025ff26 Merge remote-tracking branch 'origin/master' into nightly 2023-11-24 03:49:54 +00:00
Overhang.IO
0adea6785e Merge remote-tracking branch 'origin/master' into nightly 2023-11-21 10:40:21 +00:00
Régis Behmo
902c223370 Merge branch 'master' into nightly 2023-11-20 17:46:41 +01:00
Overhang.IO
11f807de13 Merge remote-tracking branch 'origin/master' into nightly 2023-11-14 12:02:30 +00:00
Overhang.IO
05f0bfe9d5 Merge remote-tracking branch 'origin/master' into nightly 2023-11-08 09:03:50 +00:00
Overhang.IO
16e90e10c4 Merge remote-tracking branch 'origin/master' into nightly 2023-11-08 07:02:12 +00:00
Omar Al-Ithawi
b9dd940903 feat: add minimal atlas step to the build
This contribution is part of the [FC-0012 project](https://openedx.atlassian.net/l/cp/XGS0iCcQ) which is sparked by the [Translation Infrastructure update OEP-58](https://open-edx-proposals.readthedocs.io/en/latest/architectural-decisions/oep-0058-arch-translations-management.html#specification).
2023-10-16 18:27:29 +02:00
Overhang.IO
1667af12cb Merge remote-tracking branch 'origin/master' into nightly 2023-10-03 06:50:50 +00:00
Régis Behmo
21b82de63f fix: missing pkg-config in image build
Build was failing with the following error during the installation of
mysqlclient==2.2.0:

	#39 22.19 Collecting mysqlclient==2.2.0 (from -r requirements/production.txt (line 435))
	#39 22.20   Downloading mysqlclient-2.2.0.tar.gz (89 kB)
	#39 22.20      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.5/89.5 kB 95.8 MB/s eta 0:00:00
	#39 22.24   Installing build dependencies: started
	#39 24.79   Installing build dependencies: finished with status 'done'
	#39 24.81   Getting requirements to build wheel: started
	#39 25.07   Getting requirements to build wheel: finished with status 'error'
	#39 25.08   error: subprocess-exited-with-error
	#39 25.08
	#39 25.08   × Getting requirements to build wheel did not run successfully.
	#39 25.08   │ exit code: 1
	#39 25.08   ╰─> [24 lines of output]
	#39 25.08       /bin/sh: 1: pkg-config: not found
	#39 25.08       /bin/sh: 1: pkg-config: not found
	#39 25.08       Trying pkg-config --exists mysqlclient
	#39 25.08       Command 'pkg-config --exists mysqlclient' returned non-zero exit status 127.
	#39 25.08       Trying pkg-config --exists mariadb
	#39 25.08       Command 'pkg-config --exists mariadb' returned non-zero exit status 127.
	#39 25.08       Traceback (most recent call last):
	#39 25.08         File "/openedx/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
	#39 25.08           main()
	#39 25.08         File "/openedx/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
	#39 25.08           json_out['return_val'] = hook(**hook_input['kwargs'])
	#39 25.08         File "/openedx/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
	#39 25.08           return hook(config_settings)
	#39 25.08         File "/tmp/pip-build-env-5hyrozx4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
	#39 25.08           return self._get_build_requires(config_settings, requirements=['wheel'])
	#39 25.08         File "/tmp/pip-build-env-5hyrozx4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
	#39 25.08           self.run_setup()
	#39 25.08         File "/tmp/pip-build-env-5hyrozx4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in run_setup
	#39 25.08           exec(code, locals())
	#39 25.08         File "<string>", line 154, in <module>
	#39 25.08         File "<string>", line 48, in get_config_posix
	#39 25.08         File "<string>", line 27, in find_package_name
	#39 25.08       Exception: Can not find valid pkg-config name.
	#39 25.08       Specify MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS env vars manually
	#39 25.08       [end of output]
2023-09-08 09:53:08 +02:00
Overhang.IO
bddd793bfd Merge remote-tracking branch 'origin/master' into nightly 2023-09-07 16:59:00 +00:00
Régis Behmo
06536ceb4d Merge branch 'master' into nightly 2023-06-15 01:01:23 +02:00
Régis Behmo
f09d6140ec fix: nightly package version
The package version number may not include the "-nightly" suffix.
Otherwise, installation fails with:

   setuptools.extern.packaging.version.InvalidVersion: Invalid version: '15.0.7-nightly'
2023-05-26 18:47:48 +02:00
Régis Behmo
e8cf712a0b feat: label nightly version
This is to address https://github.com/overhangio/tutor-mfe/issues/122
As a consequence of this change, images will be tagged with a "-nightly"
suffix. Next, we'll probably have to build them periodically in CI.
2023-05-26 18:26:28 +02:00
Overhang.IO
3c3bfc7ce6 Merge remote-tracking branch 'origin/master' into nightly 2023-05-26 15:09:07 +00:00
Overhang.IO
4f96218a16 Merge remote-tracking branch 'origin/master' into nightly 2023-05-22 08:00:39 +00:00
Overhang.IO
3d826a8be5 Merge remote-tracking branch 'origin/master' into nightly 2023-05-19 14:49:10 +00:00
Overhang.IO
f1b6b8b407 Merge remote-tracking branch 'origin/master' into nightly 2023-05-17 08:55:48 +00:00
Overhang.IO
1bd27b2a05 Merge remote-tracking branch 'origin/master' into nightly 2023-05-16 08:37:46 +00:00
Overhang.IO
9b91f852f2 Merge remote-tracking branch 'origin/master' into nightly 2023-05-03 15:59:56 +00:00
Overhang.IO
905e746c07 Merge remote-tracking branch 'origin/master' into nightly 2023-02-27 11:09:13 +00:00
Overhang.IO
64e23d4ccd Merge remote-tracking branch 'origin/master' into nightly 2022-12-31 17:11:09 +00:00
Régis Behmo
dd71d26bd3 Merge branch 'master' into nightly 2022-12-12 19:28:52 +01:00
Overhang.IO
bf23584cb8 Merge remote-tracking branch 'origin/master' into nightly 2022-12-12 18:08:07 +00:00
Régis Behmo
aa9053c49f feat: upgrade to olive 2022-12-12 18:56:13 +01:00
Overhang.IO
9242fadbaa Merge remote-tracking branch 'origin/master' into nightly 2022-11-21 17:22:40 +00:00
Overhang.IO
0bcaa5adae Merge remote-tracking branch 'origin/master' into nightly 2022-11-21 17:12:03 +00:00
Régis Behmo
36d0e80625 v14.0.2 2022-11-21 18:08:55 +01:00
Overhang.IO
51f713ccf4 Merge remote-tracking branch 'origin/master' into nightly 2022-11-21 16:05:10 +00:00
Régis Behmo
6a1840388f v14.0.2 2022-11-21 17:01:52 +01:00
Overhang.IO
cda167ca9b Merge remote-tracking branch 'origin/master' into nightly 2022-11-21 15:58:58 +00:00
Régis Behmo
8cdb63b4f7 v14.0.2wq 2022-11-21 16:55:38 +01:00
Overhang.IO
0a04dff196 Merge remote-tracking branch 'origin/master' into nightly 2022-11-10 15:12:59 +00:00
Régis Behmo
6bbb79e11f ci: fix nutmeg target 2022-11-10 16:03:25 +01:00
Carlos Muniz
d2d72b2d9f docs: change quickstart to launch
This change is due to renaming quickstart to launch in tutor.
2022-10-03 14:03:05 +02:00
30 changed files with 640 additions and 166 deletions

View File

@ -0,0 +1,20 @@
name: Auto Add Issues and Pull Requests to Project
on:
issues:
types:
- opened
pull_request_target:
types:
- opened
jobs:
# https://github.com/actions/add-to-project
add-to-project:
name: Add issue and bugs to project
runs-on: ubuntu-latest
steps:
- uses: actions/add-to-project@v1.0.2
with:
project-url: https://github.com/orgs/overhangio/projects/4
github-token: ${{ secrets.GH_PROJECT_PERSONAL_ACCESS_TOKEN }}

View File

@ -2,13 +2,13 @@ name: Sync with private repo
on:
push:
branches: [ master, main, nightly ]
branches: [ release, main ]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add remote

View File

@ -2,19 +2,22 @@ name: Run tests
on:
pull_request:
branches: [master]
branches: [release, main]
push:
branches: [release, main]
jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.12']
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Upgrade pip
run: python -m pip install --upgrade pip setuptools
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install .[dev]

View File

@ -2,7 +2,6 @@ variables:
TUTOR_PLUGIN: discovery
TUTOR_IMAGES: discovery
TUTOR_PYPI_PACKAGE: tutor-discovery
OPENEDX_RELEASE: palm
GITHUB_REPO: overhangio/tutor-discovery
include:

22
.hatch_build.py Normal file
View File

@ -0,0 +1,22 @@
# https://hatch.pypa.io/latest/how-to/config/dynamic-metadata/
import os
import typing as t
from hatchling.metadata.plugin.interface import MetadataHookInterface
HERE = os.path.dirname(__file__)
class MetaDataHook(MetadataHookInterface):
def update(self, metadata: dict[str, t.Any]) -> None:
about = load_about()
metadata["version"] = about["__version__"]
def load_about() -> dict[str, str]:
about: dict[str, str] = {}
with open(
os.path.join(HERE, "tutordiscovery", "__about__.py"), "rt", encoding="utf-8"
) as f:
exec(f.read(), about)
return about

View File

@ -19,6 +19,63 @@ instructions, because git commits are used to generate release notes:
<!-- scriv-insert-here -->
<a id='changelog-20.0.0'></a>
## v20.0.0 (2025-06-05)
- [Bugfix] Add support to consume events from event bus in discovery. Explanation can be viewed here: https://github.com/openedx/event-bus-redis/blob/main/docs/tutor_installation.rst. (by @Faraz32123)
- [Feature] Introduced a new environment variable to enable or disable programs. (by @Faraz32123)
- This aligns with the frontend, which now also utilizes this environment variable. To view the frontend related changes, click here: https://github.com/openedx/frontend-app-learner-dashboard/pull/506/files.
- Additionally, it automates the enabling of programs in the "programapiconfig" model on the LMS admin panel through init tasks.
- [Improvement] Migrate packaging from setup.py/setuptools to pyproject.toml/hatch. (by @Faraz32123)
- For more details view tutor core PR: https://github.com/overhangio/tutor/pull/1163
- [Improvement] Add hatch_build.py in sdist target to fix the installation issues (by @dawoudsheraz)
- [Improvement] Replace site-configuration script with create_or_update_site_configuration management command in the init task. (by @Danyal-Faheem)
- 💥[Feature] Upgrade to Teak. (by @mlabeeb03)
<a id='changelog-19.0.0'></a>
## v19.0.0 (2024-10-23)
- 💥[Feature] Upgrade to Sumac. (by @Faraz32123)
- [Feature] Add Elasticsearch support in tutor-discovery. As Tutor and Open edX have shifted to Meilisearch, and course-discovery still depends on Elasticsearch, running the Elasticsearch container with tutor-discovery will facilitate smoother operation for the course-discovery service. (by @Faraz32123)
- Please see related tutor core PR for context https://github.com/overhangio/tutor/pull/1141
- 💥 [Deprecation] Drop support for python 3.8 and set Python 3.9 as the minimum supported python version. (by @Faraz32123)
- 💥[Improvement] Rename Tutor's two branches (by @DawoudSheraz):
* Rename **master** to **release**, as this branch runs the latest official Open edX release tag.
* Rename **nightly** to **main**, as this branch runs the Open edX master branches, which are the basis for the next Open edX release.
- [Improvement] Move is_docker_rootless method related to elasticsearch from tutor core to tutor-discovery. (by @Faraz32123)
- 💥[Feature] Update Course Discovery Image to use Ubuntu 22.04 as base OS. (by @hinakhadim)
- [Bugfix] Fix catalog_service_user permissions and 403 while fetching pathways (by @dyudyunov)
- [BugFix] Fix images(media) persistance issue by mounting media directory in volumes through patches. (by @Faraz32123)
- [Bugfix] Fix legacy warnings during Docker build. (by @regisb)
<a id='changelog-18.0.0'></a>
## v18.0.0 (2024-05-14)
- 💥[Feature] Upgrade to Redwood. (by @Faraz32123)
- 💥[Feature] Upgrade Python version to 3.12.2. (by @Faraz32123)
- [BugFix] Fix wrong mime type by adding mime-support dependency. (by @Faraz32123)
<a id='changelog-17.0.1'></a>
## v17.0.1 (2024-04-25)
- [Bugfix] Make plugin compatible with Python 3.12 by removing dependency on `pkg_resources`. (by @regisb)
- [Feature] Make it possible to use mounts for a local development. (by @cmltawt0)
- [Bugfix] Fix volumes empty list error during tutor dev launch. (by @Faraz32123)
- [Bugfix] Fix the docker image to allow media files to be served by uwsgi. (by @angonz)
<a id='changelog-17.0.0'></a>
## v17.0.0 (2023-12-09)
- 💥 [Feature] Upgrade to Quince. (by @ziafazal)
- [Bugfix] Fix missing pkg-config during image build. (by @regisb)
- [Feature] Pull translations via `atlas` during Docker build. (by @OmarIthawi)
<a id='changelog-16.0.2'></a>
## v16.0.2 (2023-12-09)
@ -30,6 +87,5 @@ instructions, because git commits are used to generate release notes:
## v16.0.1 (2023-11-08)
- [Improvement] Add a scriv-compliant changelog. (by @regisb)
- [BugFix] Corrected variable name for installing extra pip requirements. (by @Faraz32123)

View File

@ -1,2 +0,0 @@
recursive-include tutordiscovery/patches *
recursive-include tutordiscovery/templates *

View File

@ -1,25 +1,33 @@
.DEFAULT_GOAL := help
.PHONY: docs
SRC_DIRS = ./tutordiscovery
BLACK_OPTS = --exclude templates ${SRC_DIRS}
SRC_DIRS = ./tutordiscovery ./tests
# Warning: These checks are run on every PR.
test: test-lint test-types test-format # Run some static checks.
test: test-lint test-types test-format test-unit test-pythonpackage # Run some static checks.
test-format: ## Run code formatting tests.
black --check --diff $(BLACK_OPTS)
ruff format --check --diff ${SRC_DIRS}
test-lint: ## Run code linting tests
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS}
ruff check ${SRC_DIRS}
test-types: ## Run type checks.
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}
format: ## Format code automatically.
black $(BLACK_OPTS)
test-unit: ## Run unit tests
python -m unittest discover tests
isort: ## Sort imports. This target is not mandatory because the output may be incompatible with black formatting. Provided for convenience purposes.
isort --skip=templates ${SRC_DIRS}
build-pythonpackage: ## Build the "tutor-discovery" python package for upload to pypi
python -m build --sdist
test-pythonpackage: build-pythonpackage ## Test that package can be uploaded to pypi
twine check dist/tutor_discovery-$(shell make version).tar.gz
format: ## Format code automatically.
ruff format ${SRC_DIRS}
fix-lint: ## Fix lint errors automatically
ruff check --fix ${SRC_DIRS}
changelog-entry: ## Create a new changelog entry.
scriv create
@ -27,6 +35,9 @@ changelog-entry: ## Create a new changelog entry.
changelog: ## Collect changelog entries in the CHANGELOG.md file.
scriv collect
version: ## Print the current tutor-discovery version
@python -c 'import io, os; about = {}; exec(io.open(os.path.join("tutordiscovery", "__about__.py"), "rt", encoding="utf-8").read(), about); print(about["__version__"])'
ESCAPE = 
help: ## Print this help.
@grep -E '^([a-zA-Z_-]+:.*?## .*|######* .+)$$' Makefile \

View File

@ -1,28 +1,36 @@
Course Discovery plugin for `Tutor <https://docs.tutor.edly.io>`_
=====================================================================
Course Discovery plugin for `Tutor`_
====================================
This is a plugin for `Tutor <https://docs.tutor.edly.io>`_ that integrates the `Course Discovery <https://github.com/edx/course-discovery/>`__ application in an Open edX platform. it is useful for integration with, for example, `Ecommerce <https://github.com/edx/ecommerce>`__ or an external course catalog.
This is a plugin for `Tutor`_ that integrates the `Course Discovery`_ application in an Open edX platform.
it is useful for integration with, for example, `Ecommerce`_ or an external course catalog.
.. _Tutor: https://docs.tutor.edly.io
.. _Course Discovery: https://github.com/edx/course-discovery/
.. _Ecommerce: https://github.com/edx/ecommerce
Installation
------------
This plugin requires tutor>=3.6.0. If you have installed tutor from a pre-compiled binary, it already comes bundled with the discovery plugin. Otherwise::
This plugin requires ``tutor>=3.6.0``. If you have installed tutor from a pre-compiled binary,
it already comes bundled with the discovery plugin. Otherwise:
.. code-block:: bash
tutor plugins install discovery
Then, to enable this plugin, run::
Then, to enable this plugin, run:
.. code-block:: bash
tutor plugins enable discovery
You will have to re-generate the environment::
Restart and initialize your platform with:
tutor config save
.. code-block:: bash
Then, run migrations::
tutor local init
This last step is unnecessary if you run instead ``tutor local launch``.
tutor dev|local|k8s launch
Operations
----------
@ -30,19 +38,31 @@ Operations
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.<your lms host>) in production. In order to run commands from the UI, a user must be created::
The discovery user interface will be available at http://discovery.local.openedx.io for a local test instance,
and at ``DISCOVERY_HOST`` (by default: http(s)://discovery.<your lms host>) in production. To run
commands from the UI, a user must be created:
.. code-block:: bash
tutor local run discovery ./manage.py createsuperuser
Then, you must login with this user at http://discovery.local.overhang.io/admin.
Then, you must log in with this user at http://discovery.local.openedx.io/admin.
Alternatively, you can login with oauth2 using a pre-existing user created on the LMS/CMS by accessing http(s)://discovery.<your lms host>/login. To do so, the proper domain names must exist and point to the production server.
Using SSO with LMS
~~~~~~~~~~~~~~~~~~
If you want to log in using Single Sign-On (SSO) with the LMS, ensure that the superuser you created
above in discovery has the same username and email as an existing admin user in the LMS/CMS. You can
then access the discovery interface via `http(s)://discovery.<your lms host>/login`. Make sure that
the proper domain names are configured and point to the production server.
Index configuration
~~~~~~~~~~~~~~~~~~~
Discovery uses separate indices for different models (the names are: course, course_run, person and program by default). And you can overwrite theses
names by configuring ``DISCOVERY_INDEX_OVERRIDES``::
Discovery uses separate indices for different models (the names are: course, course_run, person, and
program by default). And you can overwrite these names by configuring ``DISCOVERY_INDEX_OVERRIDES``:
.. code-block:: yml
DISCOVERY_INDEX_OVERRIDES:
course_discovery.apps.course_metadata.search_indexes.documents.course: your-course-index-name
@ -53,79 +73,179 @@ names by configuring ``DISCOVERY_INDEX_OVERRIDES``::
Re-indexing courses
~~~~~~~~~~~~~~~~~~~
::
While running tutor in production mode:
.. code-block:: bash
tutor local run discovery ./manage.py refresh_course_metadata --partner_code=openedx
tutor local run discovery ./manage.py update_index --disable-change-limit
While running tutor in development mode:
.. code-block:: bash
tutor dev run discovery ./manage.py refresh_course_metadata --partner_code=dev
tutor dev run discovery ./manage.py update_index --disable-change-limit
Caching programs
~~~~~~~~~~~~~~~~
In order to cache programs in the LMS, you will need to manually create a catalog integration. Make sure you use staff user for the below command. If ``lms_catalog_service_user`` is not a staff user, then make it a staff user in your LMS User model. This step should be performed just once::
To cache programs in the LMS, you will need to manually create a catalog integration.
Make sure you use staff user for the below command. If ``lms_catalog_service_user`` is not a staff user,
then make it a staff user in your LMS User model. This step should be performed just once:
.. code-block:: bash
tutor local run lms ./manage.py lms create_catalog_integrations --enabled \
--internal_api_url="" \
--service_username=lms_catalog_service_user
Then run the below command, this command will cause errors every time as it tries to cache programs from all sites that are added to your LMS sites model::
Then run the below command, this command will cause errors every time it tries to cache programs
from all sites that are added to your LMS sites model:
.. code-block:: bash
tutor local run lms ./manage.py lms cache_programs
If you don't want the errors, then make use of an extra argument to the command .i.e. ``--domain``. This argument will be equal to ``local.overhang.io`` if you are running tutor local and ``local.overhang.io:8000`` if you are running tutor dev::
tutor local run lms ./manage.py lms cache_programs --domain="local.overhang.io"
or
tutor dev run lms ./manage.py lms cache_programs --domain="local.overhang.io:8000"
The above command will give some errors as it tries to cache programs for all sites. So make use of an
extra argument to the command. i.e. ``--domain``. While running tutor in production mode:
.. code-block:: bash
tutor local run lms ./manage.py lms cache_programs --domain="local.openedx.io"
While running tutor in development mode:
.. code-block:: bash
tutor dev run lms ./manage.py lms cache_programs --domain="local.openedx.io:8000"
This last step should be performed every time you create new or make changes to existing programs.
Show Programs Tab
~~~~~~~~~~~~~~~~~
By default, the **Programs** tab is available in the LMS dashboard. Users can enable or disable this tab as needed.
To Disable Programs, run the following command:
.. code-block:: bash
tutor config save --set ENABLE_PROGRAMS=False
To Enable Programs, run the following command:
.. code-block:: bash
tutor config save --set ENABLE_PROGRAMS=True
Only programs in which learners are registered will appear on this page. If a learner is enrolled in any course that is part of a program, that program will be displayed here.
.. image:: https://github.com/overhangio/tutor-discovery/assets/122095701/e0224011-adc0-41e4-a104-af4cb0c24b82
:alt: Programs Tab on LMS dashboard
In the image above, the **Explore Programs** button points to http://localhost:8080/programs by default. This link does not exist, so users can change it to their custom-built marketing site URL to display all programs.
To Modify the Link:
1. Go to the **Site Configurations** model in the LMS Admin Panel: `http://local.openedx.io/admin/site_configuration/siteconfiguration/`
2. Open the respective LMS site configuration.
3. Add the following dictionary in the **site values** field like in the below image:
.. code-block:: python
"MKTG_URLS": {
"ROOT": "https://custom-marketing-site-here.com"
}
.. image:: https://github.com/overhangio/tutor-discovery/assets/122095701/2d588ea9-a830-40b6-9845-8fab56d7cb5a
:alt: Add Custom Site for Explore Programs
By following above instructions, this link (https://custom-marketing-site-here.com) will be replaced by http://localhost:8080. Additionally, users can also replace "/programs" by following these below steps:
1. Go to: `http://local.openedx.io/admin/programs/programsapiconfig/`
2. Add **Marketing path** equal to "/programs" or your desired marketing site path and enable it.
Install extra requirements
~~~~~~~~~~~~~~~~~~~~~~~~~~
In order to install extra requirements, use DISCOVERY_EXTRA_PIP_REQUIREMENTS and re-build the docker image.::
To install extra requirements, use ``DISCOVERY_EXTRA_PIP_REQUIREMENTS`` and re-build the docker image.
tutor config save \
--set 'DISCOVERY_EXTRA_PIP_REQUIREMENTS=["git+https://github.com/myusername/myplugin"]'
.. code-block:: bash
Then, build the image, pointing to your fork if necessary::
tutor config save --set 'DISCOVERY_EXTRA_PIP_REQUIREMENTS=["git+https://github.com/myusername/myplugin"]'
Then, build the image, pointing to your fork if necessary:
.. code-block:: bash
tutor images build discovery
Debugging
---------
To debug the course discovery service, you are encouraged to mount the course-discovery repo from the host in the development container:
To debug the course discovery service, you are encouraged to mount the course-discovery repo from the host
in the development container:
.. code-block:: bash
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.
You can then access the development server at http://discovery.local.openedx.io:8381. Feel free to add breakpoints
(``import pdb; pdb.set_trace()``) anywhere in your source code to debug your application.
Once a local repository is mounted in the image, you will have to install nodejs dependencies and collect static assets::
Once a local repository is mounted in the image, you will have to install nodejs dependencies and collect static assets:
.. code-block:: bash
tutor dev run discovery npm install --development
tutor dev run discovery make static.dev
Troubleshooting
---------------
This Tutor plugin is maintained by Muhammad Faraz Maqsood from `Edly <https://edly.io/>`__. Community support is available from the official `Open edX forum <https://discuss.openedx.org>`__. Do you need help with this plugin? See the `troubleshooting <https://docs.tutor.edly.io/troubleshooting.html>`__ 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='<LMS_HOST>', port=443): Max retries exceeded with url: /api/courses/v1/courses/?page=1&page_size=10&username=discovery
```
.. code-block:: log
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::
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='<LMS_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`_) the `/etc/hosts` file on the host automatically
contains the following entry:
.. code-block:: bash
127.0.1.1 <LMS HOST>
This entry may be present if you named your server with the LMS hostname.
.. _DigitalOcean: https://digitalocean.com/
Using event-bus with tutor-discovery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Although tutor-discovery does not start event bus consumption by default, it supports running it. To consume events from event bus with tutor-discovery, follow these `instructions`_ provided by `event-bus-redis`_.
.. _instructions: https://github.com/openedx/event-bus-redis/blob/main/docs/tutor_installation.rst
.. _event-bus-redis: https://github.com/openedx/event-bus-redis
Troubleshooting
---------------
This Tutor plugin is maintained by Muhammad Labeeb from `Edly`_.
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.
.. _Edly: https://edly.io/
.. _Open edX forum: https://discuss.openedx.org
.. _troubleshooting: https://docs.tutor.edly.io/troubleshooting.html
License
-------
This work is licensed under the terms of the `GNU Affero General Public License (AGPL) <https://github.com/overhangio/tutor/blob/master/LICENSE.txt>`_.
This work is licensed under the terms of the `GNU Affero General Public License (AGPL)`_.
.. _GNU Affero General Public License (AGPL): https://github.com/overhangio/tutor/blob/release/LICENSE.txt

View File

@ -0,0 +1,2 @@
- [Improvement] Migrate from pylint and black to ruff. (by @mlabeeb03)
- [Improvement] Test python package distribution build when running make test. (by @mlabeeb03)

View File

@ -1,2 +1,84 @@
# https://packaging.python.org/en/latest/tutorials/packaging-projects/
# https://hatch.pypa.io/latest/config/build/
[project]
name = "tutor-discovery"
license = { text = "AGPL-3.0-only" }
authors = [
{name = "Edly"},
{email = "hello@edly.io"},
]
maintainers = [
{name = "Muhammad Labeeb"},
{email = "muhammad.labeeb@arbisoft.com"},
]
description="A Tutor plugin for course discovery, the Open edX service for providing access to consolidated course and program metadata"
readme = {file = "README.rst", content-type = "text/x-rst"}
requires-python = ">= 3.9"
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.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"tutor>=20.0.0,<21.0.0",
]
# these fields will be set by hatch_build.py
dynamic = ["version"]
[project.optional-dependencies]
dev = [
"tutor[dev]>=20.0.0,<21.0.0",
"ruff",
]
# https://packaging.python.org/en/latest/specifications/well-known-project-urls/#well-known-labels
[project.urls]
Homepage = "https://docs.tutor.edly.io/"
Documentation = "https://docs.tutor.edly.io/"
Source = "https://github.com/overhangio/tutor-discovery"
Issues = "https://github.com/overhangio/tutor-discovery/issues"
Changelog = "https://github.com/overhangio/tutor-discovery/blob/release/CHANGELOG.md"
Community = "https://discuss.openedx.org/tag/tutor"
# hatch-specific configuration
[tool.hatch.metadata.hooks.custom]
path = ".hatch_build.py"
[build-system]
requires = ["setuptools", "wheel"]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.sdist]
# Disable strict naming, otherwise twine is not able to detect name/version
strict-naming = false
include = [ "/tutordiscovery", ".hatch_build.py"]
exclude = ["tests*"]
[tool.hatch.build.targets.wheel]
packages = ["tutordiscovery"]
[tool.ruff]
exclude = ["templates", "docs/_ext"]
[tool.ruff.lint]
# E: pycodestyle errors
# I: isort
# N: pep8-naming
select = ["E", "I", "N"]
# F401: unused-import
# F841: unused-variable
# W292: missing-newline-at-end-of-file
extend-select = ["F401", "F841", "W292"]
[tool.ruff.format]
[project.entry-points."tutor.plugin.v1"]
discovery = "tutordiscovery.plugin"

View File

@ -1,53 +0,0 @@
import io
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
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:
exec(f.read(), about)
setup(
name="tutor-discovery",
version=about["__version__"],
url="https://docs.tutor.edly.io/",
project_urls={
"Documentation": "https://docs.tutor.edly.io/",
"Code": "https://github.com/overhangio/tutor-discovery",
"Issue tracker": "https://github.com/overhangio/tutor-discovery/issues",
"Community": "https://discuss.openedx.org",
},
license="AGPLv3",
author="Overhang.IO",
author_email="contact@overhang.io",
maintainer="Edly",
maintainer_email="faraz.maqsood@arbisoft.com",
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>=16.0.0,<17.0.0"],
extras_require={"dev": "tutor[dev]>=16.0.0,<17.0.0"},
python_requires=">=3.8",
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.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
)

0
tests/__init__.py Normal file
View File

26
tests/test_utils.py Normal file
View File

@ -0,0 +1,26 @@
import subprocess
import unittest
from unittest.mock import MagicMock, patch
from tutordiscovery import utils
class UtilsTests(unittest.TestCase):
@patch("subprocess.run")
def test_is_docker_rootless(self, mock_run: MagicMock) -> None:
# Mock rootless `docker info` output
utils.is_docker_rootless.cache_clear()
mock_run.return_value.stdout = "some prefix\n rootless foo bar".encode("utf-8")
self.assertTrue(utils.is_docker_rootless())
# Mock regular `docker info` output
utils.is_docker_rootless.cache_clear()
mock_run.return_value.stdout = "some prefix, regular docker".encode("utf-8")
self.assertFalse(utils.is_docker_rootless())
@patch("subprocess.run")
def test_is_docker_rootless_podman(self, mock_run: MagicMock) -> None:
"""Test the `is_docker_rootless` when podman is used or any other error with `docker info`""" # noqa: E501
utils.is_docker_rootless.cache_clear()
mock_run.side_effect = subprocess.CalledProcessError(1, "docker info")
self.assertFalse(utils.is_docker_rootless())

View File

@ -1 +1 @@
__version__ = "16.0.2"
__version__ = "20.0.0"

View File

@ -0,0 +1 @@
DISCOVERY_RUN_ELASTICSEARCH = {{ DISCOVERY_RUN_ELASTICSEARCH }}

View File

@ -15,8 +15,8 @@ spec:
app.kubernetes.io/name: discovery
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
runAsUser: {{ APP_USER_ID }}
runAsGroup: {{ APP_USER_ID }}
containers:
- name: discovery
image: {{ DISCOVERY_DOCKER_IMAGE }}
@ -32,3 +32,54 @@ spec:
- name: settings
configMap:
name: discovery-settings
{% if DISCOVERY_RUN_ELASTICSEARCH %}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: elasticsearch
labels:
app.kubernetes.io/name: elasticsearch
spec:
selector:
matchLabels:
app.kubernetes.io/name: elasticsearch
strategy:
type: Recreate
template:
metadata:
labels:
app.kubernetes.io/name: elasticsearch
spec:
securityContext:
runAsUser: {{ APP_USER_ID }}
runAsGroup: {{ APP_USER_ID }}
fsGroup: {{ APP_USER_ID }}
fsGroupChangePolicy: "OnRootMismatch"
containers:
- name: elasticsearch
image: {{ DISCOVERY_DOCKER_IMAGE_ELASTICSEARCH }}
env:
- name: cluster.name
value: "openedx"
- name: bootstrap.memory_lock
value: "true"
- name: discovery.type
value: "single-node"
- name: ES_JAVA_OPTS
value: "-Xms{{ DISCOVERY_ELASTICSEARCH_HEAP_SIZE }} -Xmx{{ DISCOVERY_ELASTICSEARCH_HEAP_SIZE }}"
- name: TAKE_FILE_OWNERSHIP
value: "1"
ports:
- containerPort: 9200
securityContext:
allowPrivilegeEscalation: false
volumeMounts:
- mountPath: /usr/share/elasticsearch/data
name: data
volumes:
- name: data
persistentVolumeClaim:
claimName: elasticsearch
{% endif %}

View File

@ -23,4 +23,3 @@ spec:
- name: settings
configMap:
name: discovery-settings

View File

@ -10,3 +10,19 @@ spec:
protocol: TCP
selector:
app.kubernetes.io/name: discovery
{% if DISCOVERY_RUN_ELASTICSEARCH %}
---
apiVersion: v1
kind: Service
metadata:
name: elasticsearch
labels:
app.kubernetes.io/name: elasticsearch
spec:
type: ClusterIP
ports:
- port: 9200
protocol: TCP
selector:
app.kubernetes.io/name: elasticsearch
{% endif %}

View File

@ -0,0 +1,16 @@
{% if DISCOVERY_RUN_ELASTICSEARCH %}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: elasticsearch
labels:
app.kubernetes.io/component: volume
app.kubernetes.io/name: elasticsearch
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
{% endif %}

View File

@ -4,9 +4,23 @@ discovery:
command: ./manage.py runserver 0.0.0.0:8381
stdin_open: true
tty: true
volumes:
- ../../data/discovery/media:/openedx/discovery/course_discovery/media
{%- for mount in iter_mounts(MOUNTS, "discovery") %}
- {{ mount }}
{%- endfor %}
ports:
- "8381:8381"
networks:
default:
aliases:
- "{{ DISCOVERY_HOST }}"
{% if DISCOVERY_RUN_ELASTICSEARCH and is_docker_rootless() %}
elasticsearch:
ulimits:
memlock:
# Fixes error setting rlimits for ready process in rootless docker
soft: 0 # zero means "unset" in the memlock context
hard: 0
{% endif %}

View File

@ -0,0 +1 @@
{% if DISCOVERY_RUN_ELASTICSEARCH %}setowner {{ APP_USER_ID }} /mounts/elasticsearch{% endif %}

View File

@ -0,0 +1 @@
{% if DISCOVERY_RUN_ELASTICSEARCH %}- ../../data/elasticsearch:/mounts/elasticsearch{% endif %}

View File

@ -5,7 +5,29 @@ discovery:
restart: unless-stopped
volumes:
- ../plugins/discovery/apps/settings/tutor:/openedx/discovery/course_discovery/settings/tutor:ro
- ../../data/discovery/media:/openedx/discovery/course_discovery/media
{% if DISCOVERY_RUN_ELASTICSEARCH %}- ../../data/elasticsearch:/mounts/elasticsearch{% endif %}
depends_on:
- lms
{% if RUN_MYSQL %}- mysql{% endif %}
{% if RUN_ELASTICSEARCH %}- elasticsearch{% endif %}
{% if DISCOVERY_RUN_ELASTICSEARCH %}- elasticsearch{% endif %}
{% if DISCOVERY_RUN_ELASTICSEARCH -%}
elasticsearch:
image: {{ DISCOVERY_DOCKER_IMAGE_ELASTICSEARCH }}
environment:
- cluster.name=openedx
- bootstrap.memory_lock=true
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms{{ DISCOVERY_ELASTICSEARCH_HEAP_SIZE }} -Xmx{{ DISCOVERY_ELASTICSEARCH_HEAP_SIZE }}"
ulimits:
memlock:
soft: -1
hard: -1
restart: unless-stopped
user: "{{ APP_USER_ID }}:{{ APP_USER_ID }}"
volumes:
- ../../data/elasticsearch:/usr/share/elasticsearch/data
depends_on:
- permissions
{%- endif %}

View File

@ -0,0 +1 @@
MFE_CONFIG["ENABLE_PROGRAMS"] = {{ ENABLE_PROGRAMS }}

View File

@ -4,13 +4,14 @@ import os
import typing as t
from glob import glob
import pkg_resources
import importlib_resources
from tutor import hooks as tutor_hooks
from tutor.__about__ import __version_suffix__
from .__about__ import __version__
from .utils import is_docker_rootless
# Handle version suffix in nightly mode, just like tutor core
# Handle version suffix in main mode, just like tutor core
if __version_suffix__:
__version__ += "-" + __version_suffix__
@ -21,7 +22,7 @@ APP_NAME = "discovery"
config: t.Dict[str, t.Dict[str, t.Any]] = {
"defaults": {
"VERSION": __version__,
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY}}overhangio/openedx-discovery:{{ DISCOVERY_VERSION }}",
"DOCKER_IMAGE": "{{ DOCKER_REGISTRY}}overhangio/openedx-discovery:{{ DISCOVERY_VERSION }}", # noqa: E501
"HOST": "discovery.{{ LMS_HOST }}",
"INDEX_OVERRIDES": {},
"MYSQL_DATABASE": "discovery",
@ -31,9 +32,17 @@ config: t.Dict[str, t.Dict[str, t.Any]] = {
"OAUTH2_KEY_SSO": "discovery-sso",
"OAUTH2_KEY_SSO_DEV": "discovery-sso-dev",
"CACHE_REDIS_DB": "{{ OPENEDX_CACHE_REDIS_DB }}",
"ATLAS_PULL": False,
"DEFAULT_PRODUCT_SOURCE_SLUG": "edx",
"EXTRA_PIP_REQUIREMENTS": [],
"REPOSITORY": "https://github.com/openedx/course-discovery.git",
"REPOSITORY_VERSION": "{{ OPENEDX_COMMON_VERSION }}",
"RUN_ELASTICSEARCH": True,
"DOCKER_IMAGE_ELASTICSEARCH": "docker.io/elasticsearch:7.17.13",
"ELASTICSEARCH_HOST": "elasticsearch",
"ELASTICSEARCH_PORT": 9200,
"ELASTICSEARCH_SCHEME": "http",
"ELASTICSEARCH_HEAP_SIZE": "1g",
},
"unique": {
"MYSQL_PASSWORD": "{{ 8|random_string }}",
@ -41,6 +50,9 @@ config: t.Dict[str, t.Dict[str, t.Any]] = {
"OAUTH2_SECRET": "{{ 8|random_string }}",
"OAUTH2_SECRET_SSO": "{{ 8|random_string }}",
},
"overrides": {
"ENABLE_PROGRAMS": True,
},
}
# Initialization tasks
@ -48,7 +60,7 @@ init_tasks = ("mysql", "lms", "discovery")
for service in init_tasks:
with open(
os.path.join(
pkg_resources.resource_filename("tutordiscovery", "templates"),
str(importlib_resources.files("tutordiscovery") / "templates"),
"discovery",
"tasks",
service,
@ -110,7 +122,7 @@ def _mount_course_discovery_on_build(
# Add the "templates" folder as a template root
tutor_hooks.Filters.ENV_TEMPLATE_ROOTS.add_item(
pkg_resources.resource_filename("tutordiscovery", "templates")
str(importlib_resources.files("tutordiscovery") / "templates")
)
# Render the "build" and "apps" folders
tutor_hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
@ -119,10 +131,14 @@ tutor_hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
("discovery/apps", "plugins"),
],
)
# Template variables
tutor_hooks.Filters.ENV_TEMPLATE_VARIABLES.add_item(
("is_docker_rootless", is_docker_rootless),
)
# Load patches from files
for path in glob(
os.path.join(
pkg_resources.resource_filename("tutordiscovery", "patches"),
str(importlib_resources.files("tutordiscovery") / "patches"),
"*",
)
):

View File

@ -20,8 +20,14 @@ DATABASES = {
}
}
DISCOVERY_DOCKER_IMAGE_ELASTICSEARCH = "{{ DISCOVERY_DOCKER_IMAGE_ELASTICSEARCH }}"
DISCOVERY_ELASTICSEARCH_HOST = "{{ DISCOVERY_ELASTICSEARCH_HOST }}"
DISCOVERY_ELASTICSEARCH_PORT = "{{ DISCOVERY_ELASTICSEARCH_PORT }}"
DISCOVERY_ELASTICSEARCH_SCHEME = "{{ DISCOVERY_ELASTICSEARCH_SCHEME }}"
DISCOVERY_ELASTICSEARCH_HEAP_SIZE = "{{ DISCOVERY_ELASTICSEARCH_HEAP_SIZE }}"
ELASTICSEARCH_DSL['default'].update({
'hosts': "{{ ELASTICSEARCH_SCHEME }}://{{ ELASTICSEARCH_HOST }}:{{ ELASTICSEARCH_PORT }}/"
'hosts': "{{ DISCOVERY_ELASTICSEARCH_SCHEME }}://{{ DISCOVERY_ELASTICSEARCH_HOST }}:{{ DISCOVERY_ELASTICSEARCH_PORT }}/"
})
{% for name, index in DISCOVERY_INDEX_OVERRIDES.items() %}
@ -47,6 +53,7 @@ PARLER_LANGUAGES[1][0]["code"] = LANGUAGE_CODE
PARLER_LANGUAGES["default"]["fallbacks"] = [PARLER_DEFAULT_LANGUAGE_CODE]
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
DEFAULT_PRODUCT_SOURCE_SLUG = "{{ DISCOVERY_DEFAULT_PRODUCT_SOURCE_SLUG }}"
EMAIL_HOST = "{{ SMTP_HOST }}"
EMAIL_PORT = "{{ SMTP_PORT }}"
EMAIL_HOST_USER = "{{ SMTP_USERNAME }}"

View File

@ -1,16 +1,17 @@
{% if is_buildkit_enabled() %}# syntax=docker/dockerfile:1.4{% endif %}
# syntax=docker/dockerfile:1.4
###### Minimal image with base system requirements for most stages
FROM docker.io/ubuntu:20.04 as minimal
FROM docker.io/ubuntu:22.04 AS minimal
ENV 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 %} \
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt update && \
apt install -y curl git-core language-pack-en python3 python3-pip python3-venv \
build-essential libcairo2 libffi-dev libmysqlclient-dev libxml2-dev libxslt-dev libjpeg-dev libssl-dev
ENV LC_ALL en_US.UTF-8
apt install -y curl git-core gettext language-pack-en \
build-essential libcairo2 libffi-dev libmysqlclient-dev libxml2-dev libxslt-dev libjpeg-dev libssl-dev \
pkg-config libsqlite3-dev media-types mailcap libbz2-dev liblzma-dev
ENV LC_ALL=en_US.UTF-8
ARG APP_USER_ID=1000
ARG APP_USER_ID={{ HOST_USER_ID }}
RUN if [ "$APP_USER_ID" = 0 ]; then echo "app user may not be root" && false; fi
RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app
USER ${APP_USER_ID}
@ -24,58 +25,79 @@ WORKDIR /openedx/discovery
# Setup empty yml config file, which is required by production settings
RUN echo "{}" > /openedx/config.yml
ENV DISCOVERY_CFG /openedx/config.yml
ENV DISCOVERY_CFG=/openedx/config.yml
# Install python venv
RUN python3 -m venv ../venv/
ENV PATH "/openedx/venv/bin:$PATH"
# Install pyenv
# https://www.python.org/downloads/
# https://github.com/pyenv/pyenv/releases
ARG PYTHON_VERSION=3.12.2
ENV PYENV_ROOT=/opt/pyenv
# root user is required for below 2 steps, as app user gets permission denied.
USER root
RUN git clone https://github.com/pyenv/pyenv $PYENV_ROOT --branch v2.3.36 --depth 1
# Install Python
RUN $PYENV_ROOT/bin/pyenv install $PYTHON_VERSION
USER app
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install \
# Create virtualenv
RUN $PYENV_ROOT/versions/$PYTHON_VERSION/bin/python -m venv /openedx/venv
ENV PATH=/openedx/venv/bin:$PATH
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
# https://pypi.org/project/setuptools/
# https://pypi.org/project/pip/
# https://pypi.org/project/wheel/
setuptools==67.7.2 pip==23.1.2. wheel==0.40.0
setuptools==77.0.3 pip==25.0.1 wheel==0.45.1
# Install a recent version of nodejs
RUN pip install nodeenv==1.7.0
RUN pip install nodeenv==1.9.1
# 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}
ENV PATH=/openedx/nodeenv/bin:${PATH}
# Install python and nodejs requirements
# This is identical to "make production-requirements" but it was split in multiple
# instructions to benefit from docker image caching
# Install base requirements
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install -r requirements.txt
{% for extra_requirement in DISCOVERY_EXTRA_PIP_REQUIREMENTS %}RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install '{{ extra_requirement }}'
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install -r requirements.txt
{% for extra_requirement in DISCOVERY_EXTRA_PIP_REQUIREMENTS %}RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install '{{ extra_requirement }}'
{% endfor %}
# Install npm, bower requirements
ARG NPM_REGISTRY='{{ NPM_REGISTRY }}'
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.npm/,sharing=shared,uid=${APP_USER_ID} {% endif %}npm clean-install --verbose --no-audit --registry=$NPM_REGISTRY --production
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/bower,sharing=shared,uid=${APP_USER_ID} {% endif %}./node_modules/.bin/bower install --allow-root --production
RUN --mount=type=cache,target=/openedx/.npm/,sharing=shared,uid=${APP_USER_ID} npm clean-install --verbose --no-audit --registry=$NPM_REGISTRY --production
RUN --mount=type=cache,target=/openedx/.cache/bower,sharing=shared,uid=${APP_USER_ID} ./node_modules/.bin/bower install --allow-root --production
# Install extra requirements
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install \
RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=shared pip install \
# Use redis as a django cache https://pypi.org/project/django-redis/
django-redis==5.2.0 \
django-redis==5.4.0 \
# uwsgi server https://pypi.org/project/uWSGI/
uwsgi==2.0.21
uwsgi==2.0.28
{% if DISCOVERY_ATLAS_PULL %}
# Pull translations. Support the OEP-58 proposal behind a feature flag until it's fully implemented.
RUN atlas pull {{ patch("atlas-extra-args") }} translations/course-discovery/course_discovery/conf/locale:course_discovery/conf/locale
RUN python manage.py compilemessages
{% endif %}
# Collect static assets
COPY --chown=app:app assets.py ./course_discovery/settings/assets.py
RUN DJANGO_SETTINGS_MODULE=course_discovery.settings.assets make static
# Create media directory to serve media files
RUN mkdir course_discovery/media
# Run production server
ENV DJANGO_SETTINGS_MODULE course_discovery.settings.tutor.production
ENV DJANGO_SETTINGS_MODULE=course_discovery.settings.tutor.production
EXPOSE 8000
CMD uwsgi \
--static-map /static=/openedx/discovery/course_discovery/assets \
--static-map /media=/openedx/discovery/course_discovery/media \
--http 0.0.0.0:8000 \
--thunder-lock \
--single-interpreter \
--enable-threads \
--processes=2 \
--buffer-size=8192 \
--wsgi-file course_discovery/wsgi.py
CMD ["uwsgi", \
"--static-map", "/static=/openedx/discovery/course_discovery/assets", \
"--static-map", "/media=/openedx/discovery/course_discovery/media", \
"--http", "0.0.0.0:8000", \
"--thunder-lock", \
"--single-interpreter", \
"--enable-threads", \
"--processes=2", \
"--buffer-size=8192", \
"--wsgi-file", "course_discovery/wsgi.py"]

View File

@ -6,8 +6,13 @@
"from django.contrib.auth import get_user_model;\
get_user_model().objects.filter(username='lms_catalog_service_user').exclude(email='lms_catalog_service_user@openedx').update(email='lms_catalog_service_user@openedx')"
./manage.py lms shell -c \
"from openedx.core.djangoapps.programs.models import ProgramsApiConfig;\
ProgramsApiConfig.current().enabled or \
ProgramsApiConfig.objects.create(marketing_path='/programs', enabled=True)"
./manage.py lms manage_user discovery discovery@openedx --staff --superuser --unusable-password
./manage.py lms manage_user lms_catalog_service_user lms_catalog_service_user@openedx --unusable-password
./manage.py lms manage_user lms_catalog_service_user lms_catalog_service_user@openedx --staff --unusable-password
# Development client
./manage.py lms create_dot_application \
@ -57,5 +62,5 @@
# configuration -- which means that it takes different values for different
# sites. This is important because the programs and courses returned for each
# site will differ.
site-configuration set -d {{ LMS_HOST }} COURSE_CATALOG_API_URL {% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ DISCOVERY_HOST }}/api/v1
site-configuration set -d {{ LMS_HOST }}:8000 COURSE_CATALOG_API_URL http://{{ DISCOVERY_HOST }}:8381/api/v1
./manage.py lms create_or_update_site_configuration {{ LMS_HOST }} --configuration '{"COURSE_CATALOG_API_URL": "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ DISCOVERY_HOST }}/api/v1"}' --enabled
./manage.py lms create_or_update_site_configuration {{ LMS_HOST }}:8000 --configuration '{"COURSE_CATALOG_API_URL": "http://{{ DISCOVERY_HOST }}:8381/api/v1"}' --enabled

16
tutordiscovery/utils.py Normal file
View File

@ -0,0 +1,16 @@
import subprocess
from functools import lru_cache
@lru_cache(maxsize=None)
def is_docker_rootless() -> bool:
"""
A helper function to determine if Docker is running in rootless mode.
- https://docs.docker.com/engine/security/rootless/
"""
try:
results = subprocess.run(["docker", "info"], capture_output=True, check=True)
return "rootless" in results.stdout.decode()
except subprocess.CalledProcessError:
return False