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: use entrypoint to automatically pip-install mounted edx-platform #24

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions changelog.d/20230111_135800_kdmc_egg_info_entrypoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--
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.
-->

<!-- - 💥[Feature] Foobarize the blorginator. This breaks plugins by renaming the `FOO_DO` filter to `BAR_DO`. (by @regisb) -->
<!-- - [Improvement] This is a non-breaking change. Life is good. (by @billgates) -->

- [Improvement] It is no longer necessary to pip-install any requirements after bind-mounting a local copy of edx-platform (by @kdmccormick).
3 changes: 0 additions & 3 deletions docs/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ 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

Expand Down
1 change: 1 addition & 0 deletions tutor/templates/build/openedx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ ENV DJANGO_SETTINGS_MODULE lms.envs.tutor.production
{{ patch("openedx-dockerfile") }}

EXPOSE 8000
ENTRYPOINT ["set-up-and-run"]

###### Intermediate image with dev/test dependencies
FROM production as development
Expand Down
22 changes: 22 additions & 0 deletions tutor/templates/build/openedx/bin/set-up-and-run
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
# Entrypoint script for the openedx image.
# When a command is run from the openedx image, e.g.:
# tutor local run lms ./manage.py lms migrate
# It actually goes through this script:
# set-up-and-run ./manage.py lms migrate

# 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.
# To avoid running pip-install from *every* new lms and cms
# container, we only run it if the entrypoint metadata is missing
# or outdated.
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

# Run all arguments as a command.
"$@"