You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: full edx-platform setup with tutor dev launch -m ...
Before this commit, setting up an edx-platform development environment
took multiple steps:
tutor dev launch
tutor dev run --mount=/path/to/edx-platform lms bash
>> pip install -e .
>> npm clean-install
>> openedx-assets build --env=dev
This commit moves the steps under ``run`` into an init task, which
is automatically run by ``launch``. Thus, setup is now one command:
tutor dev launch --mount=edx-platform
These extra init steps are only applicable when bind-mounting
edx-platform (because bind-mounting the repository overrides
some important artifacts that exist on the image, which must be
re-generated). Thus, the new init tasks exists early if it detects
that it is *not* operating on a bind-mounted repository.
Finally, we try to simplify the Open edX development docs so that
it is clearer how bind-mounting fits into the development process.
Part of: openedx-unsupported/wg-developer-experience#146Closes: openedx-unsupported/wg-developer-experience#152
This works around (but does not close) these related issues:
* openedx-unsupported/wg-developer-experience#150
* https://github.com/openedx/wg-developer-experience/issues/151
-[Improvement] Running ``tutor dev launch --mount=edx-platform`` now performs all necessary setup for a local edx-platform development. This includes running setup.py, installing node modules, and building assets; previously, those steps had to be run explicitly after bind-mounting a local copy of edx-platform (by @kdmccormick).
Copy file name to clipboardExpand all lines: docs/dev.rst
+53-48Lines changed: 53 additions & 48 deletions
Original file line number
Diff line number
Diff line change
@@ -5,16 +5,22 @@ Open edX development
5
5
6
6
In addition to running Open edX in production, Tutor can be used for local development of Open edX. This means that it is possible to hack on Open edX without setting up a Virtual Machine. Essentially, this replaces the devstack provided by edX.
7
7
8
+
.. _edx_platform_dev_env:
8
9
9
10
First-time setup
10
11
----------------
11
12
12
13
First, ensure you have already :ref:`installed Tutor <install>` (for development against the named releases of Open edX) or :ref:`Tutor Nightly <nightly>` (for development against Open edX's master branches).
13
14
14
-
Then, launch the developer platform setup process::
15
+
Then, run one of the following in order to launch the developer platform setup process::
15
16
17
+
# To use the edx-platform repository that is built into the image:
16
18
tutor dev launch
17
19
20
+
# To bind-mount and run your local clone of edx-platform,
21
+
# where './edx-platform' should be replaced with your local edx-platform's path:
22
+
tutor dev launch --mount=./edx-platform
23
+
18
24
This will perform several tasks for you. It will:
19
25
20
26
* stop any existing locally-running Tutor containers,
@@ -33,12 +39,30 @@ This will perform several tasks for you. It will:
33
39
34
40
* run service initialization scripts, such as service user creation and Waffle configuration.
35
41
42
+
Additionally, if you chose to bind-mount your local clone of edx-platform, it will:
43
+
44
+
* re-run setup.py,
45
+
46
+
* clean-reinstall Node modules, and
47
+
48
+
* regenerate static assets.
49
+
36
50
Once setup is complete, the platform will be running in the background:
37
51
38
52
* LMS will be accessible at `http://local.overhang.io:8000 <http://local.overhang.io:8000>`_.
39
53
* CMS will be accessible at `http://studio.local.overhang.io:8001 <http://studio.local.overhang.io:8001>`_.
40
54
* Plugged-in services should be accessible at their documented URLs.
41
55
56
+
Now, you can use the ``tutor dev ...`` command-line interface to manage your development environment. Some common commands are described below.
57
+
58
+
.. note::
59
+
60
+
Wherever you see ``[-m ./edx-platform]``, either:
61
+
62
+
* omit it, if you are using the edx-platform repository built into the image, or
63
+
* substitute it with ``-m <path/to/your/edx-platform>``.
64
+
65
+
You can :ref:`read more about bind-mounts below <bind_mounts>`.
42
66
43
67
Stopping the platform
44
68
---------------------
@@ -47,38 +71,55 @@ To bring down your platform's containers, simply run::
47
71
48
72
tutor dev stop
49
73
50
-
51
74
Starting the platform back up
52
75
-----------------------------
53
76
54
-
Once you have used ``launch`` once, you can start the platform in the future with the lighter-weight ``start`` command, which brings up containers but does not perform any initialization tasks::
77
+
Once you have used ``launch`` once, you can start the platform in the future with the lighter-weight ``start -d`` command, which brings up containers detached (i.e., in the background), but does not perform any initialization tasks::
55
78
56
-
tutor dev start # Run platform in the same terminal ("attached")
57
-
tutor dev start -d # Or, run platform the in the background ("detached")
79
+
tutor dev start -d [-m ./edx-platform]
58
80
59
81
Nonetheless, ``launch`` is idempotent, so it is always safe to run it again in the future without risk to your data. In fact, you may find it useful to use this command as a one-stop-shop for pulling images, running migrations, initializing new plugins you have enabled, and/or executing any new initialization steps that may have been introduced since you set up Tutor::
60
82
61
-
tutor dev launch --pullimages
83
+
tutor dev launch [-m ./edx-platform] --pullimages
84
+
85
+
Attaching to containers
86
+
-----------------------
87
+
88
+
You can run ``start`` without the ``-d`` flag::
89
+
90
+
tutor dev start [-m ./edx-platform]
91
+
92
+
If the platform isn't running, this will start it in your terminal. If the platform is already running in the background, this command will stop it, recreate it, and attach your terminal to it. Later, you can stop the platform with ``Ctrl+c``, or detach (without stopping) using ``Ctrl+z``.
93
+
94
+
Debugging with breakpoints
95
+
--------------------------
96
+
97
+
To debug a local edx-platform repository, you can add a `python breakpoint <https://docs.python.org/3/library/functions.html#breakpoint>`__ with ``breakpoint()`` anywhere in your code. Then, run ``start`` (without ``-d``) and specify the service through which you want to use the breakpoint, for example::
98
+
99
+
# Debugging LMS:
100
+
tutor dev start [-m ./edx-platform] lms
62
101
102
+
# Or, debugging CMS:
103
+
tutor dev start [-m ./edx-platform] cms
63
104
64
105
Running arbitrary commands
65
106
--------------------------
66
107
67
108
To run any command inside one of the containers, run ``tutor dev run [OPTIONS] SERVICE [COMMAND] [ARGS]...``. For instance, to open a bash shell in the LMS or CMS containers::
68
109
69
-
tutor dev run lms bash
70
-
tutor dev run cms bash
110
+
tutor dev run [-m ./edx-platform] lms bash
111
+
tutor dev run [-m ./edx-platform] cms bash
71
112
72
113
To open a python shell in the LMS or CMS, run::
73
114
74
-
tutor dev run lms ./manage.py lms shell
75
-
tutor dev run cms ./manage.py cms shell
115
+
tutor dev run [-m ./edx-platform] lms ./manage.py lms shell
116
+
tutor dev run [-m ./edx-platfomr] cms ./manage.py cms shell
76
117
77
118
You can then import edx-platform and django modules and execute python code.
78
119
79
-
To collect assets, you can use the ``openedx-assets`` command that ships with Tutor::
120
+
To rebuild assets, you can use the ``openedx-assets`` command that ships with Tutor::
80
121
81
-
tutor dev run lms openedx-assets build --env=dev
122
+
tutor dev run [-m ./edx-platform] lms openedx-assets build --env=dev
82
123
83
124
84
125
.. _specialized for developer usage:
@@ -193,42 +234,6 @@ This override file will be loaded when running any ``tutor dev ..`` command. The
193
234
Common tasks
194
235
------------
195
236
196
-
.. _edx_platform_dev_env:
197
-
198
-
Setting up a development environment for edx-platform
Following the instructions :ref:`above <bind_mounts>` on how to bind-mount directories from the host above, you may mount your own `edx-platform <https://github.com/openedx/edx-platform/>`__ fork in your containers by running::
202
-
203
-
tutor dev start -d --mount=/path/to/edx-platform lms
204
-
205
-
But to achieve that, you will have to make sure that your fork works with Tutor.
206
-
207
-
First of all, you should make sure that you are working off the latest release tag (unless you are running the Tutor :ref:`nightly <nightly>` branch). See the :ref:`fork edx-platform section <edx_platform_fork>` for more information.
208
-
209
-
Then, you should run the following commands::
210
-
211
-
# Run bash in the lms container
212
-
tutor dev run --mount=/path/to/edx-platform lms bash
After running all these commands, your edx-platform repository will be ready for local development. To debug a local edx-platform repository, you can then add a `python breakpoint <https://docs.python.org/3/library/functions.html#breakpoint>`__ with ``breakpoint()`` anywhere in your code and run::
224
-
225
-
tutor dev start --mount=/path/to/edx-platform lms
226
-
227
-
The default debugger is ``ipdb.set_trace``. ``PYTHONBREAKPOINT`` can be modified by setting an environment variable in the Docker imamge.
228
-
229
-
If LMS isn't running, this will start it in your terminal. If an LMS container is already running background, this command will stop it, recreate it, and attach your terminal to it. Later, to detach your terminal without stopping the container, just hit ``Ctrl+z``.
0 commit comments