Skip to content

Commit

Permalink
feat: upgrade to maple
Browse files Browse the repository at this point in the history
- Previously, it was not possible to make the MFEs use the themed logo from the
  LMS. This changed when this PR was merged:
  https://github.com/edx/edx-platform/pull/29503 In Maple, the
  /theming/asset/images/logo.png url now redirects to the themed logo. Close #25.

- We disable New Relic globally by upgrading frontend-build for some packages.
  Close openedx/wg-frontend/issues/14
  • Loading branch information
regisb committed Dec 14, 2021
1 parent 6945f2c commit 4c018bb
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ In addition, this plugin comes with a few MFEs which are enabled by default:

- `Account <https://github.com/edx/frontend-app-account/>`__
- `Gradebook <https://github.com/edx/frontend-app-gradebook/>`__
- `Gradebook <https://github.com/edx/frontend-app-learning/>`__
- `Learning <https://github.com/edx/frontend-app-learning/>`__
- `Profile <https://github.com/edx/frontend-app-profile/>`__

Instructions for using each of these MFEs are given below.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def load_about():
packages=find_packages(exclude=["tests*"]),
include_package_data=True,
python_requires=">=3.5",
install_requires=["tutor>=12.0.0,<13.0.0"],
install_requires=["tutor>=13.0.0,<14.0.0"],
entry_points={"tutor.plugin.v0": ["mfe = tutormfe.plugin"]},
classifiers=[
"Development Status :: 3 - Alpha",
Expand Down
2 changes: 1 addition & 1 deletion tutormfe/__about__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "12.1.0"
__version__ = "13.0.0"
4 changes: 2 additions & 2 deletions tutormfe/patches/local-docker-compose-dev-services
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
{%- for key, value in app.get("env", {}).get("production", {}).items() %}
- "{{ key }}={{ value }}"
{% endfor %}
{% for key, value in app.get("env", {}).get("development", {}).items() %}
{%- for key, value in app.get("env", {}).get("development", {}).items() %}
- "{{ key }}={{ value }}"
{% endfor %}
{%- endfor %}
{% endfor %}
2 changes: 1 addition & 1 deletion tutormfe/patches/openedx-lms-development-settings
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ACCOUNT_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ MFE_ACCOUNT_MFE_APP["port"
WRITABLE_GRADEBOOK_URL = "http://{{ MFE_HOST }}:{{ MFE_GRADEBOOK_MFE_APP["port"] }}/{{ MFE_GRADEBOOK_MFE_APP["name"] }}"
{% endif %}
{% if MFE_LEARNING_MFE_APP %}
LEARNING_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}:{{ MFE_LEARNING_MFE_APP["port"] }}/{{ MFE_LEARNING_MFE_APP["name"] }}"
LEARNING_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ MFE_LEARNING_MFE_APP["port"] }}/{{ MFE_LEARNING_MFE_APP["name"] }}"
{% endif %}
{% if MFE_PROFILE_MFE_APP %}
PROFILE_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https://{% else %}http://{% endif %}{{ MFE_HOST }}:{{ MFE_PROFILE_MFE_APP["port"] }}/{{ MFE_PROFILE_MFE_APP["name"] }}/u/"
Expand Down
9 changes: 7 additions & 2 deletions tutormfe/templates/mfe/build/mfe/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ FROM base AS {{ app["name"] }}-dev
COPY --from={{ app["name"] }}-src /openedx/app/package.json /openedx/app/package.json
COPY --from={{ app["name"] }}-src /openedx/app/package-lock.json /openedx/app/package-lock.json
ARG NPM_REGISTRY=https://registry.npmjs.org/
# Install updated frontend-build to disable new relic, where possible
# https://github.com/edx/frontend-build/pull/215
# This low-tech (i.e: ugly), manual patch should be removed in later versions
RUN sed -i "s/@edx\/frontend-build\": \"8.0.4\"/@edx\/frontend-build\": \"8.2.0\"/g" package.json
{{ patch("mfe-dockerfile-pre-npm-install") }}
RUN npm install --no-audit --no-fund --registry=$NPM_REGISTRY && rm -rf ~/.npm
RUN npm install --no-audit --no-fund --registry=$NPM_REGISTRY \
&& rm -rf ~/.npm
{{ patch("mfe-dockerfile-post-npm-install") }}
COPY --from={{ app["name"] }}-src /openedx/app /openedx/app
COPY --from={{ app["name"] }}-i18n /openedx/app/src/i18n/messages /openedx/app/src/i18n/messages
Expand All @@ -48,7 +53,7 @@ FROM {{ app["name"] }}-dev AS {{ app["name"] }}
COPY ./env/production /openedx/env/production
RUN touch /openedx/env/production.override \
{%- for key, value in app.get("env", {}).get("production", {}).items() %}
&& echo "{{ key }}={{ value }}" >> /openedx/env/production.override \
&& echo "{{ key }}='{{ value }}'" >> /openedx/env/production.override \
{%- endfor %}
&& echo "done setting production overrides"
RUN bash -c "set -a && source /openedx/env/production && source /openedx/env/production.override && npm run build"
Expand Down
4 changes: 2 additions & 2 deletions tutormfe/templates/mfe/build/mfe/env/development
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
DISCOVERY_API_BASE_URL='{% if DISCOVERY_HOST is defined %}http://{{ DISCOVERY_HOST }}:8381{% endif %}'
LMS_BASE_URL='http://{{ LMS_HOST }}:8000'
LOGIN_URL='http://{{ LMS_HOST }}:8000/login'
LOGO_URL='http://{{ LMS_HOST }}:8000/static/images/logo.png'
LOGO_TRADEMARK_URL='http://{{ LMS_HOST }}:8000/static/images/logo.png'
LOGO_URL='http://{{ LMS_HOST }}:8000/theming/asset/images/logo.png'
LOGO_TRADEMARK_URL='http://{{ LMS_HOST }}:8000/theming/asset/images/logo.png'
LOGOUT_URL='http://{{ LMS_HOST }}:8000/logout'
MARKETING_SITE_BASE_URL='http://{{ LMS_HOST }}:8000'
NODE_ENV=development
Expand Down
7 changes: 4 additions & 3 deletions tutormfe/templates/mfe/build/mfe/env/production
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{# https://edx.readthedocs.io/projects/edx-developer-docs/en/latest/developers_guide/micro_frontends_in_open_edx.html#configuration-with-environment-variables #}
{# https://edx.readthedocs.io/projects/edx-developer-docs/en/latest/micro_frontends/index.html#required-environment-variables #}
ACCESS_TOKEN_COOKIE_NAME='edx-jwt-cookie-header-payload'
BASE_URL='{{ MFE_HOST }}'
CSRF_TOKEN_API_PATH='/csrf/api/v1/token'
CREDENTIALS_BASE_URL=''
DISCOVERY_API_BASE_URL='{% if DISCOVERY_HOST is defined %}{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ DISCOVERY_HOST }}{% endif %}'
ECOMMERCE_BASE_URL=''
ENABLE_NEW_RELIC='false'
FAVICON_URL='{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/favicon.ico'
LANGUAGE_PREFERENCE_COOKIE_NAME='openedx-language-preference'
LMS_BASE_URL='{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}'
LOGIN_URL='{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/login'
LOGO_URL='{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/static/images/logo.png'
LOGO_TRADEMARK_URL='{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/static/images/logo.png'
LOGO_URL='{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/theming/asset/images/logo.png'
LOGO_TRADEMARK_URL='{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/theming/asset/images/logo.png'
LOGO_WHITE_URL=''
LOGOUT_URL='{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/logout'
MARKETING_SITE_BASE_URL='{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}'
Expand Down

0 comments on commit 4c018bb

Please sign in to comment.