Skip to content

Commit

Permalink
refactor: remove paver utility commands usage
Browse files Browse the repository at this point in the history
  • Loading branch information
UsamaSadiq committed Sep 12, 2024
1 parent 309f147 commit 7f452d9
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 26 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,10 @@ $(foreach asset_service,$(ASSET_SERVICES_LIST),\
dev.static: | $(_asset_compilation_targets)

dev.static.lms:
docker compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform/ && paver update_assets lms'
docker compose exec -T lms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform/ && npm run build && ./manage.py lms collectstatic --noinput'

dev.static.cms:
docker compose exec -T cms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform/ && paver update_assets cms'
docker compose exec -T cms bash -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform/ && npm run build && ./manage.py cms collectstatic --no-input'

dev.static.%: ## Rebuild static assets for the specified service's container.
docker compose exec -T $* bash -c 'source /edx/app/$*/$*_env && cd /edx/app/$*/$*/ && make static'
Expand Down
4 changes: 2 additions & 2 deletions docker-compose-watchers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
lms_watcher:
command: bash -c 'cd /edx/app/edxapp/edx-platform && source ../edxapp_env && while true; do paver watch_assets --w=$$ASSET_WATCHER_TIMEOUT; sleep 2; done'
command: bash -c 'cd /edx/app/edxapp/edx-platform && source ../edxapp_env && while true; do npm run watch --w=$$ASSET_WATCHER_TIMEOUT; sleep 2; done'
container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.lms_watcher"
environment:
FRONTEND_TEST_SERVER_HOSTNAME: edx.devstack.lms_watcher
Expand All @@ -18,7 +18,7 @@ services:
- edx.devstack.lms_watcher

cms_watcher:
command: bash -c 'cd /edx/app/edxapp/edx-platform && source ../edxapp_env && while true; do paver watch_assets --w=$$ASSET_WATCHER_TIMEOUT; sleep 2; done'
command: bash -c 'cd /edx/app/edxapp/edx-platform && source ../edxapp_env && while true; do npm run watch --w=$$ASSET_WATCHER_TIMEOUT; sleep 2; done'
container_name: "edx.${COMPOSE_PROJECT_NAME:-devstack}.cms_watcher"
environment:
FRONTEND_TEST_SERVER_HOSTNAME: edx.devstack.cms_watcher
Expand Down
4 changes: 2 additions & 2 deletions docs/devstack_faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Unlike the ``node_modules`` directory, the ``virtualenv`` used to run Python
code in a Docker container only exists inside that container. Changes made to
a container's filesystem are not saved when the container exits, so if you
manually install or upgrade Python packages in a container (via
``pip install``, ``paver install_python_prereqs``, etc.), they will no
``pip install``, ``pip install -r requirements/edx/base.txt``, etc.), they will no
longer be present if you restart the container. (Devstack Docker containers
lose changes made to the filesystem when you reboot your computer, run
``make remove-containers``, restart or upgrade Docker itself, etc.) If you want to ensure
Expand Down Expand Up @@ -78,7 +78,7 @@ JavaScript packages for Node.js are installed into the ``node_modules``
directory of the local git repository checkout which is synced into the
corresponding Docker container. Hence these can be upgraded via any of the
usual methods for that service (``npm install``,
``paver install_node_prereqs``, etc.), and the changes will persist between
``npm clean-install``, etc.), and the changes will persist between
container restarts.

How do I rebuild static assets?
Expand Down
15 changes: 2 additions & 13 deletions docs/testing_and_debugging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,8 @@ Running LMS and CMS Tests
----------------------------

After entering a shell for the appropriate service via ``make lms-shell`` or
``make cms-shell``, you can run any of the usual paver commands from the
`edx-platform testing documentation`_. Examples:

.. code:: sh
paver run_quality
paver test_a11y
paver test_bokchoy
paver test_js
paver test_lib
paver test_python
Tests can also be run individually. Example:
``make cms-shell``, you can run commands from the `edx-platform testing documentation`_
Tests can be run individually. Example:

.. code:: sh
Expand Down
8 changes: 4 additions & 4 deletions docs/troubleshoot_general_tips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ To fix this situation, change the owner back to yourself outside of the containe
Running LMS commands within a container
---------------------------------------

Most of the ``paver`` commands require a settings flag. If omitted, the flag defaults to
``devstack``. If you run into issues running ``paver`` commands in a docker container, you should append
Most of the commands require a settings flag. If omitted, the flag defaults to
``devstack``. If you run into issues running commands in a docker container, you should append
the ``devstack_docker`` flag. For example:

.. code:: sh
$ paver update_assets --settings=devstack_docker
$ npm run build && ./manage.py lms collectstatic --no-input --settings=devstack_docker
Resource busy or locked
-----------------------
Expand Down Expand Up @@ -266,7 +266,7 @@ The fix is to get a new auth session. You can do any of the following:
Missing vendor file node_modules/backbone.paginator/lib/backbone.paginator.js
-----------------------------------------------------------------------------
This message sometimes appears when provisioning. The root cause of this is as yet unknown but the most effective workaround seems to be
to shell into the LMS (``make lms-shell`` in devstack) and run ``npm ci``, followed by ``paver update_assets``.
to shell into the LMS (``make lms-shell`` in devstack) and run ``npm ci``, followed by ``npm run build && ./manage.py lms collectstatic --no-input && ./manage.py cms collectstatic``.
See `the github issue`_ to follow the work being done on the resolution.

.. _the github issue: https://github.com/openedx/devstack/issues/1072
Expand Down
6 changes: 3 additions & 3 deletions provision-lms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ done
for app in "${apps[@]}"; do
docker compose exec -T $app bash -e -c 'apt-get update && apt-get -y install --no-install-recommends git'

docker compose exec -T $app bash -e -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && NO_PYTHON_UNINSTALL=1 paver install_prereqs'
docker compose exec -T $app bash -e -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && NO_PYTHON_UNINSTALL=1 pip install -e . -r requirements/edx/base.txt -r requirements/edx/assets.txt && npm clean-install'

#Installing prereqs crashes the process
docker compose restart $app
Expand Down Expand Up @@ -75,11 +75,11 @@ done


# Fix missing vendor file by clearing the cache
docker compose exec -T lms bash -e -c 'rm /edx/app/edxapp/edx-platform/.prereqs_cache/Node_prereqs.sha1'
# docker compose exec -T lms bash -e -c 'rm /edx/app/edxapp/edx-platform/.prereqs_cache/Node_prereqs.sha1'

# Create static assets for both LMS and CMS
for app in "${apps[@]}"; do
docker compose exec -T $app bash -e -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && paver update_assets --settings devstack_docker'
docker compose exec -T $app bash -e -c 'source /edx/app/edxapp/edxapp_env && cd /edx/app/edxapp/edx-platform && npm run build && ./manage.py lms collectstatic --noinput --settings devstack_docker && ./manage.py cms collectstatic --noinput --settings devstack_docker'
done

# Allow LMS SSO for CMS
Expand Down

0 comments on commit 7f452d9

Please sign in to comment.