How to modify edx-platform content in tutor

Hello

I have migrated from native to tutor but nothing appear to be normal

I have tried to use tutor local run lms bash
to modify and edit video_xfields.py
but it did not work!

I got an error and the whole thing changed back to default

Command failed with status 1: docker-compose -f /root/.local/share/tutor/env/local/docker-compose.yml -f /root/.local/share/tutor/env/local/docker-compose.prod.yml -f /root/.local/share/tutor/env/local/docker-compose.tmp.yml --project-name tutor_local run --rm lms bash

Tutor is based on Docker images, which means that each time you run the LMS or any other component, it will run the latest image. When you run tutor local run lms bash, it creates a temporary container using the image, which is completely separate from any other container that’s running the LMS. Whatever changes you make in this ‘bash’ container will be lost as soon as you exit the bash shell, because you’re not modifying the image itself, just the temporary container filesystem which was based on that image.

If you want to make changes to edx-platform, you should run tutor in dev mode and use bind mounts to share the edx-platform directory from your host with tutor. For example:

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

and then when you can open edx-platform on your host computer, and when you make changes, you should see that it automatically reloads and you can test the new changes. Review the documentation for more details and examples.

If you are trying to make changes to deploy in production, the process is different: you need to configure tutor to use your customized version of edx-platform, and then use the tutor images build command to build the images that you want to deploy in production.

Thanks @braden for this additional context. I’m getting started with using tutor locally on my macbook for development and am seeing unexpected results when i try to follow tutor’s mount instructions.

I was expecting that the following commands …

tutor dev copyfrom lms /openedx/venv ~
mv ~/venv ~/venv-openedx
tutor dev start -d --mount=lms,lms-worker,lms-job,cms,cms-worker,cms-job:~/venv-openedx:/openedx/venv lms

would result in the following:

  1. Create a copy of the original openedx virtual environment
  2. Restart the dev environment, mounting the copy of the virtual environment to /openedx/venv/

However, the following simple test suggests that the mount is not working.


The file that i touched in the copy of the virtual environment is not visible from inside of the bash container. Taking into consideration your comments above, shouldn’t the bash container also include the mounted copy of the virtual environment, and thus shouldn’t it also show the touched test file?

I find it easier to mount volumes via the override.yaml, you can take a look at the guide here: Open edX development — Tutor documentation

Thank you all

You are correct, as far as I understand. The only part where I’m a little fuzzy is whether the dev containers are actually restarted, or you need to manually stop them prior to running the start -d --mount=... command. There should be some information about this in the docker compose logs, in the form of “Restarting container …”.

Also, Tutor should print the bind-mounted volumes, in the form of “Bind-mount: {host_path} → {container_path} in {service}”.

Finally, you can verify which volumes are mounted by running: docker inspect <container id>>.

1 Like