Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

fix: orders port that clashes with learner dashboard #57

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/20231206_174503_regis_orders_port.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Bugfix] Switch ecommerce MFE port from 1996 to 7296, as it clashes with the new learner dashboard. (by @regisb)
6 changes: 5 additions & 1 deletion tutorecommerce/patches/openedx-lms-development-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Ecommerce
{% for app_name, app in iter_mfes() %}
{% if app_name == "orders" %}
ECOMMERCE_PUBLIC_URL_ROOT = "http://{{ ECOMMERCE_HOST }}:8130"
ECOMMERCE_API_URL = ECOMMERCE_PUBLIC_URL_ROOT + "/api/v2"
ORDER_HISTORY_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ ECOMMERCE_MFE_APP['port'] }}/{{ ECOMMERCE_MFE_APP['name'] }}/orders"
ORDER_HISTORY_MICROFRONTEND_URL = "http://{{ MFE_HOST }}:{{ app['port'] }}/{{ app_name }}/orders"
MFE_CONFIG["ECOMMERCE_BASE_URL"] = ECOMMERCE_PUBLIC_URL_ROOT
MFE_CONFIG["ORDER_HISTORY_URL"] = ORDER_HISTORY_MICROFRONTEND_URL
{% endif %}
{% endfor %}
2 changes: 1 addition & 1 deletion tutorecommerce/patches/openedx-lms-production-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ecommerce
ECOMMERCE_PUBLIC_URL_ROOT = "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ ECOMMERCE_HOST }}"
ECOMMERCE_API_URL = ECOMMERCE_PUBLIC_URL_ROOT + "/api/v2"
ORDER_HISTORY_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ MFE_HOST }}/{{ ECOMMERCE_MFE_APP['name'] }}/orders"
ORDER_HISTORY_MICROFRONTEND_URL = "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ MFE_HOST }}/orders/orders"
MFE_CONFIG["ECOMMERCE_BASE_URL"] = ECOMMERCE_PUBLIC_URL_ROOT
MFE_CONFIG["ORDER_HISTORY_URL"] = ORDER_HISTORY_MICROFRONTEND_URL
25 changes: 1 addition & 24 deletions tutorecommerce/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,6 @@
"OAUTH2_KEY_SSO": "ecommerce-sso",
"OAUTH2_KEY_SSO_DEV": "ecommerce-sso-dev",
"WORKER_JWT_ISSUER": "ecommerce-worker", # TODO do we need to keep this?
# Micro frontend applications
"MFE_APP": {
"name": "orders",
"repository": "https://github.com/edx/frontend-app-ecommerce",
"port": 1996,
},
"PAYMENT_MFE_APP": {
"name": "payment",
"repository": "https://github.com/edx/frontend-app-payment",
"port": 1998,
"env": {
"production": {
# Hardcoded in edx-platform
"CURRENCY_COOKIE_NAME": "edx-price-l10n",
# TODO set customizable value
"CYBERSOURCE_URL": "https://testsecureacceptance.cybersource.com/silent/pay",
"SUPPORT_URL": "{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/support",
},
"development": {
"SUPPORT_URL": "http://{{ LMS_HOST }}:8000/support",
},
},
},
},
"unique": {
"MYSQL_PASSWORD": "{{ 8|random_string }}",
Expand Down Expand Up @@ -95,7 +72,7 @@ def _add_ecommerce_mfe_apps(
{
"orders": {
"repository": "https://github.com/edx/frontend-app-ecommerce",
"port": 1996,
"port": 7296,
},
"payment": {
"repository": "https://github.com/edx/frontend-app-payment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

{% include "ecommerce/apps/ecommerce/settings/partials/common.py" %}

CORS_ORIGIN_WHITELIST = list(CORS_ORIGIN_WHITELIST) + [
"http://{{ MFE_HOST }}:{{ ECOMMERCE_MFE_APP['port'] }}",
"http://{{ MFE_HOST }}:{{ ECOMMERCE_PAYMENT_MFE_APP['port'] }}",
]
CSRF_TRUSTED_ORIGINS = ["{{ MFE_HOST }}:{{ ECOMMERCE_MFE_APP['port'] }}"]
CORS_ORIGIN_WHITELIST = list(CORS_ORIGIN_WHITELIST)
{% for app_name, app in iter_mfes() %}
{% if app_name == "orders" %}
CORS_ORIGIN_WHITELIST.append("http://{{ MFE_HOST }}:{{ app['port'] }}")
CSRF_TRUSTED_ORIGINS = ["{{ MFE_HOST }}:{{ app['port'] }}"]
{% elif app_name == "payment" %}
CORS_ORIGIN_WHITELIST.append("http://{{ MFE_HOST }}:{{ app['port'] }}")
{% endif %}
{% endfor %}

SOCIAL_AUTH_EDX_OAUTH2_PUBLIC_URL_ROOT = "http://{{ LMS_HOST }}:8000"

Expand Down
8 changes: 6 additions & 2 deletions tutorecommerce/templates/ecommerce/tasks/ecommerce/init
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
./manage.py migrate --noinput
./manage.py oscar_populate_countries --initial-only

{% for app in iter_mfes() %}
{% if app["name"] == "payment" %}
./manage.py create_or_update_site \
--site-id=1 \
--site-domain={{ ECOMMERCE_HOST }}:8130 \
Expand All @@ -19,7 +21,7 @@
--payment-support-url="http://{{ LMS_HOST }}:8000/support" \
--discovery_api_url=http://{{ DISCOVERY_HOST }}:8381/api/v1/ \
--enable-microfrontend-for-basket-page=true \
--payment-microfrontend-url="http://{{ MFE_HOST }}:{{ ECOMMERCE_PAYMENT_MFE_APP['port'] }}/{{ ECOMMERCE_PAYMENT_MFE_APP['name'] }}"
--payment-microfrontend-url="http://{{ MFE_HOST }}:{{ app['port'] }}/{{ app['name'] }}"

# Production site
./manage.py create_or_update_site \
Expand All @@ -41,7 +43,9 @@
--payment-support-url="{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ LMS_HOST }}/support" \
--discovery_api_url={% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ DISCOVERY_HOST }}/api/v1/ \
--enable-microfrontend-for-basket-page=true \
--payment-microfrontend-url="{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ MFE_HOST }}/{{ ECOMMERCE_PAYMENT_MFE_APP['name'] }}"
--payment-microfrontend-url="{% if ENABLE_HTTPS %}https{% else %}http{% endif %}://{{ MFE_HOST }}/{{ app['name'] }}"
{% endif %}
{% endfor %}

if [ ! -e /openedx/ecommerce/node_modules ]
then
Expand Down
Loading