Skip to content
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
9 changes: 5 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
}
},
"containerEnv": {
"DEVSTACK_WORKSPACE": "/workspaces/edx-repos"
"DEVSTACK_WORKSPACE": "/workspaces/edx-repos",
"LEARNING_MICROFRONTEND_PORT": "2010"
},
"updateContentCommand": ".devcontainer/updateContentCommand.sh",
"postCreateCommand": ".devcontainer/postCreateCommand.sh",
"postStartCommand": ".devcontainer/postStartCommand.sh",
"forwardPorts": [
1976, 1984, 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 3406, 5335, 7474, 8000, 8081, 8734, 8735, 9021, 9201, 9202,
1976, 1984, 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
2010, 3406, 5335, 7474, 8000, 8081, 8734, 8735, 9021, 9201, 9202,
9301, 9600, 18000, 18010, 18040, 18110, 18120, 18130, 18150, 18160,
18170, 18270, 18280, 18381, 18400, 18450, 18734, 18760, 18787, 19001,
27017, 44567
Expand All @@ -60,7 +61,7 @@
"18130": { "label": "ecommerce" },
"18150": { "label": "credentials" },
"18120": { "label": "edx_notes_api" },
"2000": { "label": "frontend-app-learning" },
"2010": { "label": "frontend-app-learning" },
"1998": { "label": "frontend-app-payment" },
"18400": { "label": "frontend-app-publisher" },
"1994": { "label": "frontend-app-gradebook" },
Expand Down
24 changes: 24 additions & 0 deletions .devcontainer/updateContentCommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,27 @@ for repo_dir in ${repo_dirs[@]}; do

popd
done


echo "Updating .env.development files for MFE apps..."

# Define shared values
PORT=${LEARNING_MICROFRONTEND_PORT:-2010}
BASE_URL="http://localhost:$PORT"

# Loop through frontend-app-* repos
find "$DEVSTACK_WORKSPACE" -type d -name "frontend-app-*" | while read -r repo; do
ENV_FILE="$repo/.env.development"


if [ -f "$ENV_FILE" ]; then
echo "Updating $ENV_FILE..."
if [[ "$repo" == *"frontend-app-learning" ]]; then
sed -i.bak -E "s|^PORT=.*|PORT=$PORT|" "$ENV_FILE"
sed -i.bak -E "s|^BASE_URL=.*|BASE_URL='$BASE_URL'|" "$ENV_FILE"
else
sed -i.bak -E "s|^LEARNING_BASE_URL=.*|LEARNING_BASE_URL='$BASE_URL'|" "$ENV_FILE"
fi
rm -f "$ENV_FILE.bak"
fi
done
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ services:
aliases:
- edx.devstack.frontend-app-learning
ports:
- "2000:2000"
- "${LEARNING_MICROFRONTEND_PORT:-2010}:${LEARNING_MICROFRONTEND_PORT:-2010}"
depends_on:
- lms

Expand Down
3 changes: 2 additions & 1 deletion py_configuration_files/course_discovery.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# noinspection PyUnresolvedReferences
import os
from course_discovery.settings._debug_toolbar import * # isort:skip

from course_discovery.settings.production import *
Expand All @@ -18,7 +19,7 @@
'http://localhost:1991', # frontend-app-admin-portal
'http://localhost:18400', # frontend-app-publisher
'http://localhost:18450', # frontend-app-support-tools
'http://localhost:2000', # frontend-app-learning
'http://localhost:' + os.environ.get('LEARNING_MICROFRONTEND_PORT', '2010'), # frontend-app-learning
)

ELASTICSEARCH_DSL['default']['hosts'] = 'edx.devstack.elasticsearch710:9200'
Expand Down
3 changes: 2 additions & 1 deletion py_configuration_files/ecommerce.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Devstack settings"""


import os
from corsheaders.defaults import default_headers as corsheaders_default_headers

from ecommerce.settings.production import *
Expand Down Expand Up @@ -55,8 +56,8 @@
'http://localhost:1996',
'http://localhost:1997', # Account MFE
'http://localhost:1998',
'http://localhost:2000', # Learning MFE
'http://localhost:8734', # Enterprise Learner Portal MFE
'http://localhost:' + os.environ.get('LEARNING_MICROFRONTEND_PORT', '2010'), # Learning MFE
)
CORS_ALLOW_HEADERS = corsheaders_default_headers + (
'use-jwt-cookie',
Expand Down
6 changes: 5 additions & 1 deletion py_configuration_files/enterprise_subsidy.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from enterprise_subsidy.settings.local import *

CORS_ORIGIN_WHITELIST = (
Expand Down Expand Up @@ -54,6 +55,9 @@
'BACKEND_SERVICE_EDX_OAUTH2_SECRET', 'enterprise-subsidy-backend-service-secret'
)

# This port is configured centrally in devcontainer.json
LEARNING_MICROFRONTEND_PORT = os.environ.get('LEARNING_MICROFRONTEND_PORT', '2010')

JWT_AUTH.update({
'JWT_SECRET_KEY': 'lms-secret',
'JWT_ISSUER': 'http://localhost:18000/oauth2',
Expand All @@ -75,7 +79,7 @@
LMS_URL = 'http://edx.devstack.lms:18000'
ENTERPRISE_CATALOG_URL = 'http://edx.devstack.enterprise-catalog:18160'
ENTERPRISE_SUBSIDY_URL = 'http://localhost:18280'
FRONTEND_APP_LEARNING_URL = 'http://localhost:2000'
FRONTEND_APP_LEARNING_URL = 'http://localhost:' + LEARNING_MICROFRONTEND_PORT

# Kafka Settings
# "Standard" Kafka settings as defined in https://github.com/openedx/event-bus-kafka/tree/main
Expand Down
10 changes: 7 additions & 3 deletions py_configuration_files/lms.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing
ENTERPRISE_LEARNER_PORTAL_NETLOC = 'localhost:8734'
ENTERPRISE_LEARNER_PORTAL_BASE_URL = 'http://' + ENTERPRISE_LEARNER_PORTAL_NETLOC

########################## LEARNING MICROFRONTEND ##############################
LEARNING_MICROFRONTEND_PORT = os.environ.get('LEARNING_MICROFRONTEND_PORT', '2010')
LEARNING_MICROFRONTEND_NETLOC = 'localhost:' + LEARNING_MICROFRONTEND_PORT

########################## ENTERPRISE ADMIN PORTAL ##############################
ENTERPRISE_ADMIN_PORTAL_NETLOC = 'localhost:1991'
ENTERPRISE_ADMIN_PORTAL_BASE_URL = 'http://' + ENTERPRISE_ADMIN_PORTAL_NETLOC
Expand Down Expand Up @@ -308,14 +312,14 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing
'localhost:1997', # frontend-app-account
'localhost:1976', # frontend-app-program-console
'localhost:1994', # frontend-app-gradebook
'localhost:2000', # frontend-app-learning
'localhost:2001', # frontend-app-course-authoring
'localhost:18400', # frontend-app-publisher
'localhost:1993', # frontend-app-ora-grading
'localhost:1996', # frontend-app-learner-dashboard
ENTERPRISE_LEARNER_PORTAL_NETLOC, # frontend-app-learner-portal-enterprise
ENTERPRISE_ADMIN_PORTAL_NETLOC, # frontend-app-admin-portal
ENTERPRISE_CHECKOUT_NETLOC, # frontend-app-enterprise-checkout
LEARNING_MICROFRONTEND_NETLOC, # frontend-app-learning
])

###################### JWTs ######################
Expand Down Expand Up @@ -386,7 +390,7 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing
EDXNOTES_CLIENT_NAME = 'edx_notes_api-backend-service'

############## Settings for Microfrontends #########################
LEARNING_MICROFRONTEND_URL = 'http://localhost:2000'
LEARNING_MICROFRONTEND_URL = 'http://localhost:' + LEARNING_MICROFRONTEND_PORT
ACCOUNT_MICROFRONTEND_URL = 'http://localhost:1997'
PROFILE_MICROFRONTEND_URL = 'http://localhost:1995'
COMMUNICATIONS_MICROFRONTEND_URL = 'http://localhost:1984'
Expand Down Expand Up @@ -546,7 +550,6 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing

# MFEs that will call this service in devstack
CSRF_TRUSTED_ORIGINS = [
'http://localhost:2000', # frontend-app-learning
'http://localhost:2001', # frontend-app-course-authoring
'http://localhost:1997', # frontend-app-account
'http://localhost:1995', # frontend-app-profile
Expand All @@ -559,6 +562,7 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing
'http://localhost:18450', # frontend-app-support-tools
'http://localhost:1994', # frontend-app-gradebook
'http://localhost:1996', # frontend-app-learner-dashboard
LEARNING_MICROFRONTEND_URL # frontend-app-learning
]

############################ Codejail ############################
Expand Down