Theme installation without building a Docker image

Hi tutor community.


Theme installation process, as documented on the indigo repo, requires building a new openedx docker image and restarting the platform. I need to be able to install, modify and customize a theme without building an image, avoiding the build time and downtime of the platform. The goal being better development experience and rather seamless theme change in a software as a service scenario.

Possible solution

As I inspected the theme installation process, I reckon I could use a docker volume mounted at the themes directory to solve this problem. The steps I took in detail are as follows:

  1. Looking at the Dockerfile at ~/.local/share/tutor/env/build/openedx/Dockerfile, the theme installation steps are:
 COPY ./themes/ /openedx/themes/
 RUN openedx-assets themes \
     && openedx-assets collect --settings=tutor.assets \
     # De-duplicate static assets with symlinks
     && rdfind -makesymlinks true -followsymlinks true /openedx/staticfiles/

I modified the docker-compose at ~/.local/share/tutor/env/local/docker-compose.yml in order to have the lms service have volume a mounted at /openedx/themes:

       SETTINGS: ${TUTOR_EDX_PLATFORM_SETTINGS:-tutor.production}
     restart: unless-stopped
       - ../apps/openedx/settings/lms/:/openedx/edx-platform/lms/envs/tutor/:ro
       - ../apps/openedx/settings/cms/:/openedx/edx-platform/cms/envs/tutor/:ro
       - ../apps/openedx/config/:/openedx/config/:ro
       - ../../data/lms:/openedx/data
       - ../../data/openedx-media:/openedx/media
       # My theme volume
       - ../themes_volume:/openedx/themes
       - mysql
       - elasticsearch
       - forum
       - mongodb
       - redis
       - smtp
  1. Having access to the theme directory on the lms container, I copied the rendered theme to the volume and ran the steps from Dockerfile manually:
$ tutor config render --extra-config ~/indigo/config.yml ~/indigo/theme/ "$(tutor config printroot)/env/build/openedx/themes/indigo"
$ cp -r ~/.local/share/tutor/env/build/openedx/themes/indigo ~/.local/share/tutor/env/themes_volume 

Now that the rendered theme is in place:

$ tutor local run lms openedx-assets themes
$ tutor local run lms openedx-assets collect
$ tutor local run lms rdfind -makesymlinks true -followsymlinks true /openedx/staticfiles/

Which are run successfully.

  1. Finally, set the theme using the settheme command:
$ tutor local settheme indigo $(tutor config printvalue LMS_HOST) $(tutor config printvalue CMS_HOST)


The result is flaky. I executed the process several times. I got the theme deployed successfully at times, but mostly the process resulted in a broken theme deployment:

I’d appreciate any ideas or help from anyone who’s gone down this road.

Update: I’m aware that I’m running the tutor local run lms openedx-assets collect without the --settings=tutor.assets. The command uses tutor.production Django settings, according to it’s output. The container does not have access to the tutor.assets module, but I doubt that this would be the problem because the command collects the static files successfully.


I have the same issue. anyone?

1 Like

Update 2: I tried with --settings=tutor.assets and still, same results.
@andres @cacciaresi @regis
I did some digging and found this discussion you guys had over the same issue. What I’m trying to do is rather similar to @cacciaresi 's idea.
Do you guys see the problem with my approach?
Thanks in advance.

There are two topics which are especially complex in Open edX. One of those is compiling static assets. (the other one is settings)

While I admire your courage in trying to figure out an alternative solution, I will forward you to the best solution which I found: Open edX development — Tutor documentation
If you follow these instructions, you will realize that you do not need to rebuild the openedx Docker image when you hack on your custom theme. This is the actual method that I used when I created the Indigo theme.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.