Skip to content

Commit

Permalink
feat: add init task to pip-install mounted edx-platform
Browse files Browse the repository at this point in the history
  • Loading branch information
kdmccormick committed Mar 10, 2023
1 parent 7076b7c commit dcec026
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
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
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
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

0 comments on commit dcec026

Please sign in to comment.