diff --git a/changelog.d/20230111_143421_kdmc_egg_info_init_task.md b/changelog.d/20230111_143421_kdmc_egg_info_init_task.md new file mode 100644 index 00000000000..69f31299091 --- /dev/null +++ b/changelog.d/20230111_143421_kdmc_egg_info_init_task.md @@ -0,0 +1,10 @@ + + +- [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). diff --git a/docs/dev.rst b/docs/dev.rst index 4ff7c933a66..05950882107 100644 --- a/docs/dev.rst +++ b/docs/dev.rst @@ -200,7 +200,7 @@ Setting up a development environment for edx-platform Following the instructions :ref:`above ` on how to bind-mount directories from the host above, you may mount your own `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. @@ -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 `__ 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 `__ with ``breakpoint()`` anywhere in your code and run:: tutor dev start --mount=/path/to/edx-platform lms diff --git a/tutor/templates/jobs/init/lms.sh b/tutor/templates/jobs/init/lms.sh index 88c94625c54..12e57bb7b0d 100644 --- a/tutor/templates/jobs/init/lms.sh +++ b/tutor/templates/jobs/init/lms.sh @@ -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 %} @@ -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