Skip to content

Commit f8d35bf

Browse files
docs: Update README to explain how to run this using Tutor (#1472)
1 parent 2038bad commit f8d35bf

File tree

5 files changed

+53
-17
lines changed

5 files changed

+53
-17
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
NODE_ENV='production'
55

66
ACCESS_TOKEN_COOKIE_NAME=''
7+
APP_ID='learning'
78
BASE_URL=''
89
CONTACT_URL=''
910
CREDENTIALS_BASE_URL=''

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
NODE_ENV='development'
55

66
ACCESS_TOKEN_COOKIE_NAME='edx-jwt-cookie-header-payload'
7+
APP_ID='learning'
78
BASE_URL='http://localhost:2000'
89
CONTACT_URL='http://localhost:18000/contact'
910
CREDENTIALS_BASE_URL='http://localhost:18150'

.env.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
NODE_ENV='test'
55

66
ACCESS_TOKEN_COOKIE_NAME='edx-jwt-cookie-header-payload'
7+
APP_ID='learning'
78
BASE_URL='http://localhost:2000'
89
CONTACT_URL='http://localhost:18000/contact'
910
CREDENTIALS_BASE_URL='http://localhost:18150'

README.rst

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,50 +21,82 @@ Getting Started
2121
Prerequisites
2222
=============
2323

24-
The `devstack`_ is currently recommended as a development environment for your
25-
new MFE. If you start it with ``make dev.up.lms`` that should give you
26-
everything you need as a companion to this frontend.
27-
28-
Note that it is also possible to use `Tutor`_ to develop an MFE. You can refer
29-
to the `relevant tutor-mfe documentation`_ to get started using it.
30-
31-
.. _Devstack: https://github.com/openedx/devstack
24+
`Tutor`_ is currently recommended as a development environment for the Learning
25+
MFE. Most likely, it already has this MFE configured; however, you'll need to
26+
make some changes in order to run it in development mode. You can refer
27+
to the `relevant tutor-mfe documentation`_ for details, or follow the quick
28+
guide below.
3229

3330
.. _Tutor: https://github.com/overhangio/tutor
3431

3532
.. _relevant tutor-mfe documentation: https://github.com/overhangio/tutor-mfe#mfe-development
3633

37-
To use this application, `devstack <https://github.com/openedx/devstack>`__ must be running and you must be logged into it.
38-
39-
- Visit http://localhost:2000/course/course-v1:edX+DemoX+Demo_Course to view the demo course. You can replace ``course-v1:edX+DemoX+Demo_Course`` with a different course key.
4034

41-
Cloning and Startup
42-
===================
35+
Cloning and Setup
36+
=================
4337

4438
1. Clone your new repo:
4539

4640
.. code-block:: bash
4741
4842
git clone https://github.com/openedx/frontend-app-learning.git
4943
50-
2. Use node v18.x.
44+
2. Use node v20.x.
5145

5246
The current version of the micro-frontend build scripts supports node 18.
5347
Using other major versions of node *may* work, but this is unsupported. For
5448
convenience, this repository includes an ``.nvmrc`` file to help in setting the
5549
correct node version via `nvm <https://github.com/nvm-sh/nvm>`_.
5650

57-
3. Install npm dependencies:
51+
3. Stop the Tutor devstack, if it's running: ``tutor dev stop``
52+
53+
4. Next, we need to tell Tutor that we're going to be running this repo in
54+
development mode, and it should be excluded from the ``mfe`` container that
55+
otherwise runs every MFE. Run this:
56+
57+
.. code-block:: bash
58+
59+
tutor mounts add /path/to/frontend-app-learning
60+
61+
5. Start Tutor in development mode. This command will start the LMS and Studio,
62+
and other required MFEs like ``authn`` and ``account``, but will not start
63+
the learning MFE, which we're going to run on the host instead of in a
64+
container managed by Tutor. Run:
65+
66+
.. code-block:: bash
67+
68+
tutor dev start lms cms mfe
69+
70+
Startup
71+
=======
72+
73+
1. Install npm dependencies:
5874

5975
.. code-block:: bash
6076
6177
cd frontend-app-learning && npm ci
6278
63-
4. Start the dev server:
79+
2. Start the dev server:
80+
81+
.. code-block:: bash
82+
83+
npm run dev
84+
85+
Then you can access the app at http://local.openedx.io:2000/learning/
86+
87+
Troubleshooting
88+
---------------
89+
90+
If you see an "Invalid Host header" error, then you're probably using a different domain name for your devstack such as
91+
``local.edly.io`` or ``local.overhang.io`` (not the new recommended default, ``local.openedx.io``). In that case, run
92+
these commands to update your devstack's domain names:
6493

6594
.. code-block:: bash
6695
67-
npm start
96+
tutor dev stop
97+
tutor config save --set LMS_HOST=local.openedx.io --set CMS_HOST=studio.local.openedx.io
98+
tutor dev launch -I --skip-build
99+
tutor dev stop learning # We will run this MFE on the host
68100
69101
Local module development
70102
=========================

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"postinstall": "patch-package",
2020
"snapshot": "fedx-scripts jest --updateSnapshot",
2121
"start": "fedx-scripts webpack-dev-server --progress",
22+
"dev": "PUBLIC_PATH=/learning/ MFE_CONFIG_API_URL='http://localhost:8000/api/mfe_config/v1' fedx-scripts webpack-dev-server --progress --host apps.local.openedx.io",
2223
"test": "fedx-scripts jest --coverage --passWithNoTests"
2324
},
2425
"author": "edX",

0 commit comments

Comments
 (0)