Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add init task to pip-install mounted edx-platform #25

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
be1e169
fix: tutor nightly version suffix
regisb Dec 15, 2022
c0d7e26
fix(config): use master branch instead of olive.1
ARMBouhali Dec 28, 2022
5a3b762
fix(patches): remove openedx backport from nightly
ARMBouhali Dec 28, 2022
d5f17dd
Merge remote-tracking branch 'origin/master' into nightly
Jan 3, 2023
95182ab
Merge remote-tracking branch 'origin/master' into nightly
Jan 5, 2023
c866885
Merge remote-tracking branch 'origin/master' into nightly
Jan 6, 2023
e987db4
Merge remote-tracking branch 'origin/master' into nightly
Jan 9, 2023
9b22498
Merge remote-tracking branch 'origin/master' into nightly
Jan 17, 2023
4da32ab
refactor: annotation with __future__.annotations
Jan 17, 2023
0f67506
Merge branch 'master' into nightly
regisb Jan 18, 2023
cad1e03
Merge remote-tracking branch 'origin/master' into nightly
Jan 19, 2023
13d6fc2
Merge remote-tracking branch 'origin/master' into nightly
Jan 31, 2023
45addca
Merge remote-tracking branch 'origin/master' into nightly
Jan 31, 2023
86bf655
docs: fix typos in hooks changelog entry
kdmccormick Jan 31, 2023
0594677
Merge remote-tracking branch 'origin/master' into nightly
Jan 31, 2023
bbab35e
Merge remote-tracking branch 'origin/master' into nightly
Feb 2, 2023
928859c
Merge remote-tracking branch 'origin/master' into nightly
Feb 7, 2023
d385c44
Merge branch 'master' into nightly
regisb Feb 9, 2023
d247c28
Merge remote-tracking branch 'origin/master' into nightly
Feb 9, 2023
cbf4caf
Merge remote-tracking branch 'origin/master' into nightly
Feb 10, 2023
5f7188a
Merge branch 'master' into nightly
regisb Feb 10, 2023
eb4f0e9
Merge remote-tracking branch 'origin/master' into nightly
Feb 22, 2023
c669565
Merge remote-tracking branch 'origin/master' into nightly
Feb 27, 2023
7076b7c
Merge remote-tracking branch 'origin/master' into nightly
Feb 28, 2023
dcec026
feat: add init task to pip-install mounted edx-platform
kdmccormick Jan 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions changelog.d/20230111_143421_kdmc_egg_info_init_task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
Create a changelog entry for every new user-facing change. Please respect the following instructions:
- Indicate breaking changes by prepending an explosion 💥 character.
- Prefix your changes with either [Bugfix], [Improvement], [Feature], [Security], [Deprecation].
- You may optionally append "(by @<author>)" at the end of the line, where "<author>" is either one (just one)
of your GitHub username, real name or affiliated organization. These affiliations will be displayed in
the release notes for every release.
-->

- [Improvement] Before, Open edX developers needed to pip-install requirements when bind-mounting a local copy of edx-platform the first time. Now, they can just launch the bind-mounted platform instead: ``tutor ... launch --mount=edx-platform`` (by @kdmccormick).
11 changes: 6 additions & 5 deletions docs/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Setting up a development environment for edx-platform

Following the instructions :ref:`above <bind_mounts>` on how to bind-mount directories from the host above, you may mount your own `edx-platform <https://github.com/openedx/edx-platform/>`__ fork in your containers by running::

tutor dev start -d --mount=/path/to/edx-platform lms
tutor dev launch -d --mount=/path/to/edx-platform

But to achieve that, you will have to make sure that your fork works with Tutor.

Expand All @@ -211,16 +211,17 @@ Then, you should run the following commands::
# Run bash in the lms container
tutor dev run --mount=/path/to/edx-platform lms bash

# Compile local python requirements
pip install --requirement requirements/edx/development.txt

# Install nodejs packages in node_modules/
npm clean-install

# Rebuild static assets
openedx-assets build --env=dev

After running all these commands, your edx-platform repository will be ready for local development. To debug a local edx-platform repository, you can then add a `python breakpoint <https://docs.python.org/3/library/functions.html#breakpoint>`__ with ``breakpoint()`` anywhere in your code and run::
After running all these commands, your edx-platform repository will be ready for local development. Going forward, for the same copy of edx-platform, you can use ``start`` instead of ``launch`` to start the platform more quickly::

tutor dev start -d --mount=/path/to/edx/platform

To debug a local edx-platform repository, you can then add a `python breakpoint <https://docs.python.org/3/library/functions.html#breakpoint>`__ with ``breakpoint()`` anywhere in your code and run::

tutor dev start --mount=/path/to/edx-platform lms

Expand Down
2 changes: 1 addition & 1 deletion tutor/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# the nightly branch.
# The suffix is cleanly separated from the __version__ in this module to avoid
# conflicts when merging branches.
__version_suffix__ = ""
__version_suffix__ = "nightly"

# The app name will be used to define the name of the default tutor root and
# plugin directory. To avoid conflicts between multiple locally-installed
Expand Down
3 changes: 0 additions & 3 deletions tutor/templates/build/openedx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ RUN git config --global user.email "[email protected]" \
{{ patch("openedx-dockerfile-git-patches-default") }}
{%- else %}
# Patch edx-platform
# Fix broken Circuit Schematic Builder problem template
# https://github.com/openedx/edx-platform/pull/31365
RUN curl -fsSL https://github.com/openedx/edx-platform/commit/20b93b8b01276edadddfbbb67f15714fddd81c31.patch | git am
{%- endif %}

{# Example: RUN curl -fsSL https://github.com/openedx/edx-platform/commit/<GITSHA1> | git am #}
Expand Down
2 changes: 1 addition & 1 deletion tutor/templates/config/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ OPENEDX_CMS_UWSGI_WORKERS: 2
OPENEDX_LMS_UWSGI_WORKERS: 2
OPENEDX_MYSQL_DATABASE: "openedx"
OPENEDX_MYSQL_USERNAME: "openedx"
OPENEDX_COMMON_VERSION: "open-release/olive.2"
OPENEDX_COMMON_VERSION: "master"
OPENEDX_EXTRA_PIP_REQUIREMENTS:
- "openedx-scorm-xblock>=15.0.0,<16.0.0"
MYSQL_HOST: "mysql"
Expand Down
11 changes: 11 additions & 0 deletions tutor/templates/jobs/init/lms.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# When a local copy of edx-platform is bind-mounted, its
# egg-info directory may be missing or out of date. (The
# egg-info contains compiled Python entrypoint metadata, which
# is used by XBlock, Django App Plugins, and console scripts.)
# So, we regenerate egg-info by pip-installing this directory.
ENTRY_POINTS_INFO=Open_edX.egg-info/entry_points.txt
if [ ! -f "$ENTRY_POINTS_INFO" ] || [ "$ENTRY_POINTS_INFO" -ot setup.py ]; then
pip install -e .
fi
Comment on lines +6 to +9
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note:

I took this block directly from the other PR: #24

In the context of do init, here's no harm in re-running pip install -e ., other than the ~2 seconds it take to run, so we could simplify this block to just:

Suggested change
ENTRY_POINTS_INFO=Open_edX.egg-info/entry_points.txt
if [ ! -f "$ENTRY_POINTS_INFO" ] || [ "$ENTRY_POINTS_INFO" -ot setup.py ]; then
pip install -e .
fi
pip install -e .

dockerize -wait tcp://{{ MYSQL_HOST }}:{{ MYSQL_PORT }} -timeout 20s

# Wait for MongoDB.
{%- if MONGODB_HOST.startswith("mongodb+srv://") %}
echo "MongoDB is using SRV records, so we cannot wait for it to be ready"
{%- else %}
Expand All @@ -8,6 +18,7 @@ dockerize -wait tcp://{{ MONGODB_HOST }}:{{ MONGODB_PORT }} -timeout 20s

echo "Loading settings $DJANGO_SETTINGS_MODULE"

# Run migrations.
./manage.py lms migrate

# Create oauth2 apps for CMS SSO
Expand Down