Help developing on xblock (edx-ora2) in Tutor

I’m working on BB-9938, which requires developing on the edx-ora2 codebase. However, I’m struggling to figure it out with Tutor. edx-ora2 has instructions for developing with the docker devstack, but I can’t find any guide for working with a Tutor devstack.

What I’ve tried so far is along the lines of:

  1. set up a Tutor master devstack
  2. git clone git@github.com:openedx/edx-ora2
  3. tutor mounts add ./edx-ora2
  4. Rebuild the openedx-dev image with tutor and launch the devstack.

This all works fine, and I can immediately see changes I make to the edx-ora2 python code.

However, the difficulty begins when I want to edit the javascript…

I tried installing dependencies and building on my host machine (my workstation), but even with the expected python and node versions, I’m hitting errors building the bundle:

ERROR in ./node_modules/@openedx/paragon/dist/Card/fallback-default.png
Module build failed (from ./node_modules/image-webpack-loader/index.js):
Error: spawn /home/samuel/proj/opencraft/devstack-master/edx-ora2/node_modules/optipng-bin/vendor/optipng ENOENT

Then I tried from within the lms docker container:

host $ tutor dev exec lms bash

lms $ cd /mnt/edx-ora2
lms $ make install

This succeeds, but then the lms fails to run, with the following error:

lms-1          | xmlsec.InternalError: (-1, 'lxml & xmlsec libxml2 library version mismatch')

Next I’ll try only installing the javascript dependencies in the container and see how that goes. But it all feels a little messy, and that still leaves the question of where/how should I run the various tests.

Does anyone have any recommendations? I’m interested to hear your workflows. :slight_smile:

It might be worth contributing back to the edx-ora2 developer guide with updated instructions for Tutor devstacks too. :slight_smile:

So far I’ve got things working by managing the bundle with npm from within the lms container. My working notes:

To rebuild the frontend js bundle, run this from inside the lms container shell:

cd /mnt/edx-ora2
npm run build

Troubleshooting

If you see “Loading” in the student view, and “Uncaught TypeError: can’t access property “prototype”, initFn is undefined” in the console,
then you need to manually install the node dependencies and rebuild the bundle:

In the lms container shell:

cd /mnt/edx-ora2/
npm install
npm run build

Not sure why sometimes this isn’t auto-built…


If you get a 404 error for the js bundle after rebuilding the bundle,
then you may need to stop and restart the lms container so it picks up the changes from the manifest.json file
(I’m not sure if this is correct, but it does fix the problem):

tutor dev stop lms
tutor dev start lms -d

@samuel Can you try doing npm run postinstall after the build and see if you still need a restart. Also, there is a watch option as well.

I’m not sure what you’re referring to - there’s no postinstall script for edx-ora2.

Ah is there a way to work with the frontend js for ora2 in some dev server mode with the devstack?I’m not sure how that would work, because it’s all files integrated into the LMS.

Try

pip install -e /mnt/edx-ora2

instead. That works for me when working with edx-ora2.

1 Like

@samuel would you consider making a PR to the ora2 README with tutor instructions? Surely you’re not the only one hitting this problem :slight_smile: feel free to tag me.

1 Like

Sure, I can do that. :+1: :grin: I’m not sure if I can do that within the scope of this ticket (BB-9938) or if there’s budget somewhere for a new ticket though.

@samuel Would it fit into your onboarding budget?

Unfortunately I don’t think so. The remaining budget is a little tight now. :confused: