aulasneo / tutor-contrib-branding

GNU Affero General Public License v3.0
7 stars 5 forks source link

tutor commands stop working upon enabling the plugin, returning Error: Project root does not exist #3

Open OAburub opened 1 week ago

OAburub commented 1 week ago

I ran pip install tutor-contrib-branding which installed version 18.6.0 I then ran tutor plugins enable branding which returned the following:

Plugin branding enabled
Configuration saved to /home/x/.local/share/tutor/config.yml
Error applying filter: func=<function _add_my_mfe at 0x7e7fdda868e0> contexts=['plugins', 'app:branding']'
Error rendering patch 'openedx-cms-development-settings':
# MFE-specific settings
{% if get_mfe("course-authoring") %}
COURSE_AUTHORING_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ get_mfe('course-authoring')["port"] }}/course-authoring"
CORS_ORIGIN_WHITELIST.append("http://{{ MFE_HOST }}:{{ get_mfe('course-authoring')["port"] }}")
LOGIN_REDIRECT_WHITELIST.append("{{ MFE_HOST }}:{{ get_mfe('course-authoring')["port"] }}")
CSRF_TRUSTED_ORIGINS.append("http://{{ MFE_HOST }}:{{ get_mfe('course-authoring')["port"] }}")
{% endif %}

Error rendering template apps/openedx/settings/cms/development.py
Error: Project root does not exist. Make sure to generate the initial configuration with `tutor config save --interactive` or `tutor local launch` prior to running other commands.

Then every other tutor command, including the command to disable the plugin, stopped working, returning the following:

Error applying filter: func=<function _add_my_mfe at 0x75f0f5eceac0> contexts=['plugins', 'app:branding']'
Error applying action: func=<function _mounted_mfe_image_management at 0x75f0f5efe660> contexts=['plugins', 'app:mfe']'
Error applying action: func=<function _enable_plugins at 0x75f0f60823e0> contexts=[]'
Error: Project root does not exist. Make sure to generate the initial configuration with `tutor config save --interactive` or `tutor local launch` prior to running other commands.

only by uninstalling the plugin from pip did tutor commands work again. I am running the latest version of tutor (18.1.3)

angonz commented 1 week ago

Hi @OAburub, I was unable to reproduce the error. Pleas send the output of

OAburub commented 1 week ago

tutor plugins list:

android         installed       18.0.0
cairn           installed       18.0.0
credentials     installed       18.0.0
discovery       ✅ enabled       18.0.0
ecommerce       ✅ enabled       18.0.0
edscore         installed       18.0.5
forum           installed       18.1.1
indigo          ✅ enabled       18.1.1
jupyter         installed       18.1.0
mfe             ✅ enabled       18.0.1
minio           installed       18.0.0
myplugin        installed       /home/x/.local/share/tutor-plugins/myplugin.py
notes           installed       18.0.0
plugin          installed       /home/x/.local/share/tutor-plugins/plugin.py
webui           ✅ enabled       18.0.0
xqueue          installed       18.0.0

(branding does not appear because I uninstalled it)

tutor config printroot: /home/x/.local/share/tutor

tutor plugins printroot: /home/x/.local/share/tutor-plugins

pip freeze | grep tutor:

error: subprocess-exited-with-error

× git rev-parse HEAD did not run successfully.
│ exit code: 128
╰─> [2 lines of output]
    HEAD
    fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
    Use '--' to separate paths from revisions, like this:
    'git <command> [<revision>...] -- [<file>...]'
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
WARNING: Error when trying to get requirement for VCS system git rev-parse HEAD exited with 128
WARNING: Could not determine repository location of /home/x/tutor-contrib-edscore
tutor==18.1.3
tutor-android==18.0.0
tutor-cairn==18.0.0
-e /home/x/tutor-contrib-edscore
tutor-credentials==18.0.0
tutor-discovery==18.0.0
-e git+https://github.com/overhangio/tutor-ecommerce@057b1bac7f6544b260db9fed58212c3688fb86af#egg=tutor_ecommerce
tutor-forum==18.1.1
tutor-indigo==18.1.1
tutor-jupyter==18.1.0
tutor-mfe==18.0.1
tutor-minio==18.0.0
tutor-notes==18.0.0
tutor-webui==18.0.0
tutor-xqueue==18.0.0

I don't know what parts of config.yml would be relevant, but I do use a custom edx-platform repo, and a python venv if it matters

angonz commented 1 week ago

I tried with the same plugins as you and still can save successfully. Please send me all your branding settings (everything in your config.yml starting with BRANDING_).

OAburub commented 1 week ago

I have none. I did not configure any lines with BRANDING_ before enabling the plugin This is strange to say the least..

wiesener commented 1 week ago

Same for me

wiesener commented 1 week ago

here ist mine:

CMS_HOST: studio.local.edly.io
CMS_OAUTH2_SECRET: UCBFLM8G3hsdCtqEZpoEKW7i
CONTACT_EMAIL: contact@local.edly.io
ENABLE_HTTPS: false
ID: a2YqthNevTMEvyYW0d21kffY
JWT_RSA_PRIVATE_KEY: '-----BEGIN RSA PRIVATE KEY-----

  MIIEpAIBAAKCAQEA7iSvtbveN2dg1lFWJ58ZwE4sfHWvq/QqicWsWGcTJpyX+8Lv

  ATaOiGcUGR2IFtSAdWuL4Bq6su7fTHWQhAkyJ2M7O6VG6prN6gbUBxTCu1nhIliJ

  JWcg2a8ffjmCRKqm4rCo+iqfDUMnZ1PNztnIXgrcN0Gp1vyZosAeE8zkaYlh5YQF

  4wb6fAK28G96EmWYdEcO7lvujioJIzPqjXshtMqnJdL2raBP50ee7bWJ2LxIsTHl

  sBNnefUzmM8bPHb4neSPYHYwPSZSEtsjESb/GFDg/BHdOXdY6+k2GnPdW+4THnol

  zY5ZxJfOGFnZY2+jD/KIJEm0fXYK0MKuUjcftQIDAQABAoIBACLprfjuuf1VYpUJ

  B6B3ascOrubwOfjzqujX2hR7yAr5Gi8GvRNodCz7L68e7TyrmsmcIr2QLZ7d9k63

  TaCN2JR9r8lmyabLWzTcG2mOWZ4t5xup7zFUlTRUwEE5HSgD/MNvMta6OOcw2S4E

  0z9oHj/rR62yKrwh/EQn9kDg4Pu3qARmSKxo19SgiRZaCRUP6gMDoaqW5UQ2ct+t

  M3JQr0uMGcbWMQHJpuLVCX9AjdGVowF7kfwOvSIsrKt0mOHTzt6RQl4u0d9HJXdt

  207s9LgaqzOXlx4egCaey6LfXUHKyjJaBMxd3K68PPKVGBdNE2NRY1dLzJJ/N4C8

  sLIaKgECgYEA9UBuyLQZIs5BVttIZOje9cvSMmZ0sepTseQLravf9c54KNX3H3NB

  sfMDfXAKITuxWM48GjavvSYalj+IlTUr51fufGNuWX023L7hPjVgGnoyVYNZYXfh

  gxj/p2nUzhnpISTj2KvarpOBMwTOZ5G9Sm+1rb6+V9Jv3ZzbakA/CdECgYEA+JSA

  iMglyhqrDgwd7prl8M7jJsGnS0PRdmraI73mKM2BdX6Ka18suHqpsNSVGvfBRqoV

  45IYmlEI5nUqRXv6Q000gP3aAkjBE72c4pl6fHZ9GQ2kX+TRxzFeTnxRd6xh/OwL

  xdIftfCw1RYMVSOfuuFWCo022WjYS3japssgDKUCgYEAtG310xSklXW2nkbvaMXm

  GmEcQFYeLjJd5rcGXHvhZb7Dqg9YIrwxrdBCVguSeEapP9NiZkqrWfXpg3Y0bslS

  hn2rh7nDGnVDYn3PymuMS45w73aV0F5Y+5DtrOXwWLy5RdgVBHfSh7MfT0CO9aVD

  5Lpwp+V3tbas9BaNWgrwFbECgYEAozJLmIFeXetYNea6l/XV1FzfQIiO3pjtoYLR

  J/n6avtQbOTg11EquQq+8Tr/kS7rEwuDR16ZDGb7IuH1GJ0mVp0PRUhjonBFYkJw

  B0yf36qiwpn0OoitOMsukPSJP7pKspP9vqgO7ZHRZnQNMLAso7JgnJjNU7rDlfkI

  A80Dg4kCgYAcrEyGTRCh2/hVtPgUn3xS1mw0+hNdxNJ6vjtQdHuNxoxbMeyg9dPP

  ynln0VoQqcLiNE8nB4BEKv6ZIAvnpH/zP1+Knd2GnwRhoWfZOVbyZQR7BoGU9aWs

  jf4QTWQ/WgONmqsGqH26Js0sODayy9Sp8ykY8a+DgoLWAxYm/gs/Dg==

  -----END RSA PRIVATE KEY-----'
LANGUAGE_CODE: en
LMS_HOST: local.edly.io
MYSQL_ROOT_PASSWORD: xrnBykJ7
OPENEDX_MYSQL_PASSWORD: ZFDLLXko
OPENEDX_SECRET_KEY: ERVyw1wy2toh00ZBgbh9qKSM
PLATFORM_NAME: test edX
PLUGINS:
- branding
- indigo
- mfe
PLUGIN_INDEXES:
- https://overhang.io/tutor/main

When I uninstall branding the tutor instance is running fine (locally) and I can switch the themes without problem. But as soon as I install it (locally) I am getting the same error as OAburub.

wiesener commented 1 week ago

Okay now somehow the plugin shows up enabled:

NAME STATUS VERSION android installed 18.0.0 branding ✅ enabled 18.6.0 cairn installed 18.0.0 credentials installed 18.0.0 discovery installed 18.0.0 ecommerce installed 18.0.0 forum installed 18.1.1 indigo ✅ enabled 18.2.1 jupyter installed 18.1.0 mfe ✅ enabled 18.0.1 minio installed 18.0.0 notes installed 18.0.0 webui installed 18.0.0 xqueue installed 18.0.0

But I cannot select it with

tutor branding this gives an error:

xxx@xxx tutor % tutor branding -h
Usage: tutor [OPTIONS] COMMAND [ARGS]...

Error: No such command 'branding'.
wiesener commented 1 week ago

Okay if I explicitly install pip install tutor-contrib-branding==18.0.0 it seems to work. I guess then there is something wrong in the pip and requirements.txt

wiesener commented 1 week ago

Okay and somehow later it crashed during build mfe

Furthermore, I guess an issue is that branding is not in the index of https://overhang.io/tutor/main/redwood/plugins.yml

angonz commented 1 week ago

I discovered this is because you are running your tutor commands in a different directory than config.yml. I'm refactoring the plugin to support this more general case.

wiesener commented 1 week ago

Yes I can confirm this. I guess that it worked before was then a random cirumstance and I was maybe in the config folder.

wiesener commented 1 week ago

Okay now somehow the plugin shows up enabled:

NAME STATUS VERSION android installed 18.0.0 branding ✅ enabled 18.6.0 cairn installed 18.0.0 credentials installed 18.0.0 discovery installed 18.0.0 ecommerce installed 18.0.0 forum installed 18.1.1 indigo ✅ enabled 18.2.1 jupyter installed 18.1.0 mfe ✅ enabled 18.0.1 minio installed 18.0.0 notes installed 18.0.0 webui installed 18.0.0 xqueue installed 18.0.0

But I cannot select it with

tutor branding this gives an error:

xxx@xxx tutor % tutor branding -h
Usage: tutor [OPTIONS] COMMAND [ARGS]...

Error: No such command 'branding'.

Okay I've tested all versions and only with the 18.6.0 it seems not to be detected by tutor plugins.

wiesener commented 1 week ago

If I run the following command tutor images build mfe i am getting:

14.10 npm WARN deprecated domexception@4.0.0: Use your platform's native DOMException instead
20.23 npm WARN deprecated react-scrollspy@3.4.3: No longer actively maintained. Please use @makotot/ghostui instead.
34.52 npm notice 
34.52 npm notice New minor version of npm available! 10.2.3 -> 10.9.0
34.52 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.9.0>
34.52 npm notice Run `npm install -g npm@10.9.0` to update!
34.52 npm notice 
34.52 npm ERR! code ECONNRESET
34.52 npm ERR! network Client network socket disconnected before secure TLS connection was established
34.52 npm ERR! network This is a problem related to network connectivity.
34.52 npm ERR! network In most cases you are behind a proxy or have bad network settings.
34.52 npm ERR! network 
34.52 npm ERR! network If you are behind a proxy, please make sure that the
34.52 npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
34.55 
34.55 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-10-18T18_41_43_449Z-debug-0.log
------
Dockerfile:93
--------------------
  91 |     RUN mkdir /openedx/brand-openedx
  92 |     COPY ./brand-openedx /openedx/brand-openedx
  93 | >>> RUN npm install '@edx/brand@file:/openedx/brand-openedx'
  94 |     
  95 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c npm install '@edx/brand@file:/openedx/brand-openedx'" did not complete successfully: exit code: 1
Error: Command failed with status 1: 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 /Users/xxx/Library/Application Support/tutor/env/plugins/mfe/build/mfe
angonz commented 3 days ago

Please try version 18.6.1 (Redwood) or 17.6.1 (Quince) and let me know if this fixes the issue.

OAburub commented 2 days ago

After installing the new version, the error where the project root does not exist seems to have gone away!

another error appears, however:

>tutor plugins enable branding
Plugin branding enabled
Configuration saved to /home/x/.local/share/tutor/config.yml
Error applying filter: func=<function _add_my_mfe at 0x7744b228a8e0> contexts=['plugins', 'app:branding']'
Unknown error rendering template apps/openedx/settings/cms/development.py
Traceback (most recent call last):
  File "/home/x/.venv/bin/tutor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/commands/cli.py", line 27, in main
    cli()  # pylint: disable=no-value-for-parameter
    ^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/commands/plugins.py", line 145, in enable
    context.invoke(config_save_command, env_only=True)
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/commands/config.py", line 189, in save
    env.save(context.root, config)
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 335, in save
    save_all_from(src, os.path.join(root_env, dst), config)
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 353, in save_all_from
    renderer.render_all_to(dst, prefix.replace(os.sep, "/"))
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 220, in render_all_to
    rendered = self.render_template(template_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 207, in render_template
    return self.__render(template)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 226, in __render
    return template.render(**self.config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/home/x/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/templates/apps/openedx/settings/cms/development.py", line 23, in top-level template code
    {{ patch("openedx-cms-development-settings") }}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 173, in patch
    patches.append(self.render_str(patch))
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 187, in render_str
    return self.__render(template)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 226, in __render
    return template.render(**self.config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/home/x/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 2, in top-level template code
  File "/home/x/.venv/lib/python3.12/site-packages/tutormfe/plugin.py", line 115, in get_mfe
    return get_mfes().get(mfe_name, {})
           ^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutormfe/plugin.py", line 90, in get_mfes
    return MFE_APPS.apply({})
           ^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/core/hooks/filters.py", line 128, in apply
    return self.apply_from_context(None, value, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/core/hooks/filters.py", line 145, in apply_from_context
    value = callback.apply(
            ^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/core/hooks/filters.py", line 35, in apply
    return self.func(value, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutorbranding/plugin.py", line 137, in _add_my_mfe
    configuration = tutor_config.load(root)
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/config.py", line 21, in load
    if not os.path.exists(config_path(root)):
                          ^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/config.py", line 281, in config_path
    return os.path.join(root, CONFIG_FILENAME)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 76, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType

Is this a related issue or separate? if it's separate, I suppose closing this and I will open another upon confirmation.

OAburub commented 2 days ago

when testing, the solution I propose in #5 seems to fix this error

UPDATE: Nevermind, that solution only works for the current session and fails after restarting the shell once.

wiesener commented 2 days ago

After installing the new version, the error where the project root does not exist seems to have gone away!

another error appears, however:

>tutor plugins enable branding
Plugin branding enabled
Configuration saved to /home/x/.local/share/tutor/config.yml
Error applying filter: func=<function _add_my_mfe at 0x7744b228a8e0> contexts=['plugins', 'app:branding']'
Unknown error rendering template apps/openedx/settings/cms/development.py
Traceback (most recent call last):
  File "/home/x/.venv/bin/tutor", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/commands/cli.py", line 27, in main
    cli()  # pylint: disable=no-value-for-parameter
    ^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/commands/plugins.py", line 145, in enable
    context.invoke(config_save_command, env_only=True)
  File "/home/x/.venv/lib/python3.12/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/click/decorators.py", line 45, in new_func
    return f(get_current_context().obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/commands/config.py", line 189, in save
    env.save(context.root, config)
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 335, in save
    save_all_from(src, os.path.join(root_env, dst), config)
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 353, in save_all_from
    renderer.render_all_to(dst, prefix.replace(os.sep, "/"))
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 220, in render_all_to
    rendered = self.render_template(template_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 207, in render_template
    return self.__render(template)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 226, in __render
    return template.render(**self.config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/home/x/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/templates/apps/openedx/settings/cms/development.py", line 23, in top-level template code
    {{ patch("openedx-cms-development-settings") }}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 173, in patch
    patches.append(self.render_str(patch))
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 187, in render_str
    return self.__render(template)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/env.py", line 226, in __render
    return template.render(**self.config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 1304, in render
    self.environment.handle_exception()
  File "/home/x/.venv/lib/python3.12/site-packages/jinja2/environment.py", line 939, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 2, in top-level template code
  File "/home/x/.venv/lib/python3.12/site-packages/tutormfe/plugin.py", line 115, in get_mfe
    return get_mfes().get(mfe_name, {})
           ^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutormfe/plugin.py", line 90, in get_mfes
    return MFE_APPS.apply({})
           ^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/core/hooks/filters.py", line 128, in apply
    return self.apply_from_context(None, value, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/core/hooks/filters.py", line 145, in apply_from_context
    value = callback.apply(
            ^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/core/hooks/filters.py", line 35, in apply
    return self.func(value, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutorbranding/plugin.py", line 137, in _add_my_mfe
    configuration = tutor_config.load(root)
                    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/config.py", line 21, in load
    if not os.path.exists(config_path(root)):
                          ^^^^^^^^^^^^^^^^^
  File "/home/x/.venv/lib/python3.12/site-packages/tutor/config.py", line 281, in config_path
    return os.path.join(root, CONFIG_FILENAME)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 76, in join
TypeError: expected str, bytes or os.PathLike object, not NoneType

Is this a related issue or separate? if it's separate, I suppose closing this and I will open another upon confirmation.

I am getting the same error. So not fixed so far.

angonz commented 1 day ago

I've fixed that in 17.6.2 / 18.6.2. Please check again and let me know.

wiesener commented 14 hours ago

Okay this bug is gone but now still the plugin looks enables but the commands are not active.

NAME        STATUS      VERSION
android     installed   18.0.0
branding    ✅ enabled   18.6.2
cairn       installed   18.0.0
credentials installed   18.0.0
discovery   installed   18.0.0
ecommerce   installed   18.0.0
forum       installed   18.1.1
indigo      ✅ enabled   18.2.1
jupyter     installed   18.1.0
mfe         ✅ enabled   18.0.1
minio       installed   18.0.0
notes       installed   18.0.0
webui       installed   18.0.0
xqueue      installed   18.0.0

But still:

xxx@xxx  tutor branding download-images
Usage: tutor [OPTIONS] COMMAND [ARGS]...

Error: No such command 'branding'.
angonz commented 14 hours ago

Yes! download-images has been deprecated and is not needed anymore. Images are downloaded during tutor image build openedx

wiesener commented 14 hours ago

Okay,

I've tried it and got until this point:

=> ERROR [production 36/39] RUN npm run compile-sass -- --skip-default                                                                        0.5s
------
 > [production 36/39] RUN npm run compile-sass -- --skip-default:
0.394 
0.394 > edx@0.1.0 compile-sass
0.394 > scripts/compile_sass.py --env=${NODE_ENV:-production} --skip-default
0.394 
0.438 USING ENV: production
0.438 
0.438 
0.439 Compiling Sass for theme at /openedx/themes/theme...
0.439   Compiling default LMS Sass with themed partials...
0.439     Source: lms/static/sass
0.439     Target: /openedx/themes/theme/lms/static/css
0.439     Include paths:
0.439       common/static
0.439       common/static/sass
0.439       node_modules/@edx
0.439       node_modules
0.439       /openedx/themes/theme/lms/static/sass/partials
0.439       lms/static/sass/partials
0.439       lms/static/sass
0.439     Files:
0.439       lms/static/sass/lms-course-rtl.scss -> /openedx/themes/theme/lms/static/css/lms-course-rtl.css
0.505 Traceback (most recent call last):
0.505   File "/openedx/edx-platform/scripts/compile_sass.py", line 503, in <module>
0.506     main(prog_name="npm run compile-sass --")
0.506   File "/openedx/venv/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
0.506     return self.main(*args, **kwargs)
0.506            ^^^^^^^^^^^^^^^^^^^^^^^^^^
0.506   File "/openedx/venv/lib/python3.11/site-packages/click/core.py", line 1078, in main
0.506     rv = self.invoke(ctx)
0.506          ^^^^^^^^^^^^^^^^
0.506   File "/openedx/venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
0.506     return ctx.invoke(self.callback, **ctx.params)
0.506            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.506   File "/openedx/venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke
0.507     return __callback(*args, **kwargs)
0.507            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.507   File "/openedx/venv/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
0.507     return f(get_current_context(), *args, **kwargs)
0.507            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.507   File "/openedx/edx-platform/scripts/compile_sass.py", line 397, in main
0.507     compile_sass_dir(
0.507   File "/openedx/edx-platform/scripts/compile_sass.py", line 252, in compile_sass_dir
0.507     raise Exception(f"Failed to compile {source}: {output_text}")
0.507 Exception: Failed to compile lms/static/sass/lms-course-rtl.scss: Error: argument `$color` of `darken($color, $amount)` must be a color
0.507 
0.507        Backtrace:
0.507           node_modules/bootstrap/scss/_variables.scss:152, in function `darken`
0.507           node_modules/bootstrap/scss/_variables.scss:152
0.507         on line 152 of node_modules/bootstrap/scss/_variables.scss
0.507 >> $link-hover-color:          darken($link-color, 15%) !default;
0.507    ----------------------------^
0.507 
------
Dockerfile:220
--------------------
 218 |     # Now that the default theme is built, build any custom themes
 219 |     COPY --chown=app:app ./themes/ /openedx/themes
 220 | >>> RUN npm run compile-sass -- --skip-default
 221 |     
 222 |     # and finally, collect assets for the production image,
--------------------
ERROR: failed to solve: process "/bin/sh -c npm run compile-sass -- --skip-default" did not complete successfully: exit code: 1
Error: Command failed with status 1: docker buildx build --tag=docker.io/overhangio/openedx:18.1.3-indigo --output=type=docker --cache-from=type=registry,ref=docker.io/overhangio/openedx:18.1.3-indigo-cache /Users/xxx/Library/Application Support/tutor/env/build/openedx

My config looks like this:

BRANDING_ACCENT_A: #00BBF9
BRANDING_ACCENT_B: #FFEE88
BRANDING_BACKGROUND: #ffffff
BRANDING_BG_PRIMARY: #ffffff
BRANDING_BODY: #FFFFFF
BRANDING_BRAND: #9D0054
BRANDING_DANGER: #C32D3A
BRANDING_DARK: #273F2F
BRANDING_FONTS_URLS:
- https://fonts.google.com/download?family=Roboto%20Flex
BRANDING_FONT_FAMILY: Roboto Flex
BRANDING_HOMEPAGE_BG_IMAGE: ""
BRANDING_INFO: #006DAA
BRANDING_LIGHT: #E1DDDB
BRANDING_PRIMARY: #0000FF
BRANDING_SECONDARY: #454545
BRANDING_SUCCESS: #178253
BRANDING_WARNING: #FFD900
CMS_HOST: studio.local.edly.io
CMS_OAUTH2_SECRET: xxx
CONTACT_EMAIL: contact@local.edly.io
ENABLE_HTTPS: false
ID: d6yCxRxEjzbk9MNMrDhO0HKJ
JWT_RSA_PRIVATE_KEY: '
...
  -----END RSA PRIVATE KEY-----'
LANGUAGE_CODE: en
LMS_HOST: local.edly.io
MYSQL_ROOT_PASSWORD: x49UV07H
OPENEDX_MYSQL_PASSWORD: F5Y6vzm2
OPENEDX_SECRET_KEY: xxx
PLATFORM_NAME: My Open edX
PLUGINS:
- branding
- indigo
- mfe
PLUGIN_INDEXES:
- https://overhang.io/tutor/main