tutor
tutor copied to clipboard
`tutor mounts add /path-to-openedx-scorm-xblock` doesn't automatically install scorm-xblock
Bug description
Using the latest mounting command tutor mounts add /path-to-xblock
, I tried to install scorm-xblock in my tutor install. This was on a fresh install of tutor and only the default plugins were installed as well. However, tutor did not install scorm-xblock after I had mounted it using the above mentioned command and did not show up in the Advanced tab on a studio course even after I had added scorm
to the advanced settings list.
How to reproduce
On a fresh install of tutor quince 17.0, you can follow the following steps to reproduce the command.
- Clone scorm-xblock.
- Run
tutor mounts add path-to-scorm-xblock
- Run
tutor images build openedx-dev
- Run
tutor dev stop && tutor dev start -d
- Create a new course or run
tutor dev do importdemocourse
. Under Advanced Module List In the advanced settings of the course, addscorm
and save changes. Now, while adding a new unit, you should be able to see Scorm Module as an option in the advanced tab but that is not the case here.
The output of tutor mounts list
for me is:
- name: path-to/openedx-scorm-xblock
build_mounts:
- image: openedx
context: mnt-openedx-scorm-xblock
- image: openedx-dev
context: mnt-openedx-scorm-xblock
compose_mounts:
- service: openedx
container_path: /mnt/openedx-scorm-xblock
- service: openedx-dev
container_path: /mnt/openedx-scorm-xblock
The output of tutor config printvalue OPENEDX_EXTRA_PIP_REQUIREMENTS
for me is:
[]
openedx-scorm-xblock does show for me at the /mnt
path inside the LMS container.
That is also the solution I am currently utilizing which is to follow the following steps:
-
tutor dev run lms bash
-
cd /mnt
-
pip install -e ./openedx-scorm-xblock
-
exit
-
tutor dev stop && tutor dev start -d
After these steps, openedx-scorm-xblock works as intended and hot-reloading works as well as it is installed in editable mode.
Surprisingly enough, while running tutor images build openedx-dev
after adding the xblock as a mount, it seems that tutor does try to install openedx-scorm-xblock
in editable mode as can be seen in the screenshot below.
Environment
- Tutor: version 17.0.0
- Mac OS: 14.3 (23D56) Arm
- Docker: 4.26.1
I'm facing similar issue while installing cmi5 xblock for tutor quince.
Just to make sure: did you really run tutor mounts add path-to-scorm-xblock
or did you correctly replace the path to the scorm xblock on your host?
Note: I'm unable to reproduce this issue on my computer, so I'm trying to understand what might be going on.
No no, I only wrote that here as a placeholder command. I did replace the correct openedx-scorm-xblock path as the folder was correctly mounted to the /mnt
path inside the container as well.
In Open edX Dockerfile, dev and production requirements are prefixed by RUN --mount=type=cache,target=/openedx/.cache/pip,sharing=share
but that is not applied on mounted dirs installation (https://github.com/overhangio/tutor/blob/master/tutor/templates/build/openedx/Dockerfile#L273-L277). After prefixing the mounted dirs installation, the scorm xblock started to appear in pip list
. That did not work for cmi5-xblock.
However, the weird/confusing part is that when I added pip list
in Dockerfile and removed the prefix from mounted dir installation, scorm and cmi5 xblocks were still being installed and showing up in pip list
. It is only after the image build is complete and container is up when installed mounted xblocks disappear from pip list.
@regisb and I debugged this issue and the root cause for this involves how the mounts are handled.
During the build time, the mounts are copied and then installed in editable mode, thus generating egg-info (https://github.com/overhangio/tutor/blob/master/tutor/templates/build/openedx/Dockerfile#L277). This is also the reason that the installed xblocks were showing up when running pip list
during image build. But an important point, the generated egg_info is contained in that build scope and does not propagate back up to host (as the actual dir/mount is copied from layer)
However, when launching the platform (in either dev or local), the host files are mounted into containers via docker volumes (https://github.com/overhangio/tutor/blob/master/tutor/templates/local/docker-compose.yml#L169). Remember that these host directories do not contain egg_info, thus resulting in xblocks not showing up altogether when running the containers.
The egg_info containing mounts are actually present in the image, which can be seen by doing:
- Run
docker images | grep openedx
to see the name and tag of the openedx image (it would be openedx-dev, 17.0.2 if you are on latest) - Run
docker run -it openedx-dev:17.0.2 bash
. This get into bash without the volume mounts. - Go to
/mnt/<xblock>
. Runls -al
. You would see egg_info in there.
The fix for this involves either using bind mount for the xblock dirs or re-installing the mounts (if egg_info is not present) during initialization (similar thing is already being done for platform https://github.com/overhangio/tutor/blob/master/tutor/templates/jobs/init/mounted-edx-platform.sh)
That's a great explanation Dawoud. And it's very similar to that other issue that @kdmccormick faced a few months back: https://github.com/overhangio/tutor/pull/813
Now I blame myself for not thinking about this earlier...