Applying @edx/brand changes succesfully

Hi all,
I have been doing changes to the MFE authn via the @edx/brand package. I have created the plugin respectively and have been able to see the changes on my login page, mainly following the instructions from the following post.

The problem I’m facing is getting to update the changes from the plugin to the local and dev deployments. When running “tutor images build mfe”, the process don’t always gets the changes on the gitbhub repository. Sometime I got the following messages on the CLI

=> CACHED [authn-common 5/7] RUN npm install '@edx/brand@git+https://github.com/ib 0.0s

Which show me that they have not updated the repository and got it from the CACHE version. I have run “tutor images build mfe --no-cache” but the process taks a lot of time and I want to know if there is another better approach.

I have tried to create my local copy of the frontend-app-authn followinf the instruction from the following post and running o dev mode.

But with this approach I haven’t been able to see changes neither. When getting to the login page, all I can see is a blank page.

Finally, my goal is to personalized the login page, I have tried both approaches described above but I haven’t gotten the results expects.

Is there any other approach, step, or information I am missing?

I apprecite all your help.

Hello ibraim

If you want to change styles, you can modify them in the file located at

/frontend-app-authn/node_modules/@edx/brand/paragon/_overrides.scss

You can even change the name of the classes of some React component and from there give it the styles you want.

After making the changes you must initialize again
with:

tutor dev restart

Thanks Juan-Carlos for your help,

I’m quite new to open edx, and I haven’t been able to locate the place where _overrides.scss is.

I have forked frontend-app-authn, but there is no node_modules folder on it. Later, I run:

tutor mounts add frontend-app-authn
tutor images build mfe
tutor dev restart

But sill there is no route to node_modules

I’m sorry for my basic knowledge, can you point me in the right directions?

Thanks,

Of course ibraimIbra, first you have to clone the frontend-app-authn repo
to your local machine, and from that folder you have to do

npm install

to install the dependencies.

there the node_modules folder will be created and there you will find the folder:

/frontend-app-authn/node_modules/@edx/brand/paragon/_overrides.scss

and another thing to mount in frontend you must place the local route, for example in my case it is

tutor mounts add /home/juancarlos/Workspace/tutor/frontend-app-authn

To see if the frontend is properly mounted, check the file found in

/env/dev/docker-compose.yml

and you will see something like this in that field:

mfe:
ports:
- 1984:8002 # communications
- 2001:8002 # course-authoring
- 1994:8002 # gradebook
- 1993:8002 # ora-grading
- 1995:8002 # profile
- 2101:8002 # course-creator
authn: # Work on this MFE for development
image: “docker.io/overhangio/openedx-authn-dev:17.0.1
ports:
- “1999:1999”
stdin_open: true
tty: true
volumes:
- …/plugins/mfe/apps/mfe/webpack.dev-tutor.config.js:/openedx/app/webpack.dev-tutor.config.js:ro
- /home/juancarlos/Workspace/tutor/frontend-app-authn:/openedx/app
restart: unless-stopped
depends_on:
- lms
environment:
- “PORT=1999”

Hi @Juan-Carlos ,

Everytime I run npm install I get the following errors:

npm ERR! code 1
npm ERR! path /home/ubuntu/.local/share/openedx/frontend-app-authn/node_modules/shar
p
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-in
stall) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! /home/ubuntu/.local/share/openedx/frontend-app-authn/node_modules/tar-fs/in
dex.js:6
npm ERR! const win32 = (global.Bare?.platform || process.platform) === 'win32'
npm ERR!                            ^
npm ERR! 
npm ERR! SyntaxError: Unexpected token '.'
npm ERR!     at wrapSafe (internal/modules/cjs/loader.js:915:16)
npm ERR!     at Module._compile (internal/modules/cjs/loader.js:963:27)
npm ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:1
0)
npm ERR!     at Module.load (internal/modules/cjs/loader.js:863:32)
npm ERR!     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
npm ERR!     at Module.require (internal/modules/cjs/loader.js:887:19)
npm ERR!     at require (internal/modules/cjs/helpers.js:85:18)
npm ERR!     at Object.<anonymous> (/home/ubuntu/.local/share/openedx/frontend-app-a
uthn/node_modules/sharp/install/libvips.js:18:15)
npm ERR!     at Module._compile (internal/modules/cjs/loader.js:999:30)
npm ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:1
0)

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2024-09-24T21_07_00_229Z-debug-0.log

I think it is because I’m running tutor, and I can’t run npm command directly.

My tutor version is 18.1.3

As for the mount process, it is down correctly, the information of my docker-compose.yml file is the following:

mfe:
      ports:
          - 1997:8002 # account
          - 1984:8002 # communications
          - 2001:8002 # course-authoring
          - 2002:8002 # discussions
          - 1994:8002 # gradebook
          - 1996:8002 # learner-dashboard
          - 2000:8002 # learning
          - 1993:8002 # ora-grading
          - 1995:8002 # profile
  authn: # Work on this MFE for development
      image: "docker.io/overhangio/openedx-authn-dev:18.0.1"
      ports:
          - "1999:1999"
      stdin_open: true
      tty: true
      volumes:
          - ../plugins/mfe/apps/mfe/webpack.dev-tutor.config.js:/openedx/app/webpack
.dev-tutor.config.js:ro
          - /home/ubuntu/.local/share/openedx/frontend-app-authn:/openedx/app
      restart: unless-stopped
      depends_on:
          - lms
      environment:
          - "PORT=1999"

Finally, I can’t see the node_modules with this procedure to do the changes.

Any other idea?

Where are you running the npm install?
You have to do it from the frontend-app-authn folder

Hi Juan Carlos,

My npm version was wrong, I updated and was able to do changes on the login page with the _overrides.scss files, I can see those changes on dev, thanks for your help.

I guess my last questions, is how can I push those changes to the production instance running with local?, Do I have to do a tutor images build openedx

Thanks for your help,

brilliant

if you should do

tutor images build mfe

I did a tutor images build mfe --no-cache and it didn’t updated the login page with the changes.

Another thing I noticed, is that the changes on dev for the login page didn’t apply language configuration, all the website is in spanish, but the new login page with the changes on style is now in english.

Do I need to build openedx?

I really appreciate your help Juan Carlos, any other idea?

Hello,

I have succesfully made changes to the login page forking the frontend-app-authn MFE on tutor dev.

Now I am traying to reflect those changes on local running the tutor images build mfe command.

The process is successful and I can see from the CLI that the parameters send to docker includes my custom MFE:

tutor images build mfe
Adding /home/ubuntu/.local/share/openedx/frontend-app-authn to the build context 'authn-src' of image 'mfe'
Building image docker.io/overhangio/openedx-mfe:18.0.1-indigo
docker buildx build --tag=docker.io/overhangio/openedx-mfe:18.0.1-indigo --output=type=docker --cache-from=type=registry,ref=docker.io/overhangio/openedx-mfe:18.0.1-indigo-cache --build-context=authn-src=/home/ubuntu/.local/share/openedx/frontend-app-authn /home/ubuntu/.local/share/tutor/env/plugins/mfe/build/mfe

Even though, the changes to the login page I can see on dev are not chown on local, I keep seeing the same blue indigo page.

I have tried before doing a plugin and overriding the styles, for that changes are not shown.

Is there any other idea or solution to look up?

From our conversation, it seems you’re able to see changes in the development environment but not on your local or production setup. To clarify:

  • You’ve made changes to the authn repository by mounting it on your system.
  • You have also made changes in the brand package (styling).

If you can confirm this, I might be able to help you further in resolving the issue.

Hi @hinakhadim ,

Yes, it is correct has you said. I was able to do changes on my tutor dev start environments after mounting the repository and changing the brand package, but those changes didn’t appear in production after running tutor images build mfe --no-cache, neither when running tutor images build openedx --no-cache

I appreciate your comments,

It might be your local/production isn’t using your repository. If that’s the case, you have to verify the below steps for prod.

  1. Fork the authn repo and make changes to it what you exactly want. (that’s what you already did)
  2. Now, create a custom plugin or you can make changes to existing plugin (tutor-indigo). Add this line of code. For further info,
from tutormfe.hooks import MFE_APPS

@MFE_APPS.add()
def _add_my_mfe(mfes):
    mfes["authn"] = {
        "repository": "https://github.com/myorg/mymfe.git",  # your public/private repo link
        "port":1999,
        "version": "me/my-custom-branch-or-tag", # optional, will default to the Open edX current tag.
    }
    return mfes
  1. Run tutor config save

The above code is for using authn repository. Now, for brand package installation.

  1. In your custom or existing plugin, write the below code: For further info,
from tutor import hooks

hooks.Filters.ENV_PATCHES.add_items(
[
(
            "mfe-dockerfile-post-npm-install-authn",
            """
RUN npm install '@edx/brand@npm:@edly-io/indigo-brand-openedx@^2.1.1'  OR
RUN npm install '@edx/brand@git+https://github.com/edx/brand-edx.org.git'
""",
]

)
  1. tutor config save

Now, build the mfe image using tutor images build mfe

It worked! Thank you very much!