mirror of
https://github.com/ChristianLight/tutor.git
synced 2024-11-11 15:51:00 +00:00
174 lines
7.6 KiB
ReStructuredText
174 lines
7.6 KiB
ReStructuredText
.. _local:
|
|
|
|
Local deployment
|
|
================
|
|
|
|
This method is for deploying Open edX locally on a single server, where docker images are orchestrated with `docker-compose <https://docs.docker.com/compose/overview/>`_.
|
|
|
|
.. note::
|
|
Tutor is compatible with the ``docker compose`` subcommand. However, this support is still in beta and we're not sure it will behave the same as the previous ``docker-compose`` command. So ``docker-compose`` will be preferred, unless you set an environment variable ``TUTOR_USE_COMPOSE_SUBCOMMAND`` to enforce using ``docker compose``.
|
|
|
|
.. _tutor_root:
|
|
|
|
In the following, environment and data files will be generated in a user-specific project folder which will be referred to as the "**project root**". On Linux, the default project root is ``~/.local/share/tutor``. An alternative project root can be defined by passing the ``--root=...`` option to the ``tutor`` command, or defining the ``TUTOR_ROOT=...`` environment variable::
|
|
|
|
tutor --root=/path/to/tutorroot run ...
|
|
# Or equivalently:
|
|
export TUTOR_ROOT=/path/to/tutorroot
|
|
tutor run ...
|
|
|
|
Main commands
|
|
-------------
|
|
|
|
All available commands can be listed by running::
|
|
|
|
tutor local --help
|
|
|
|
All-in-one command
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
A fully-functional platform can be configured and run in one command::
|
|
|
|
tutor local launch
|
|
|
|
But you may want to run commands one at a time: it's faster when you need to run only part of the local deployment process, and it helps you understand how your platform works. In the following, we decompose the ``launch`` command.
|
|
|
|
Configuration
|
|
~~~~~~~~~~~~~
|
|
|
|
::
|
|
|
|
tutor config save --interactive
|
|
|
|
This is the only non-automatic step in the installation process. You will be asked various questions about your Open edX platform and appropriate configuration files will be generated. If you would like to automate this step then you should run ``tutor config save --interactive`` once. This will generate a ``config.yml`` file in the **project root**. This file contains all the configuration values for your platform, such as randomly generated passwords, domain names, etc. The location of the **project root** can be found by running ``tutor config printroot``. See :ref:`section above <tutor_root>`.
|
|
|
|
If you want to run a fully automated installation, upload the ``config.yml`` file to wherever you want to run Open edX. You can then entirely skip the configuration step.
|
|
|
|
Update docker images
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
::
|
|
|
|
tutor local dc pull
|
|
|
|
This downloads the latest version of the Docker images from `Docker Hub <https://hub.docker.com/r/overhangio/openedx/>`_. Depending on your bandwidth, this might take a long time. Minor image updates will be incremental, and thus much faster.
|
|
|
|
Running Open edX
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
::
|
|
|
|
tutor local start
|
|
|
|
This will launch the various docker containers required for your Open edX platform. The LMS and the Studio will then be reachable at the domain name you specified during the configuration step.
|
|
|
|
To stop the running containers, just hit Ctrl+C.
|
|
|
|
In production, you will probably want to daemonize the services. To do so, run::
|
|
|
|
tutor local start --detach
|
|
|
|
And then, to stop all services::
|
|
|
|
tutor local stop
|
|
|
|
Service initialisation
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
::
|
|
|
|
tutor local do init
|
|
|
|
This command should be run just once. It will initialise all applications in a running platform. In particular, this will create the required databases tables and apply database migrations for all applications.
|
|
|
|
If initialisation is stopped with a ``Killed`` message, this certainly means the docker containers don't have enough RAM. See the :ref:`troubleshooting` section.
|
|
|
|
Logging
|
|
~~~~~~~
|
|
|
|
By default, logs from all containers are forwarded to the `default Docker logging driver <https://docs.docker.com/config/containers/logging/configure/>`_: this means that logs are printed to the standard output when running in non-daemon mode (``tutor local start``). In daemon mode, logs can still be accessed with ``tutor local logs`` commands (see :ref:`logging <logging>`).
|
|
|
|
In addition, all LMS and CMS logs are persisted to disk by default in the following files::
|
|
|
|
$(tutor config printroot)/data/lms/logs/all.log
|
|
$(tutor config printroot)/data/cms/logs/all.log
|
|
|
|
Finally, tracking logs that store `user events <https://edx.readthedocs.io/projects/devdata/en/latest/internal_data_formats/tracking_logs/index.html>`_ are persisted in the following files::
|
|
|
|
$(tutor config printroot)/data/lms/logs/tracking.log
|
|
$(tutor config printroot)/data/cms/logs/tracking.log
|
|
|
|
Status
|
|
~~~~~~
|
|
|
|
You can view your platform's containers::
|
|
|
|
tutor local status
|
|
|
|
Notice the **State** column in the output. It will tell you whether each container is starting, restarting, running (``Up``), cleanly stopped (``Exit 0``), or stopped on error (``Exit N``, where N ≠ 0).
|
|
|
|
Common tasks
|
|
------------
|
|
|
|
.. _createuser:
|
|
|
|
Creating a new user with staff and admin rights
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
You will most certainly need to create a user to administer the platform. Just run::
|
|
|
|
tutor local do createuser --staff --superuser yourusername user@email.com
|
|
|
|
You will be asked to set the user password interactively.
|
|
|
|
.. _democourse:
|
|
|
|
Importing the demo course
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
After a fresh installation, your platform will not have a single course. To import the `Open edX demo course <https://github.com/openedx/edx-demo-course>`_, run::
|
|
|
|
tutor local do importdemocourse
|
|
|
|
.. _settheme:
|
|
|
|
Setting a new theme
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
The default Open edX theme is rather bland, so Tutor makes it easy to switch to a different theme::
|
|
|
|
tutor local do settheme mytheme
|
|
|
|
Out of the box, only the default "open-edx" theme is available. We also developed `Indigo, a beautiful, customizable theme <https://github.com/overhangio/indigo>`__ which is easy to install with Tutor.
|
|
|
|
Running arbitrary ``manage.py`` commands
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Any ``./manage.py`` command provided by Open edX can be run in a local platform deployed with Tutor. For instance, to delete a course, run::
|
|
|
|
tutor local run cms ./manage.py cms delete_course <your_course_id>
|
|
|
|
To update the course search index, run::
|
|
|
|
# Run this command periodically to ensure that course search results are always up-to-date.
|
|
tutor local run cms ./manage.py cms reindex_course --all --setup
|
|
|
|
Reloading Open edX settings
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
After modifying Open edX settings, for instance when running ``tutor config save``, you will want to restart the web processes of the LMS and the CMS to take into account those new settings. It is possible to simply restart the whole platform (with ``tutor local reboot``) or just a single service (``tutor local restart lms``) but that is overkill. A quicker alternative is to send the HUP signal to the uwsgi processes running inside the containers. The "openedx" Docker image comes with a convenient script that does just that. To run it, execute::
|
|
|
|
tutor local exec lms reload-uwsgi
|
|
|
|
|
|
Customizing the deployed services
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
You might want to customise the docker-compose services listed in ``$(tutor config printroot)/env/local/docker-compose.yml``. To do so, you should create a ``docker-compose.override.yml`` file in that same folder::
|
|
|
|
vim $(tutor config printroot)/env/local/docker-compose.override.yml
|
|
|
|
The values in this file will override the values from ``docker-compose.yml`` and ``docker-compose.prod.yml``, as explained in the `docker-compose documentation <https://docs.docker.com/compose/extends/#adding-and-overriding-configuration>`__.
|
|
|
|
Similarly, the job service configuration can be overridden by creating a ``docker-compose.jobs.override.yml`` file in that same folder.
|