-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
E0d/update first pr #858
base: main
Are you sure you want to change the base?
E0d/update first pr #858
Changes from all commits
f009253
4907598
71c780b
56fa0b8
68a09c4
b10b1f1
029cd88
4b48f84
579d5ce
fa6bf34
60c39a1
3b70842
e4e417f
94d839d
2559e5b
45149a5
79afdbe
52826fa
c60bc55
3da69b8
550fa3e
a399bae
2f7ba2c
4ecacc6
4fd0868
fc617a4
dc99a5b
cf61ba5
f7036a3
b3ba810
160d322
3f7086c
dadcedb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,13 @@ Quick Start: First Open edX Pull Request | |
:local: | ||
:class: no-bullets | ||
|
||
Welcome to the Quickstart guide for new Open edX contributors. By the end of | ||
this tutorial, you will have completed all the steps necessary to begin | ||
contributing to the Open edX project. | ||
Welcome to the Quickstart guide for new Open edX contributors. | ||
|
||
This tutorial is focused on teaching you how to make a noticeable | ||
change to the platform equivalent to a "hello world" exercise. | ||
|
||
By the end of this tutorial, you will have completed all the steps | ||
necessary to begin contributing to the Open edX project. | ||
|
||
These include: | ||
|
||
|
@@ -17,7 +21,7 @@ These include: | |
* `Signing your Contributor License Agreement (CLA).`_ | ||
|
||
We assume you are comfortable with the command line, and understand the basics | ||
of using Git, GitHub, and python basics. | ||
of using Git, GitHub, Docker, and python basics. | ||
|
||
.. This Quickstart is written for first-time contributors to the Open edX project. | ||
If you are a plug-in developer or a frontend developer, please see our | ||
|
@@ -48,7 +52,7 @@ the basics of using them, before proceeding: | |
|
||
* Additionally, we strongly recommend setting up 2-factor authentication. | ||
|
||
* `Python 3.8 <https://www.python.org/downloads/>`_ | ||
* `Python 3.11 <https://www.python.org/downloads/>`_ | ||
|
||
* Your favorite code editor (our team uses | ||
`VSCode <https://code.visualstudio.com/download>`_, | ||
|
@@ -79,44 +83,23 @@ from the `official Docker documentation | |
to the Docker daemon. | ||
|
||
|
||
Installing Tutor Nightly | ||
Installing Tutor Main | ||
************************ | ||
|
||
Navigate into a folder to hold your Open edX repositories. | ||
We will assume you're using ``~/openedx``, but you can choose any folder. | ||
|
||
.. code-block:: bash | ||
Tutor main is the best solution for using Tutor as your development | ||
environment and tracking the bleeding edge of the Open edX platform | ||
code. | ||
|
||
mkdir -p ~/openedx | ||
cd ~/openedx | ||
|
||
Create a Python 3.8 virtual environment (we'll call it ``tutor-venv``) and activate it: | ||
|
||
.. code-block:: bash | ||
Follow the official instructions for installing Tutor Main. | ||
|
||
python3.8 -m venv tutor-venv | ||
. tutor-venv/bin/activate | ||
.. admonition:: Use Virtual Environments | ||
|
||
Install Tutor. This is a tool that helps you run the Open edX project. | ||
We will install the "Nightly" version of Tutor, which means it will run the latest | ||
version of the code (as opposed to the most recent named release): | ||
|
||
.. code-block:: bash | ||
|
||
git clone --branch=nightly https://github.com/overhangio/tutor.git | ||
pip install -e "./tutor[full]" | ||
|
||
Finally, let's configure and provision your Open edX instance! | ||
You will be asked a couple questions. | ||
Answer them however you like, although the default answers will work fine. | ||
|
||
.. code-block:: bash | ||
The Tutor documents will recommend this as well, but please do | ||
yourself the favor of using python virtual enviroments. Doing so | ||
will make managing multiple repositories and dependency versions | ||
much easier. | ||
|
||
tutor dev launch | ||
|
||
Depending on your system and your Internet connection speed, | ||
this could take anywhere from five minutes to over an hour, | ||
so go get a coffee and come back for the next part. | ||
`Official Tutor tutorial <https://docs.tutor.edly.io/tutorials/main.html#running-open-edx-on-the-master-branch-tutor-main>`_ | ||
|
||
|
||
Working with a fork | ||
|
@@ -175,38 +158,127 @@ To have Tutor run your local fork of edx-platform, you have to tell it to do so | |
on start up. It is a simple CLI parameter that points Tutor to the directory where | ||
the code lives. | ||
|
||
As a first step, fire up a one-off LMS container while mounting your local | ||
checkout: | ||
To set up your local enviroment to update edx-platform, follow the | ||
`official instructions | ||
<https://docs.tutor.edly.io/tutorials/edx-platform.html>`_ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this was referenced in the forums discussion, but after going through it, I found it not as helpful for the following reasons:
I would suggest that consolidating the link you mentioned and this one: https://docs.tutor.edly.io/dev.html#first-time-setup so it's more clear on what commands are to be run in order to get your instance running, and get your changes on the legacy platform reflected locally. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When you say
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Submitted a PR to fix the "edx-plaform" typo. @tonybusa, if you still have specific suggestions on how to improve those docs, contributions would be very welcome! :) |
||
|
||
From this point on, whatever changes you make to the code in your clone should | ||
be visible in your local LMS instance immediately. | ||
|
||
Working with an MFE | ||
=================== | ||
|
||
Most of the Open edX platform's frontends have migrated from backend | ||
Django templates to microfrontends based on the React framework | ||
(MFEs). If you are interested in updating frontend code, MFEs are | ||
probably where you want to focus. There are different ways of | ||
configuring your development environment, but a common one is to use | ||
Tutor to serve the backend services and run your MFE locally using npm | ||
dev start. | ||
|
||
To run MFEs in Tutor requires enabling a plugin, Tutor MFE. | ||
|
||
Start by verifying that the mfe plugin is installed and enabled | ||
|
||
.. code-block:: bash | ||
|
||
tutor dev run --mount=./edx-platform lms bash | ||
(tutor-main) $ tutor plugins list | ||
|
||
NAME STATUS VERSION | ||
discovery installed 19.0.0 | ||
forum installed 19.0.0 | ||
indigo ✅ enabled 19.0.1 | ||
jupyter installed 19.0.0 | ||
mfe ✅ enabled 19.0.0 | ||
|
||
Now within the container, install python requirements and rebuild static assets | ||
for your local checkout: | ||
If ``mfe`` isn't enabled run the following command to do so | ||
|
||
.. code-block:: bash | ||
|
||
pip install -e . | ||
npm install | ||
openedx-assets build --env=dev | ||
exit | ||
(tutor-main) $ tutor plugins enable mfe | ||
(tutor-main) $ tutor dev stop | ||
(tutor-main) $ tutor dev launch | ||
|
||
After exiting the one-off container, restart the LMS with the local checkout | ||
mounted: | ||
Once Tutor has restarted with the ``mfe`` plugin enabled you will see a few more URLs listed. | ||
|
||
.. code-block:: bash | ||
|
||
tutor dev start --mount=./edx-platform lms | ||
http://apps.local.openedx.io:1984/communications | ||
http://apps.local.openedx.io:1990/learner-record | ||
http://apps.local.openedx.io:1993/ora-grading | ||
http://apps.local.openedx.io:1994/gradebook | ||
http://apps.local.openedx.io:1995/profile | ||
http://apps.local.openedx.io:1996/learner-dashboard | ||
http://apps.local.openedx.io:1997/account | ||
http://apps.local.openedx.io:2000/learning | ||
http://apps.local.openedx.io:2002/discussions | ||
|
||
From this point on, whatever changes you make to the code in your clone should | ||
be visible in your local LMS instance immediately. | ||
These ports and paths are to specific MFEs made available via the MFE plugin. | ||
|
||
In order to develop locally, you will need to fork and clone the MFE | ||
repository as you did for edx-platform, bind mount the directory, stop | ||
the Tutor-hosted MFE and start a local npm dev server. Let's do so | ||
with the Learner Dashboard MFE. | ||
|
||
First, you should verify that the learner dashboard is working | ||
correctly after you have installed the MFE plugin. Assuming | ||
everything is configured in the standard way, your URL should be | ||
``http://apps.local.openedx.io:1996/learner-dashboard/`` | ||
|
||
Follow the same, fork, clone workflow described above and clone the | ||
learner-dashboard | ||
``https://github.com/openedx/frontend-app-learner-dashboard`` | ||
repository locally. | ||
|
||
Add a tutor mount for your cloned directory. | ||
|
||
.. code-block:: bash | ||
|
||
(tutor-main) $ tutor mounts add /home/git/frontend-app-learner-dashboard | ||
|
||
Next, ensure that the learner-dashboard MFE is stopped | ||
|
||
.. code-block:: bash | ||
|
||
(tutor-main) $ tutor dev stop learner-dashboard | ||
|
||
Reloading the learner dashboard page in the browser should now yield an error. | ||
|
||
Now its time to replace the default Tutor-hosted learner-dashboard with a | ||
local version. That version will use a dev config file to connect to | ||
the Tutor-hosted backend and to bind to the expected port. | ||
|
||
.. admonition:: Local MFE Support and npm dev Profiles | ||
|
||
Not every MFE currently has an ``npm run dev`` command that will | ||
work with Tutor, though it is possible to create one if that is the | ||
case for the MFE you are developing, , using `an existing one | ||
<https://github.com/openedx/frontend-app-learner-dashboard/pull/530/files>`_ | ||
as a template. | ||
|
||
From the directory containing the local copy of the learner-dashboard | ||
repository start the npm dev server. | ||
|
||
.. code-block:: bash | ||
|
||
(tutor-main) $ npm run dev | ||
|
||
Exercise: Update the Learner Dashboard | ||
************************************** | ||
|
||
The Learner Dashboard is the first page that students will see when they log | ||
into Open edX. On our Tutor dev environment, it is located at | ||
The Learner Dashboard is the first page that students will see after they log | ||
into Open edX. | ||
|
||
The dashboard page will either be provided by a legacy server side template or by the learner-dashboard MFE. Working with the MFE is usually the best choice. Note that this tutorial is simplistic and appropriate to get started. However, we don't recommend forking an MFE to customize it. For extensive modifications, that might be necessary, but for simple things using design tokens and frontend plugin slots will be a much better alternative. | ||
|
||
Working with the Learner Dashboard MFE | ||
====================================== | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @arbrandes thoughts about a change that makes sense to kick the tires? I updated a string in messages.json which I didn't think we great, it would be better to change a little react code I think. |
||
|
||
Working with the Legacy Learner Dashboard | ||
========================================= | ||
On our Tutor dev environment, it is located at | ||
``http://local.overhang.io:8000/dashboard`` | ||
|
||
.. image:: /_images/developers_quickstart_first_pr/learner_dashboard_before.png | ||
|
@@ -217,7 +289,7 @@ is not a change that will be merged upstream, but it will demonstrate the | |
steps you will have to go through to make a real change. | ||
|
||
Edit the Template | ||
================= | ||
----------------- | ||
|
||
The template file for this page is at ``lms/templates/dashboard.html``. We're | ||
going to add a simple welcome message to the ``dashboard-notifications`` div:: | ||
|
@@ -235,8 +307,11 @@ file. When you reload it in your browser, you should see something like this: | |
.. image:: /_images/developers_quickstart_first_pr/learner_dashboard_after.png | ||
:alt: Learner Dashboard page after we add the welcome message. | ||
|
||
Standard Operating Procedure For Backend or Frontend Changes | ||
============================================================ | ||
|
||
Make a Commit | ||
============= | ||
------------- | ||
|
||
Now that you've saved your changes, you can make a commit. First make a new | ||
branch with the name ``developer_quickstart``:: | ||
|
@@ -251,7 +326,7 @@ be prefixed with "feat:" like so:: | |
commit -a -m "feat: add welcome message to learner dashboard" | ||
|
||
Push the Commit to Your Fork | ||
============================ | ||
---------------------------- | ||
|
||
Now push your changes to a new branch in your fork:: | ||
|
||
|
@@ -265,7 +340,7 @@ Learn more about authentication `here <https://docs.github.com/en/authentication | |
|
||
|
||
Create A Pull Request | ||
********************* | ||
--------------------- | ||
|
||
Go to your fork. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still wrapping my head around the different types of Tutor - Main, Full, Nightly(?). I did find that this link was the most straight forward as far as just getting it installed as a python package (although it does mention other ways): https://docs.tutor.edly.io/install.html#install