$customHeader
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Goal

  • Using a branch B, which is based on openedx/edx-platform:master, I want to:

    • Run LMS and CMS with local code

    • Run static analysis & tests

    • Run a management command

Relevant Tutor Docs

Issues Encountered

  • When working out of a repo generated by tutor dev bindmount:

    • git state was confusing as a newcomer

      • no branch information

      • patches applied on top of master - wasn’t clear where they came from at first

      • copied static assets and custom settings files made git state dirty

    • git remote protocol needed to be switched from https to ssh to allow push

    • git had to be configured to pull relevant branches

  • When using tutor dev start ... or tutor dev exec ... :

    • settings weren’t set correctly? Regis mentioned that exec doesn’t set DJANGO_SETTINGS_MODULE properly…

  • When setting COMMON_OPENEDX_VERSION to my feature branch and trying tutor images build openedx :

    • If branch has updates, needed to use --no-cache, which took a very long time.

    • Had to override openedx-dockerfile-git-patches-default to be empty, otherwise cherry-picking would conflict with the state of my branch (because said commits are already on master, it seems?)

  • Volume mounting requires full path; ~ for home didn’t work.

  • Had to start from scratch due to < insert requirements problem that carlos had >

Successful Approach

# Clone edx-platform and switch to my branch.
$ git clone git@github.com:openedx/edx-platform
$ (cd edx-platform && git checkout $B)

# Install Tutor Nightly.
$ virtualenv tutor-venv
$ source tutor-venv/bin/activate
$ git clone --branch nightly git@github.com:overhangio/tutor
$ cd tutor
$ pip install -r requirements/dev.txt
$ pip install -e .

# Provision Tutor.
$ tutor local quickstart
$ tutor local stop

# Copy edx-platform virtual environment to host.
$ tutor dev start lms
$ tutor dev bindmount lms /openedx/venv
$ tutor dev stop lms
$ tutor dev dc rm

# Configure Tutor to mount your local edx-platform and virtual environment
# by writing a env/dev/docker-compose.override.yml file to your Tutor env.
# The syntax for each mount is $HOST_PATH:$DOCKER_PATH.
# Be sure to substitute in the appropriate $HOST_PATH for each mount.
$ cat > $(tutor config printroot)/env/dev/docker-compose.override.yml <<- EOF
version: "3.7"
services:
  lms:
    volumes:
      - /home/kyle/openedx/edx-platform:/openedx/edx-platform
      - /home/kyle/.local/share/tutor-nightly/volumes/venv:/openedx/venv
  cms:
    volumes:
      - /home/kyle/openedx/edx-platform:/openedx/edx-platform
      - /home/kyle/.local/share/tutor-nightly/volumes/venv:/openedx/venv
  lms-worker:
    volumes:
      - /home/kyle/openedx/edx-platform:/openedx/edx-platform
      - /home/kyle/.local/share/tutor-nightly/volumes/venv:/openedx/venv
  cms-worker:
    volumes:
      - /home/kyle/openedx/edx-platform:/openedx/edx-platform
      - /home/kyle/.local/share/tutor-nightly/volumes/venv:/openedx/venv
EOF

# Install requirements, provision demo course, admin user and static assets.
$ tutor dev run lms make requirements
$ tutor dev run lms npm install
$ tutor dev run lms openedx-assets build --env=dev
$ tutor dev createuser admin admin@example.com --password admin --staff --superuser
$ tutor dev importdemocourse

# (NOT REQUIRED - JUST EXAMPLES) Run tests, linting, and a management command.
$ tutor dev run lms pytest path/to/some/code
$ tutor dev run lms pylint path/to/some/code
$ tutor dev run lms ./manage.py lms run_some_management_command
                            
# Run LMS and CMS.
$ tutor dev start -d lms cms

Suggested Improvements

# Clone edx-platform and switch to my branch.
$ git clone git@github.com:openedx/edx-platform
$ (cd edx-platform && git checkout $B)

# Install Tutor Nightly.
$ virtualenv tutor-venv
$ source tutor-venv/bin/activate
# Either:
 $ git clone --branch nightly git@github.com:overhangio/tutor
 $ cd tutor
 $ make requirements
# OR:
 # tutor-nightly could be a metapackage depending on the latest nightly (`N.dev`) tutor release
 $ pip install tutor-nightly

# Configure mounting:
#   * from my edx-platform to the container's /openedx/edx-platform, and
#   * from the default location in tutor-nightly config to /openedx/venv.
$ tutor config save --set OPENEDX_MOUNTS=/home/kyle/openedx/edx-platfrom:/openedx/edx-platform,/openedx/venv

# Provision Tutor, to include a default user as well as static assets.
$ tutor dev quickinit

# Run tests, linting, and a management command.
$ tutor dev run bash
app@lms$ pytest path/to/some/code
app@lms$ pylint path/to/some/code
app@lms$ ./manage.py lms run_some_management_command
app@lms$ exit
                            
# Run LMS, with virtual environment and application code from host.
$ tutor dev runserver -d lms cms

  • No labels